immutable application settings framework

This commit is contained in:
DecDuck
2024-11-02 11:32:36 +11:00
parent 583301ff40
commit 5fe2036f0b
5 changed files with 117 additions and 2 deletions
+25
View File
@@ -0,0 +1,25 @@
import prisma from "../internal/db/database";
export default defineNitroPlugin(async (nitro) => {
const userCount = await prisma.user.count({});
if (userCount != 0) return;
// This setup runs every time the server sets up,
// so it should be in-place
// Create admin invitation
await prisma.invitation.upsert({
where: {
id: "admin",
},
create: {
id: "admin",
isAdmin: true,
},
update: {
isAdmin: true,
},
});
});