initial: standalone repo from monorepo split
This commit is contained in:
29
packages/admin-db/prisma/seed.ts
Normal file
29
packages/admin-db/prisma/seed.ts
Normal file
@@ -0,0 +1,29 @@
|
||||
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());
|
||||
Reference in New Issue
Block a user