Keep/keep-notes/scripts/promote-admin.js
sepehr 640fcb26f7 fix: improve note interactions and markdown LaTeX support
## Bug Fixes

### Note Card Actions
- Fix broken size change functionality (missing state declaration)
- Implement React 19 useOptimistic for instant UI feedback
- Add startTransition for non-blocking updates
- Ensure smooth animations without page refresh
- All note actions now work: pin, archive, color, size, checklist

### Markdown LaTeX Rendering
- Add remark-math and rehype-katex plugins
- Support inline equations with dollar sign syntax
- Support block equations with double dollar sign syntax
- Import KaTeX CSS for proper styling
- Equations now render correctly instead of showing raw LaTeX

## Technical Details

- Replace undefined currentNote references with optimistic state
- Add optimistic updates before server actions for instant feedback
- Use router.refresh() in transitions for smart cache invalidation
- Install remark-math, rehype-katex, and katex packages

## Testing

- Build passes successfully with no TypeScript errors
- Dev server hot-reloads changes correctly
2026-01-09 22:13:49 +01:00

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();