diff --git a/src/services/syncService.js b/src/services/syncService.js index 684c2ca..3dc326b 100644 --- a/src/services/syncService.js +++ b/src/services/syncService.js @@ -117,8 +117,8 @@ class SyncService { for (const incomingNote of incomingNotes) { const permanentDelete = Boolean(incomingNote.permanentDelete); - if (!incomingNote.id || (!permanentDelete && (!incomingNote.title || !incomingNote.body))) { - throw new Error('Cada nota debe incluir id, title y body'); + if (!incomingNote.id || typeof incomingNote.title !== 'string' || typeof incomingNote.body !== 'string') { + return res.status(400).json({ message: "Cada nota debe incluir id, title y body" }); } const incomingBaseVersion = getIncomingVersion('nota', incomingNote);