Skip to content

Commit 638d58c

Browse files
committed
update getQCdetector
1 parent aa666f9 commit 638d58c

2 files changed

Lines changed: 6 additions & 3 deletions

File tree

lib/domain/enums/DetectorTypes.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,11 @@ const DETECTOR_TYPES = Object.values(DetectorType);
2828
*/
2929
const DATA_TAKING_DETECTOR_TYPES = [DetectorType.PHYSICAL, DetectorType.VIRTUAL];
3030

31+
const QC_DETECTOR_TYPES = [DetectorType.PHYSICAL, DetectorType.QC_ONLY, DetectorType.AOT_EVENT, DetectorType.AOT_GLO, DetectorType.MUON_GLO];
32+
3133
module.exports = {
3234
DetectorType,
3335
DETECTOR_TYPES,
3436
DATA_TAKING_DETECTOR_TYPES,
37+
QC_DETECTOR_TYPES,
3538
};

lib/server/services/detector/getQcDetectorOrFail.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ const { BadParameterError } = require('../../errors/BadParameterError.js');
1515
const { DetectorRepository } = require('../../../database/repositories/index.js');
1616
const { Op } = require('sequelize');
1717
const { NotFoundError } = require('../../errors/NotFoundError.js');
18-
const { DetectorType } = require('../../../domain/enums/DetectorTypes.js');
18+
const { QC_DETECTOR_TYPES } = require('../../../domain/enums/DetectorTypes.js');
1919

2020
/**
2121
* Find and return a QC (PHYSICAL or QC_ONLY) detector identified by its name or id and throw if it does not exists
@@ -37,7 +37,7 @@ exports.getQcDetectorOrFail = async ({ detectorId, detectorName }) => {
3737
where: {
3838
[Op.and]: [
3939
criteria,
40-
{ type: { [Op.in]: [DetectorType.PHYSICAL, DetectorType.QC_ONLY] } },
40+
{ type: { [Op.in]: QC_DETECTOR_TYPES } },
4141
],
4242
},
4343
});
@@ -46,7 +46,7 @@ exports.getQcDetectorOrFail = async ({ detectorId, detectorName }) => {
4646
const criteriaExpression = detectorId !== undefined && detectorId !== null
4747
? `id (${detectorId})`
4848
: `name (${detectorName})`;
49-
throw new NotFoundError(`Physical detector with this ${criteriaExpression} could not be found`);
49+
throw new NotFoundError(`QC detector with this ${criteriaExpression} could not be found`);
5050
}
5151
return detector;
5252
};

0 commit comments

Comments
 (0)