chore: clean up repo for public release
- 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
This commit is contained in:
35
memento-note/scripts/promote-admin.js
Normal file
35
memento-note/scripts/promote-admin.js
Normal file
@@ -0,0 +1,35 @@
|
||||
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();
|
||||
Reference in New Issue
Block a user