mirror of
https://github.com/BreizhHardware/Site-comptage-heure.git
synced 2026-01-18 16:17:28 +01:00
34 lines
717 B
JavaScript
34 lines
717 B
JavaScript
const { PrismaClient } = require('@prisma/client');
|
|
const bcrypt = require('bcryptjs');
|
|
const { v4: uuidv4 } = require('uuid');
|
|
|
|
const prisma = new PrismaClient();
|
|
|
|
async function main() {
|
|
// Create test user
|
|
const hashedPassword = await bcrypt.hash('password', 10);
|
|
await prisma.user.upsert({
|
|
where: { email: 'test@example.com' },
|
|
update: {},
|
|
create: {
|
|
email: 'test@example.com',
|
|
password: hashedPassword,
|
|
role: 'MEMBER',
|
|
firstName: 'Test',
|
|
lastName: 'User',
|
|
id: uuidv4(),
|
|
},
|
|
});
|
|
|
|
console.log('Test user created');
|
|
}
|
|
|
|
main()
|
|
.catch((e) => {
|
|
console.error(e);
|
|
process.exit(1);
|
|
})
|
|
.finally(async () => {
|
|
await prisma.$disconnect();
|
|
});
|