feat(auth/seed): create admin@canino-iran.com user with bcrypt hash in database & seed.ts
Some checks failed
Deploy Canina / deploy (push) Failing after 28s

This commit is contained in:
parsa aghaei 2026-08-08 18:21:28 +03:30
parent 713a714dd2
commit df340143dc

View File

@ -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'
}
});