bug fix
This commit is contained in:
parent
0dda77db1e
commit
f183f122e9
|
@ -13,6 +13,8 @@ export default async function exportData(userId: number) {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
pinnedLinks: true,
|
||||||
|
whitelistedUsers: true,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -37,24 +37,6 @@ export default async function importFromLinkwarden(
|
||||||
for (const e of data.collections) {
|
for (const e of data.collections) {
|
||||||
e.name = e.name.trim();
|
e.name = e.name.trim();
|
||||||
|
|
||||||
const findCollection = await prisma.user.findUnique({
|
|
||||||
where: {
|
|
||||||
id: userId,
|
|
||||||
},
|
|
||||||
select: {
|
|
||||||
collections: {
|
|
||||||
where: {
|
|
||||||
name: e.name,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
const checkIfCollectionExists = findCollection?.collections[0];
|
|
||||||
|
|
||||||
let collectionId = findCollection?.collections[0]?.id;
|
|
||||||
|
|
||||||
if (!checkIfCollectionExists) {
|
|
||||||
const newCollection = await prisma.collection.create({
|
const newCollection = await prisma.collection.create({
|
||||||
data: {
|
data: {
|
||||||
owner: {
|
owner: {
|
||||||
|
@ -70,9 +52,6 @@ export default async function importFromLinkwarden(
|
||||||
|
|
||||||
createFolder({ filePath: `archives/${newCollection.id}` });
|
createFolder({ filePath: `archives/${newCollection.id}` });
|
||||||
|
|
||||||
collectionId = newCollection.id;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Import Links
|
// Import Links
|
||||||
for (const link of e.links) {
|
for (const link of e.links) {
|
||||||
const newLink = await prisma.link.create({
|
const newLink = await prisma.link.create({
|
||||||
|
@ -82,7 +61,7 @@ export default async function importFromLinkwarden(
|
||||||
description: link.description,
|
description: link.description,
|
||||||
collection: {
|
collection: {
|
||||||
connect: {
|
connect: {
|
||||||
id: collectionId,
|
id: newCollection.id,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
// Import Tags
|
// Import Tags
|
||||||
|
|
Ŝarĝante…
Reference in New Issue