Moving the arttags table to tags table part 1

This commit is contained in:
2026-02-02 13:05:52 +01:00
parent 6680ccc023
commit 7605ccb0aa
27 changed files with 604 additions and 107 deletions

View File

@ -22,7 +22,7 @@ function mapSortingToOrderBy(sorting: ArtworkTableInput["sorting"]) {
// relation counts: Prisma supports ordering by _count
albumsCount: (desc) => ({ albums: { _count: desc ? "desc" : "asc" } }),
categoriesCount: (desc) => ({ categories: { _count: desc ? "desc" : "asc" } }),
tagsCount: (desc) => ({ tags: { _count: desc ? "desc" : "asc" } }),
tagsCount: (desc) => ({ tagsV2: { _count: desc ? "desc" : "asc" } }),
};
const orderBy = sorting
@ -89,7 +89,7 @@ export async function getArtworksTablePage(input: unknown) {
gallery: { select: { id: true, name: true } },
albums: { select: { id: true, name: true } },
categories: { select: { id: true, name: true } },
_count: { select: { albums: true, categories: true, tags: true } },
_count: { select: { albums: true, categories: true, tagsV2: true } },
},
}),
]);
@ -109,7 +109,7 @@ export async function getArtworksTablePage(input: unknown) {
categories: a.categories,
albumsCount: a._count.albums,
categoriesCount: a._count.categories,
tagsCount: a._count.tags,
tagsCount: a._count.tagsV2,
}));
const out = { rows, total, pageIndex, pageSize };