...
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2025-11-20 10:23:22 +08:00
parent 0bf3b718b2
commit 4eb44422d2
4 changed files with 108 additions and 72 deletions

View File

@@ -15,23 +15,34 @@ export async function getFoldersByOwner(owner: string) {
return folders;
}
export async function renameFolderById(id: number, newName: string) {
await prisma.folder.update({
where: {
id: id,
},
data: {
name: newName,
},
});
}
export async function getFoldersWithTotalPairsByOwner(owner: string) {
const folders = await prisma.folder.findMany({
where: {
owner: owner
owner: owner,
},
include: {
text_pair: {
select: {
id: true
}
}
}
id: true,
},
},
},
});
return folders.map(folder => ({
return folders.map((folder) => ({
...folder,
total_pairs: folder.text_pair.length
total_pairs: folder.text_pair.length,
}));
}