Skip to content

Commit 120e6d7

Browse files
committed
Various small fixes and clean up
1 parent 3f90ca6 commit 120e6d7

File tree

3 files changed

+14
-1
lines changed

3 files changed

+14
-1
lines changed

src/controller/org.controller/index.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1004,7 +1004,10 @@ router.post(
10041004
*/
10051005
mw.validateUser,
10061006
mw.onlySecretariat,
1007-
body(['short_name']).isString().trim().notEmpty().isLength({ min: CONSTANTS.MIN_SHORTNAME_LENGTH, max: CONSTANTS.MAX_SHORTNAME_LENGTH }),
1007+
body(['short_name'])
1008+
.isString().withMessage(errorMsgs.MUST_BE_STRING).trim()
1009+
.notEmpty().withMessage(errorMsgs.NOT_EMPTY)
1010+
.isLength({ min: CONSTANTS.MIN_SHORTNAME_LENGTH, max: CONSTANTS.MAX_SHORTNAME_LENGTH }).withMessage(errorMsgs.SHORTNAME_LENGTH),
10081011
body(['name']).isString().trim().notEmpty(),
10091012
body(['authority.active_roles']).optional()
10101013
.custom(isFlatStringArray)
@@ -1178,6 +1181,7 @@ router.put('/org/:shortname',
11781181
parseError,
11791182
parsePostParams,
11801183
controller.ORG_UPDATE_SINGLE)
1184+
11811185
router.get('/org/:shortname/id_quota',
11821186
/*
11831187
#swagger.tags = ['Organization']

src/middleware/errorMessages.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33
module.exports = {
44
ORG_ROLES: 'Invalid role. Valid roles are CNA, SECRETARIAT',
55
USER_ROLES: 'Invalid role. Valid role is ADMIN',
6+
NOT_EMPTY: 'Value must not be empty',
7+
SHORTNAME_LENGTH: 'Value must be between 2 and 20 characters in length.',
8+
MUST_BE_STRING: 'Value must be a string',
69
ID_QUOTA: 'The id_quota does not comply with CVE id quota limitations',
710
ID_STATES: 'Invalid CVE ID state. Valid states are: RESERVED, PUBLISHED, REJECTED',
811
ID_MODIFY_STATES: 'Invalid CVE ID state. Valid states are: RESERVED, REJECTED',

src/repositories/baseOrgRepository.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,12 @@ function setAggregateRegistryOrgObj (query) {
3535
return [
3636
{
3737
$match: query
38+
},
39+
{
40+
$project: {
41+
_id: false,
42+
__t: false
43+
}
3844
}
3945
]
4046
}

0 commit comments

Comments
 (0)