mirror of
https://github.com/Drop-OSS/drop.git
synced 2025-11-09 20:12:10 +10:00
feat: introduction of 'system user'
This commit is contained in:
@ -12,4 +12,28 @@ export default defineNitroPlugin(async (nitro) => {
|
||||
nitro.hooks.hookOnce("close", async () => {
|
||||
await applicationSettings.waitForWrite();
|
||||
});
|
||||
|
||||
// Ensure system user exists
|
||||
// The system user owns any user-based code
|
||||
// that we want to re-use for the app
|
||||
// e.g. notifications
|
||||
await prisma.user.upsert({
|
||||
where: {
|
||||
id: "system",
|
||||
},
|
||||
create: {
|
||||
id: "system",
|
||||
admin: true,
|
||||
|
||||
displayName: "System",
|
||||
username: "system",
|
||||
email: "system@drop",
|
||||
profilePicture: "",
|
||||
},
|
||||
update: {
|
||||
admin: true,
|
||||
authMecs: { set: [] },
|
||||
clients: { set: [] },
|
||||
},
|
||||
});
|
||||
});
|
||||
@ -5,6 +5,7 @@ export default defineNitroPlugin(async (nitro) => {
|
||||
if (userCount != 0) return;
|
||||
|
||||
// This setup runs every time the server sets up,
|
||||
// but has not been configured
|
||||
// so it should be in-place
|
||||
|
||||
// Create admin invitation
|
||||
@ -15,12 +16,10 @@ export default defineNitroPlugin(async (nitro) => {
|
||||
create: {
|
||||
id: "admin",
|
||||
isAdmin: true,
|
||||
expires: new Date('4096-01-01')
|
||||
expires: new Date("4096-01-01"),
|
||||
},
|
||||
update: {
|
||||
isAdmin: true,
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
Reference in New Issue
Block a user