scripts/seed-admin.ts
Annotation non disponible
Lance npm run annotate (nécessite ANTHROPIC_API_KEY dans .env.local) pour générer une annotation française par Claude Haiku 4.5.
Code source· typescript
import { PrismaClient } from "@prisma/client";
import bcrypt from "bcryptjs";
import "dotenv/config";
const prisma = new PrismaClient();
async function main() {
// Supprimer le placeholder créé manuellement
await prisma.user.deleteMany({
where: { email: "admin@superapp.com" },
});
const hash = await bcrypt.hash("changeme_admin_2024", 10);
const admin = await prisma.user.create({
data: {
email: "admin@superapp.com",
motDePasseHash: hash,
role: "SUPER_ADMIN",
nom: "Super Admin",
tenantId: null,
},
});
console.log("✅ Super admin créé :", admin.email);
await prisma.$disconnect();
}
main().catch(console.error);import { PrismaClient } from "@prisma/client";
import bcrypt from "bcryptjs";
import "dotenv/config";
const prisma = new PrismaClient();
async function main() {
// Supprimer le placeholder créé manuellement
await prisma.user.deleteMany({
where: { email: "admin@superapp.com" },
});
const hash = await bcrypt.hash("changeme_admin_2024", 10);
const admin = await prisma.user.create({
data: {
email: "admin@superapp.com",
motDePasseHash: hash,
role: "SUPER_ADMIN",
nom: "Super Admin",
tenantId: null,
},
});
console.log("✅ Super admin créé :", admin.email);
await prisma.$disconnect();
}
main().catch(console.error);