Your Prisma client.
A SettingsStore on your own versions tables, through a mapping (see
PrismaSettingsMap), so Evalkeeper's pages and your own read the same
history.
Your Prisma client.
Where your tables differ from Evalkeeper's.
Your own versions tables, with a user id for who changed what:
const settingsStore = prismaSettingsStore(prisma, {
models: {
evalSettingsVersion: "operationVersion",
evalSettingsLive: "operationLive",
evalSettingsChange: "operationChange",
},
fields: {
evalSettingsVersion: { temperature: null },
evalSettingsChange: { by: "userId" },
},
by: {
toColumn: (by) => by, // your pages pass the admin's id
fromColumn: async (id) =>
(await prisma.user.findUnique({ where: { id } }))?.name ?? null,
},
});
A SettingsStore on the EvalSettings tables. Each switch runs in one transaction, and moves the live pointer only if it still points at the version the switch was decided against, so concurrent saves can't silently overwrite each other.