30 lines
640 B
TypeScript
30 lines
640 B
TypeScript
import { PrismaClient } from '../generated';
|
|
import * as bcrypt from 'bcrypt';
|
|
|
|
const prisma = new PrismaClient();
|
|
|
|
async function main() {
|
|
const password = await bcrypt.hash('SuperAdmin@123', 12);
|
|
|
|
const admin = await prisma.superAdmin.upsert({
|
|
where: { email: 'superadmin@fiberops.dev' },
|
|
update: {},
|
|
create: {
|
|
email: 'superadmin@fiberops.dev',
|
|
password,
|
|
firstName: 'Super',
|
|
lastName: 'Admin',
|
|
isActive: true,
|
|
},
|
|
});
|
|
|
|
console.log(`Seeded superadmin: ${admin.email}`);
|
|
}
|
|
|
|
main()
|
|
.catch((e) => {
|
|
console.error(e);
|
|
process.exit(1);
|
|
})
|
|
.finally(() => prisma.$disconnect());
|