mirror of
https://github.com/R0m1k3/noteflow.git
synced 2026-10-11 17:29:37 +02:00
Merge pull request #136 from R0m1k3/claude/fix-notes-sync-issue-01AMeEdrKQErsM7bvhKkqEEF
fix: revert INTEGER fields to use 0/1 instead of boolean
This commit is contained in:
2 files changed
+4
-4
No files matched your search
@@ -972,7 +972,7 @@ router.patch('/:id/priority', async (req, res) => {
|
||||
return res.status(404).json({ error: 'Note non trouvée' });
|
||||
}
|
||||
|
||||
await runQuery('UPDATE notes SET priority = $1, updated_at = CURRENT_TIMESTAMP WHERE id = $2', [priority, req.params.id]); // BOOLEAN instead of 0/1
|
||||
await runQuery('UPDATE notes SET priority = $1, updated_at = CURRENT_TIMESTAMP WHERE id = $2', [priority ? 1 : 0, req.params.id]); // notes.priority is INTEGER not BOOLEAN
|
||||
|
||||
logger.info(`Priorité de la note ${req.params.id} modifiée: ${priority}`);
|
||||
res.json({ message: 'Priorité modifiée avec succès', priority });
|
||||
|
||||
@@ -150,7 +150,7 @@ router.put('/:id',
|
||||
if (in_progress !== undefined) {
|
||||
paramCount++;
|
||||
updates.push(`in_progress = $${paramCount}`);
|
||||
params.push(in_progress); // BOOLEAN instead of 0/1
|
||||
params.push(in_progress ? 1 : 0); // global_todos.in_progress is INTEGER not BOOLEAN
|
||||
}
|
||||
|
||||
if (updates.length > 0) {
|
||||
@@ -240,12 +240,12 @@ router.patch('/:id/in-progress', async (req, res) => {
|
||||
return res.status(404).json({ error: 'Todo non trouvé' });
|
||||
}
|
||||
|
||||
const newInProgress = !todo.in_progress; // BOOLEAN instead of 0/1
|
||||
const newInProgress = todo.in_progress ? 0 : 1; // global_todos.in_progress is INTEGER not BOOLEAN
|
||||
await runQuery('UPDATE global_todos SET in_progress = $1 WHERE id = $2', [newInProgress, req.params.id]);
|
||||
|
||||
logger.info(`Todo global ${newInProgress ? 'marqué en cours' : 'démarqué en cours'} (ID: ${req.params.id}) par ${req.user.username}`);
|
||||
|
||||
res.json({ message: 'Statut en cours modifié avec succès', in_progress: newInProgress });
|
||||
res.json({ message: 'Statut en cours modifié avec succès', in_progress: newInProgress === 1 });
|
||||
} catch (inProgressError) {
|
||||
// Si le champ in_progress n'existe pas encore
|
||||
if (inProgressError.message && inProgressError.message.includes('in_progress')) {
|
||||
|
||||
Reference in new issue
Block a user