From f5bc2b08f9a1c947d58010b2c69b19593255ef67 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gustav=20Engstr=C3=B6m?= Date: Mon, 15 Jan 2024 12:07:22 +0100 Subject: [PATCH] Added archive option to of Wekan API --- models/cards.js | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/models/cards.js b/models/cards.js index 6d54d289f..4f059ac9b 100644 --- a/models/cards.js +++ b/models/cards.js @@ -3860,6 +3860,25 @@ JsonRoutes.add('GET', '/api/boards/:boardId/cards_count', function( newBoardId, ); } + if (req.body.archive) { + function isTrue(data) { + return String(data).toLowerCase() === 'true'; + } + var archive = isTrue(req.body.archive); + Cards.direct.update( + { + _id: paramCardId, + listId: paramListId, + boardId: paramBoardId, + archived: !archive, + }, + { + $set: { + archived: archive, + }, + }, + ); + } JsonRoutes.sendResult(res, { code: 200, data: {