Refactor mosaic

This commit is contained in:
2025-07-22 00:33:32 +02:00
parent a8d5dbaa09
commit 9962bb1476
5 changed files with 191 additions and 27 deletions

View File

@ -18,6 +18,7 @@ export async function updateImage(
originalFile,
nsfw,
published,
setAsHeader,
altText,
description,
fileType,
@ -29,6 +30,14 @@ export async function updateImage(
categoryIds
} = validated.data;
if(setAsHeader) {
await prisma.portfolioImage.updateMany({
where: { setAsHeader: true },
data: { setAsHeader: false },
})
}
const updatedImage = await prisma.portfolioImage.update({
where: { id: id },
data: {
@ -36,6 +45,7 @@ export async function updateImage(
originalFile,
nsfw,
published,
setAsHeader,
altText,
description,
fileType,