implemented #112

This commit is contained in:
PxlLoewe
2025-07-25 16:53:22 -07:00
parent 14ea5fcf55
commit f534bbc902
2 changed files with 28 additions and 3 deletions

View File

@@ -4,6 +4,9 @@ import { prisma, Prisma, Changelog } from "@repo/db";
export const upsertChangelog = async (
changelog: Prisma.ChangelogCreateInput,
id?: Changelog["id"],
options?: {
skipUserUpdate?: boolean;
},
) => {
const newChangelog = id
? await prisma.changelog.update({
@@ -12,10 +15,13 @@ export const upsertChangelog = async (
})
: await prisma.$transaction(async (prisma) => {
const createdChangelog = await prisma.changelog.create({ data: changelog });
if (!options?.skipUserUpdate) {
// Update all users to acknowledge the new changelog
await prisma.user.updateMany({
data: { changelogAck: false },
});
await prisma.user.updateMany({
data: { changelogAck: false },
});
}
return createdChangelog;
});