Exercise management enhanced

This commit is contained in:
aodulov
2025-11-26 09:07:29 +02:00
parent e28ddccd7f
commit 6d08c2cf11
8 changed files with 211 additions and 169 deletions

34
create_admin.js Normal file
View File

@@ -0,0 +1,34 @@
const { PrismaClient } = require('@prisma/client');
const bcrypt = require('bcryptjs');
(async () => {
const prisma = new PrismaClient();
try {
const email = 'admin@gymflow.com';
const password = 'admin123';
const hashedPassword = await bcrypt.hash(password, 10);
const user = await prisma.user.upsert({
where: { email },
update: {},
create: {
email,
password: hashedPassword,
role: 'ADMIN',
isFirstLogin: false,
profile: {
create: {
weight: 80,
height: 180,
gender: 'MALE'
}
}
}
});
console.log('Admin user created/verified:', user);
} catch (e) {
console.error('Error:', e);
} finally {
await prisma.$disconnect();
}
})();