feat: add error handling to player creation and update gitignore for agent
This commit is contained in:
47
prisma/seed.ts
Normal file
47
prisma/seed.ts
Normal file
@@ -0,0 +1,47 @@
|
||||
import { PrismaClient } from '@prisma/client'
|
||||
import bcrypt from 'bcryptjs'
|
||||
|
||||
const prisma = new PrismaClient()
|
||||
|
||||
async function main() {
|
||||
const password = await bcrypt.hash('Android@2020', 12)
|
||||
|
||||
// 1. Criar Admin
|
||||
await prisma.admin.upsert({
|
||||
where: { email: 'admin@temfut.com' },
|
||||
update: {},
|
||||
create: {
|
||||
email: 'admin@temfut.com',
|
||||
name: 'Super Admin',
|
||||
password: password,
|
||||
role: 'SUPER_ADMIN'
|
||||
}
|
||||
})
|
||||
|
||||
// 2. Criar Pelada de Exemplo
|
||||
await prisma.group.upsert({
|
||||
where: { email: 'erik@idealpages.com.br' },
|
||||
update: {},
|
||||
create: {
|
||||
name: 'Fut de Quarta',
|
||||
slug: 'futdequarta',
|
||||
email: 'erik@idealpages.com.br',
|
||||
password: password,
|
||||
status: 'ACTIVE',
|
||||
plan: 'PRO',
|
||||
primaryColor: '#10b981',
|
||||
secondaryColor: '#000000'
|
||||
}
|
||||
})
|
||||
|
||||
console.log('Seed concluído com sucesso!')
|
||||
}
|
||||
|
||||
main()
|
||||
.catch((e) => {
|
||||
console.error(e)
|
||||
process.exit(1)
|
||||
})
|
||||
.finally(async () => {
|
||||
await prisma.$disconnect()
|
||||
})
|
||||
Reference in New Issue
Block a user