feat: implement app directory routing, authentication flow, and dynamic reporting module
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
import { PrismaClient } from '@prisma/client'
|
||||
import bcrypt from 'bcryptjs'
|
||||
|
||||
const prisma = new PrismaClient()
|
||||
|
||||
async function main() {
|
||||
const superadminUsername = 'superadmin'
|
||||
const superadminPassword = 'titipin123!'
|
||||
|
||||
const hashedPassword = await bcrypt.hash(superadminPassword, 10)
|
||||
|
||||
const superadmin = await prisma.user.upsert({
|
||||
where: { username: superadminUsername },
|
||||
update: {},
|
||||
create: {
|
||||
username: superadminUsername,
|
||||
name: 'Super Admin',
|
||||
password: hashedPassword,
|
||||
role: 'superadmin',
|
||||
is_active: true,
|
||||
},
|
||||
})
|
||||
|
||||
console.log({ superadmin })
|
||||
}
|
||||
|
||||
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