Files
v2.admin.gaertan.art/src/actions/artworks/getGalleryVariantStats.ts
2026-01-31 01:34:13 +01:00

25 lines
492 B
TypeScript

"use server";
import { prisma } from "@/lib/prisma";
export type GalleryVariantStats = {
total: number;
withGallery: number;
missing: number;
};
export async function getGalleryVariantStats(): Promise<GalleryVariantStats> {
const [total, withGallery] = await Promise.all([
prisma.artwork.count(),
prisma.artwork.count({
where: { variants: { some: { type: "gallery" } } },
}),
]);
return {
total,
withGallery,
missing: total - withGallery,
};
}