Return error response for missing or invalid note title and body in sync process
Despliegue Automático / desplegar (push) Successful in 1m1s
Despliegue Automático / desplegar (push) Successful in 1m1s
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user