This commit is contained in:
2025-04-13 15:19:59 +02:00
parent 1ea3e77fa8
commit 14f415e228
46 changed files with 14161 additions and 539 deletions

29
scripts/add-user.js Normal file
View File

@ -0,0 +1,29 @@
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();

23
scripts/add-user.sql Normal file
View File

@ -0,0 +1,23 @@
-- Add user: Gregor Klevže
-- Note: In a real application, you would use proper password hashing,
-- but for direct SQL insertion we're using a placeholder password that you should change immediately
INSERT INTO `User` (
`email`,
`password`,
`name`,
`surname`,
`active`,
`role`,
`createdAt`,
`updatedAt`
)
VALUES (
'gregor@klevze.si',
'gk1510!', -- This should be hashed in a real application
'Gregor',
'Klevže',
true,
'admin',
NOW(),
NOW()
);

29
scripts/add-user.ts Normal file
View File

@ -0,0 +1,29 @@
import { PrismaClient } from '../src/generated/prisma';
import * as 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();