Initial BizOne portal setup

This commit is contained in:
2026-05-11 11:36:33 +07:00
commit 57017dd397
249 changed files with 41305 additions and 0 deletions

View File

@ -0,0 +1,42 @@
const path = require('node:path');
const { PrismaClient } = require('@prisma/client');
const bcrypt = require('bcryptjs');
const dotenv = require('dotenv');
dotenv.config({ path: path.resolve(process.cwd(), '../.env'), quiet: true });
dotenv.config({ path: path.resolve(process.cwd(), '.env'), quiet: true });
const prisma = new PrismaClient();
async function main() {
const email = 'admin@example.com';
const password = 'ChangeMe123!';
const passwordHash = await bcrypt.hash(password, 10);
const user = await prisma.user.upsert({
where: { email },
update: {
name: 'System Admin',
passwordHash,
status: 'active',
},
create: {
name: 'System Admin',
email,
passwordHash,
status: 'active',
},
});
console.log(`Seeded admin user: ${user.email}`);
console.log(`Recommended credentials: ${email} / ${password}`);
}
main()
.catch((error) => {
console.error(error);
process.exit(1);
})
.finally(async () => {
await prisma.$disconnect();
});