33 lines
684 B
JavaScript
33 lines
684 B
JavaScript
const { PrismaClient } = require('../src/generated/client');
|
|
const bcrypt = require('bcryptjs');
|
|
|
|
const prisma = new PrismaClient();
|
|
|
|
async function main() {
|
|
const email = 'admin@occto.com';
|
|
const password = 'admin'; // Senha inicial simples
|
|
const hashedPassword = await bcrypt.hash(password, 10);
|
|
|
|
const user = await prisma.user.upsert({
|
|
where: { email },
|
|
update: {},
|
|
create: {
|
|
email,
|
|
name: 'Admin Occto',
|
|
password: hashedPassword,
|
|
},
|
|
});
|
|
|
|
console.log({ user });
|
|
}
|
|
|
|
main()
|
|
.then(async () => {
|
|
await prisma.$disconnect();
|
|
})
|
|
.catch(async (e) => {
|
|
console.error(e);
|
|
await prisma.$disconnect();
|
|
process.exit(1);
|
|
});
|