feat: create admin notification settings on bootstrap

This commit is contained in:
Kirill
2026-05-18 11:40:24 +05:00
parent 84cdccaa17
commit 1d36f6a31b
+16 -1
View File
@@ -8,9 +8,24 @@ export async function ensureAdminUser() {
throw new Error('ADMIN_EMAIL должен быть валидным email') throw new Error('ADMIN_EMAIL должен быть валидным email')
} }
await prisma.user.upsert({ const admin = await prisma.user.upsert({
where: { email: adminEmail }, where: { email: adminEmail },
update: {}, update: {},
create: { email: adminEmail }, 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,
},
})
}
} }