Files
psp_api/prisma/seed.ts
T

35 lines
768 B
TypeScript

import { PasswordUtil } from '@/common/utils/password.util'
import { prisma } from '../src/lib/prisma'
async function main() {
const password = await PasswordUtil.hash('123456')
const adminUser = await prisma.account.upsert({
where: { username: 'superAdmin' },
update: {},
create: {
username: 'superAdmin',
password,
type: 'ADMIN',
status: 'ACTIVE',
user: {
create: {
first_name: 'عباس',
last_name: 'حسنی',
national_code: '0016022289',
mobile_number: '09120258156',
},
},
},
})
}
main()
.then(async () => {
await prisma.$disconnect()
})
.catch(async e => {
console.error(e)
await prisma.$disconnect()
process.exit(1)
})