implemented #112
This commit is contained in:
@@ -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;
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user