- Remove BMAD framework, IDE configs, dev screenshots, test files, internal docs, and backup files - Rename keep-notes/ to memento-note/ - Update all references from keep-notes to memento-note - Add Apache 2.0 license with Commons Clause (non-commercial restriction) - Add clean .gitignore and .env.docker.example
36 lines
824 B
JavaScript
36 lines
824 B
JavaScript
const { PrismaClient } = require('../prisma/client-generated');
|
|
const prisma = new PrismaClient();
|
|
|
|
async function promoteAdmin() {
|
|
const email = process.argv[2];
|
|
|
|
try {
|
|
let user;
|
|
if (email) {
|
|
user = await prisma.user.findUnique({ where: { email } });
|
|
} else {
|
|
console.log("Aucun email fourni, promotion du premier utilisateur trouvé...");
|
|
user = await prisma.user.findFirst();
|
|
}
|
|
|
|
if (!user) {
|
|
console.error("Aucun utilisateur trouvé.");
|
|
return;
|
|
}
|
|
|
|
await prisma.user.update({
|
|
where: { id: user.id },
|
|
data: { role: 'ADMIN' }
|
|
});
|
|
|
|
console.log(`Succès : L'utilisateur ${user.email} (${user.name}) est maintenant ADMIN.`);
|
|
|
|
} catch (e) {
|
|
console.error("Erreur :", e);
|
|
} finally {
|
|
await prisma.$disconnect();
|
|
}
|
|
}
|
|
|
|
promoteAdmin();
|