mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-26 18:42:49 +00:00
17 lines
581 B
TypeScript
17 lines
581 B
TypeScript
import { PrismaClient } from '@prisma/client';
|
|
import * as bcrypt from 'bcrypt';
|
|
|
|
const prisma = new PrismaClient();
|
|
|
|
async function main() {
|
|
const passwordHash = await bcrypt.hash('admin123', 10);
|
|
const user = await prisma.user.upsert({
|
|
where: { email: 'admin@edr-platform.com' },
|
|
update: { passwordHash, role: 'ADMIN' },
|
|
create: { fullName: 'EDR Admin', email: 'admin@edr-platform.com', phone: '+251900000000', passwordHash, role: 'ADMIN' },
|
|
});
|
|
console.log('✅ Admin ready:', user.email);
|
|
}
|
|
|
|
main().catch(console.error).finally(() => prisma.$disconnect());
|