From e96370fb75cb63004c5e8ff38418169b6c9029ca Mon Sep 17 00:00:00 2001 From: xsalonx Date: Thu, 7 Mar 2024 14:28:47 +0100 Subject: [PATCH] add color default --- lib/server/services/qualityControlFlag/QCFlagTypesService.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/server/services/qualityControlFlag/QCFlagTypesService.js b/lib/server/services/qualityControlFlag/QCFlagTypesService.js index 14ad556752..66f95516bd 100644 --- a/lib/server/services/qualityControlFlag/QCFlagTypesService.js +++ b/lib/server/services/qualityControlFlag/QCFlagTypesService.js @@ -20,6 +20,9 @@ const { NotFoundError } = require('../../errors/NotFoundError'); const { getUserOrFail } = require('../user/getUserOrFail'); const { ConflictError } = require('../../errors/ConflictError'); +const DEFAULT_BAD_FLAG_COLOR = '#d62631'; +const DEFAULT_NOT_BAD_FLAG_COLOR = '#4caf50'; + /** * @typedef QCFlagTypeIdentifier * @param {number} id @@ -96,7 +99,7 @@ class QCFlagTypesService { name, method, bad, - color, + color: color ?? bad ? DEFAULT_BAD_FLAG_COLOR : DEFAULT_NOT_BAD_FLAG_COLOR, createdById: user.id, }); return qcFlagTypeAdapter.toEntity(await this.getByIdentifier({ id: newFlagInstance.id }));