feat: create admin notification settings on bootstrap
This commit is contained in:
Vendored
+16
-1
@@ -8,9 +8,24 @@ export async function ensureAdminUser() {
|
||||
throw new Error('ADMIN_EMAIL должен быть валидным email')
|
||||
}
|
||||
|
||||
await prisma.user.upsert({
|
||||
const admin = await prisma.user.upsert({
|
||||
where: { email: adminEmail },
|
||||
update: {},
|
||||
create: { email: adminEmail },
|
||||
})
|
||||
|
||||
// Ensure admin notification settings exist
|
||||
const existing = await prisma.adminNotificationSettings.findFirst()
|
||||
if (!existing) {
|
||||
await prisma.adminNotificationSettings.create({
|
||||
data: {
|
||||
emailEnabled: true,
|
||||
telegramEnabled: false,
|
||||
newOrder: true,
|
||||
newOrderMessage: true,
|
||||
newReview: true,
|
||||
authCodeDuplicate: false,
|
||||
},
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user