Skip to content

Commit 0efc8aa

Browse files
committed
#1258 addressing comments from team
1 parent 278065c commit 0efc8aa

File tree

4 files changed

+29
-27
lines changed

4 files changed

+29
-27
lines changed

api-docs/openapi.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -2099,7 +2099,7 @@
20992099
"Organization"
21002100
],
21012101
"summary": "Updates information about the organization specified by short name (accessible to Secretariat)",
2102-
"description": " <h2>Access Control</h2> <p>User must belong to an organization with the <b>Secretariat</b> role</p> <h2>Expected Behavior</h2> <p><b>CNA:</b> Updates 'last_active' timestamp to show that a CNA is still active</p> <p><b>Secretariat:</b> Updates any organization's information</p>",
2102+
"description": " <h2>Access Control</h2> <p>User must belong to an organization with the <b>Secretariat</b> or <b>CNA</b> role</p> <h2>Expected Behavior</h2> <p><b>CNA:</b> Updates 'last_active' timestamp to show that a CNA is still active</p> <p><b>Secretariat:</b> Updates any organization's information</p>",
21032103
"operationId": "orgUpdateSingle",
21042104
"parameters": [
21052105
{

package-lock.json

+23-23
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/controller/org.controller/index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -310,10 +310,10 @@ router.put('/org/:shortname',
310310
}
311311
*/
312312
mw.validateUser,
313+
param(['shortname']).isString().trim().isLength({ min: CONSTANTS.MIN_SHORTNAME_LENGTH, max: CONSTANTS.MAX_SHORTNAME_LENGTH }),
313314
mw.validateOrg,
314315
query().custom((query) => { return mw.validateQueryParameterNames(query, ['new_short_name', 'id_quota', 'name', 'active_roles.add', 'active_roles.remove']) }),
315316
query(['new_short_name', 'id_quota', 'name', 'active_roles.add', 'active_roles.remove']).custom((val) => { return mw.containsNoInvalidCharacters(val) }),
316-
param(['shortname']).isString().trim().isLength({ min: CONSTANTS.MIN_SHORTNAME_LENGTH, max: CONSTANTS.MAX_SHORTNAME_LENGTH }),
317317
query(['new_short_name']).optional().isString().trim().notEmpty().isLength({ min: CONSTANTS.MIN_SHORTNAME_LENGTH, max: CONSTANTS.MAX_SHORTNAME_LENGTH }),
318318
query(['id_quota']).optional().not().isArray().isInt({ min: CONSTANTS.MONGOOSE_VALIDATION.Org_policies_id_quota_min, max: CONSTANTS.MONGOOSE_VALIDATION.Org_policies_id_quota_max }).withMessage(errorMsgs.ID_QUOTA),
319319
query(['name']).optional().isString().trim().notEmpty(),

src/controller/org.controller/org.controller.js

+4-2
Original file line numberDiff line numberDiff line change
@@ -368,7 +368,9 @@ async function updateOrg (req, res, next) {
368368
newOrg.last_active = Date.now()
369369
}
370370
})
371-
} else {
371+
}
372+
373+
if (shortName === orgMakingChanges) {
372374
newOrg.last_active = Date.now()
373375
}
374376

@@ -414,7 +416,7 @@ async function updateOrg (req, res, next) {
414416
result = result.length > 0 ? result[0] : null
415417

416418
if (!isSec) {
417-
if (!result.last_active) {
419+
if (!result || !result.last_active) {
418420
return res.status(500).json(error.serverError())
419421
}
420422
result = { last_active: result.last_active }

0 commit comments

Comments
 (0)