29 lines
648 B
JavaScript
29 lines
648 B
JavaScript
import { PrismaClient } from '@prisma/client';
|
|
import bcrypt from 'bcrypt';
|
|
|
|
const prisma = new PrismaClient();
|
|
|
|
async function createUser() {
|
|
try {
|
|
const hashedPassword = await bcrypt.hash('gk1510!', 10);
|
|
|
|
const user = await prisma.user.create({
|
|
data: {
|
|
email: 'gregor@klevze.si',
|
|
password: hashedPassword,
|
|
name: 'Gregor',
|
|
surname: 'Klevže',
|
|
active: true,
|
|
role: 'admin',
|
|
},
|
|
});
|
|
|
|
console.log('User created successfully:', user);
|
|
} catch (error) {
|
|
console.error('Error creating user:', error);
|
|
} finally {
|
|
await prisma.$disconnect();
|
|
}
|
|
}
|
|
|
|
createUser(); |