Enviar arquivos para "/"
This commit is contained in:
34
seed.ts
Normal file
34
seed.ts
Normal file
@@ -0,0 +1,34 @@
|
||||
import { PrismaClient } from '@prisma/client';
|
||||
import bcrypt from 'bcrypt';
|
||||
|
||||
const prisma = new PrismaClient();
|
||||
|
||||
async function main() {
|
||||
console.log('Iniciando o seed...');
|
||||
|
||||
const passwordHash = await bcrypt.hash('123456', 10);
|
||||
|
||||
const admin = await prisma.usuario.upsert({
|
||||
where: { email: 'admin@gastrobar.com' },
|
||||
update: {},
|
||||
create: {
|
||||
nome: 'Administrador',
|
||||
email: 'admin@gastrobar.com',
|
||||
senha: passwordHash,
|
||||
role: 'ADMIN',
|
||||
ativo: true,
|
||||
},
|
||||
});
|
||||
|
||||
console.log('Usuário admin criado:', admin.email);
|
||||
}
|
||||
|
||||
main()
|
||||
.then(async () => {
|
||||
await prisma.$disconnect();
|
||||
})
|
||||
.catch(async (e) => {
|
||||
console.error(e);
|
||||
await prisma.$disconnect();
|
||||
process.exit(1);
|
||||
});
|
||||
Reference in New Issue
Block a user