From df340143dc44d7809208234da5f6bdfc368b3175 Mon Sep 17 00:00:00 2001 From: parsa aghaei Date: Sat, 8 Aug 2026 18:21:28 +0330 Subject: [PATCH] feat(auth/seed): create admin@canino-iran.com user with bcrypt hash in database & seed.ts --- backend/prisma/seed.ts | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/backend/prisma/seed.ts b/backend/prisma/seed.ts index 889620c..49c2649 100644 --- a/backend/prisma/seed.ts +++ b/backend/prisma/seed.ts @@ -3,6 +3,7 @@ import * as fs from 'fs'; import * as path from 'path'; import * as ts from 'typescript'; import * as vm from 'vm'; +import * as bcrypt from 'bcryptjs'; const prisma = new PrismaClient(); @@ -29,16 +30,21 @@ async function main() { console.log('Database successfully wiped.'); console.log('Creating Admin User...'); + const adminHashedPassword = await bcrypt.hash('admin123', 10); await prisma.user.upsert({ - where: { id: '12345678-1234-1234-1234-123456789012' }, - update: {}, + where: { email: 'admin@canino-iran.com' }, + update: { + password: adminHashedPassword, + role: 'Admin', + }, create: { id: '12345678-1234-1234-1234-123456789012', - firstName: 'Admin', - lastName: 'System', - email: 'admin@canino.ir', - role: 'ADMIN', - mobile: '09000000000' + firstName: 'مدیر', + lastName: 'سیستم', + email: 'admin@canino-iran.com', + password: adminHashedPassword, + role: 'Admin', + mobile: '09120000001' } });