main
Some checks failed
Deploy Backend / deploy (push) Has been cancelled

This commit is contained in:
2026-02-05 01:29:22 +03:00
parent ae24c17f50
commit 80dcf4d04a
30 changed files with 14275 additions and 0 deletions

43
create_admin.ts Normal file
View File

@@ -0,0 +1,43 @@
import { PrismaClient } from '@prisma/client';
import bcrypt from 'bcryptjs';
const prisma = new PrismaClient();
async function createAdmin() {
const email = 'admin@digicraft.app';
const password = 'adminpassword'; // Stronger password
const role = 'ADMIN';
console.log(`Creating Admin User: ${email}`);
const salt = await bcrypt.genSalt(10);
const passwordHash = await bcrypt.hash(password, salt);
try {
const user = await prisma.user.upsert({
where: { email },
update: {
passwordHash,
role
},
create: {
email,
passwordHash,
role
}
});
console.log("✅ Admin User Created Successfully!");
console.log(`📧 Email: ${email}`);
console.log(`🔑 Password: ${password}`);
console.log(`🛡️ Role: ${user.role}`);
} catch (error) {
console.error("❌ Error creating admin:", error);
} finally {
await prisma.$disconnect();
}
}
createAdmin();