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 }));