From 4e942afba62f35add18ccce823cb984f6a4c9bf6 Mon Sep 17 00:00:00 2001 From: Wartijn Date: Wed, 11 Jan 2023 20:14:19 +0100 Subject: [PATCH] API: Fixes #6862 set todo related fields when adding or changing a todo (#7395) --- packages/lib/services/rest/Api.test.ts | 4 ++++ packages/lib/services/rest/routes/notes.ts | 2 ++ 2 files changed, 6 insertions(+) diff --git a/packages/lib/services/rest/Api.test.ts b/packages/lib/services/rest/Api.test.ts index 9851dbb07..0b3f27c36 100644 --- a/packages/lib/services/rest/Api.test.ts +++ b/packages/lib/services/rest/Api.test.ts @@ -298,7 +298,11 @@ describe('services_rest_Api', function() { title: 'testing 4', parent_id: f.id, is_todo: '1', + todo_due: '2', + todo_completed: '3', })); + expect(response.todo_due).toBe(2); + expect(response.todo_completed).toBe(3); })); it('should create folders with supplied ID', (async () => { diff --git a/packages/lib/services/rest/routes/notes.ts b/packages/lib/services/rest/routes/notes.ts index 2a8f4def4..502833baf 100644 --- a/packages/lib/services/rest/routes/notes.ts +++ b/packages/lib/services/rest/routes/notes.ts @@ -108,6 +108,8 @@ async function requestNoteToNote(requestNote: any) { if ('user_updated_time' in requestNote) output.user_updated_time = Database.formatValue(Database.TYPE_INT, requestNote.user_updated_time); if ('user_created_time' in requestNote) output.user_created_time = Database.formatValue(Database.TYPE_INT, requestNote.user_created_time); if ('is_todo' in requestNote) output.is_todo = Database.formatValue(Database.TYPE_INT, requestNote.is_todo); + if ('todo_due' in requestNote) output.todo_due = Database.formatValue(Database.TYPE_INT, requestNote.todo_due); + if ('todo_completed' in requestNote) output.todo_completed = Database.formatValue(Database.TYPE_INT, requestNote.todo_completed); if ('markup_language' in requestNote) output.markup_language = Database.formatValue(Database.TYPE_INT, requestNote.markup_language); if ('longitude' in requestNote) output.longitude = requestNote.longitude; if ('latitude' in requestNote) output.latitude = requestNote.latitude;