Excluir seed.ts
This commit is contained in:
34
seed.ts
34
seed.ts
@@ -1,34 +0,0 @@
|
|||||||
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