Initial commit
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
const { PrismaClient } = require('@prisma/client');
|
||||
const bcrypt = require('bcryptjs');
|
||||
|
||||
const prisma = new PrismaClient({});
|
||||
|
||||
async function main() {
|
||||
const adminEmail = 'admin@tesscorp.com.mx';
|
||||
const existingAdmin = await prisma.user.findUnique({ where: { email: adminEmail } });
|
||||
|
||||
if (!existingAdmin) {
|
||||
const hashedPassword = await bcrypt.hash('SoporteTess2026!', 10);
|
||||
await prisma.user.create({
|
||||
data: {
|
||||
email: adminEmail,
|
||||
password: hashedPassword,
|
||||
role: 'ADMIN'
|
||||
}
|
||||
});
|
||||
console.log('Admin user created successfully');
|
||||
} else {
|
||||
console.log('Admin user already exists');
|
||||
}
|
||||
}
|
||||
|
||||
main()
|
||||
.catch(e => console.error(e))
|
||||
.finally(async () => await prisma.$disconnect());
|
||||
Reference in New Issue
Block a user