drop-server-bak/server/plugins/01.system-init.ts

28 lines
600 B
TypeScript
Raw Permalink Normal View History

2025-04-23 21:14:16 -04:00
import prisma from "~/server/internal/db/database";
2025-04-15 21:10:45 -04:00
export default defineNitroPlugin(async (_nitro) => {
2024-11-16 16:18:15 +11:00
// Ensure system user exists
// The system user owns any user-based code
// that we want to reuse for the app
2024-11-16 16:18:15 +11:00
// e.g. notifications
await prisma.user.upsert({
where: {
id: "system",
},
create: {
id: "system",
admin: true,
displayName: "System",
username: "system",
email: "system@drop",
profilePictureObjectId: "",
2024-11-16 16:18:15 +11:00
},
update: {
admin: true,
authMecs: { set: [] },
clients: { set: [] },
},
});
});