Bug commentaires + statuts + ajout personnage depuis l'app
- Fix parseHTML commentaires (attributs perdus au rechargement) - Statut: Posée → Validée, Germe supprimé (17 fiches migrées) - Bouton "+" pour ajouter un personnage directement depuis le formulaire - Zone "Après l'histoire" sur la frise (couleur prune) - Icône frise harmonisée (symbole plat) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -126,6 +126,33 @@ app.get('/api/columns', requireAuth, async (req, res) => {
|
||||
}
|
||||
});
|
||||
|
||||
// Add a new Personnage option
|
||||
app.post('/api/columns/personnage', requireAuth, async (req, res) => {
|
||||
try {
|
||||
const { name } = req.body;
|
||||
if (!name) return res.status(400).json({ error: 'Nom requis' });
|
||||
// Get current column meta
|
||||
const metaUrl = `${NOCODB_URL}/api/v2/meta/tables/${NOCODB_TABLE_ID}`;
|
||||
const metaRes = await fetch(metaUrl, { headers: { 'xc-token': NOCODB_TOKEN } });
|
||||
const table = await metaRes.json();
|
||||
const col = table.columns.find(c => c.title === 'Personnage');
|
||||
if (!col) return res.status(404).json({ error: 'Colonne Personnage introuvable' });
|
||||
const options = col.colOptions?.options || [];
|
||||
if (options.some(o => o.title === name)) return res.status(409).json({ error: 'Existe déjà' });
|
||||
options.push({ title: name });
|
||||
const patchUrl = `${NOCODB_URL}/api/v2/meta/columns/${col.id}`;
|
||||
const patchRes = await fetch(patchUrl, {
|
||||
method: 'PATCH',
|
||||
headers: { 'xc-token': NOCODB_TOKEN, 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({ colOptions: { options } }),
|
||||
});
|
||||
if (!patchRes.ok) return res.status(500).json({ error: 'Erreur NocoDB' });
|
||||
res.json({ ok: true });
|
||||
} catch (e) {
|
||||
res.status(500).json({ error: e.message });
|
||||
}
|
||||
});
|
||||
|
||||
// Bulk update order (for drag-and-drop)
|
||||
app.post('/api/reorder', requireAuth, async (req, res) => {
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user