From 85a407610a274975c9d8cce3e7969abbfd396d2d Mon Sep 17 00:00:00 2001 From: jack-flores Date: Tue, 20 Aug 2024 11:43:52 -0400 Subject: [PATCH] #1258 addressing comments from team --- api-docs/openapi.json | 11 +++++++++-- src/controller/org.controller/index.js | 13 +++++++++---- src/controller/org.controller/org.controller.js | 3 --- 3 files changed, 18 insertions(+), 9 deletions(-) diff --git a/api-docs/openapi.json b/api-docs/openapi.json index 1a7ebad46..34fb3cedf 100644 --- a/api-docs/openapi.json +++ b/api-docs/openapi.json @@ -2099,7 +2099,7 @@ "Organization" ], "summary": "Updates information about the organization specified by short name (accessible to Secretariat)", - "description": "

Access Control

User must belong to an organization with the Secretariat role

Expected Behavior

Secretariat: Updates any organization's information

", + "description": "

Access Control

User must belong to an organization with the Secretariat role, or user must belong to the organization specified by short name

Expected Behavior

Secretariat: Updates any organization's information

Non-secretariat: Updates 'last_active' timestamp to show that an org is still active

", "operationId": "orgUpdateSingle", "parameters": [ { @@ -2142,7 +2142,14 @@ "content": { "application/json": { "schema": { - "$ref": "../schemas/org/update-org-response.json" + "oneOf": [ + { + "$ref": "../schemas/org/update-org-response.json" + }, + { + "$ref": "../schemas/org/am-i-alive-response.json" + } + ] } } } diff --git a/src/controller/org.controller/index.js b/src/controller/org.controller/index.js index ab3b76b6e..2c9279835 100644 --- a/src/controller/org.controller/index.js +++ b/src/controller/org.controller/index.js @@ -245,10 +245,10 @@ router.put('/org/:shortname', #swagger.summary = "Updates information about the organization specified by short name (accessible to Secretariat)" #swagger.description = "

Access Control

-

User must belong to an organization with the Secretariat role

+

User must belong to an organization with the Secretariat role, or user must belong to the organization specified by short name

Expected Behavior

-

CNA: Updates 'last_active' timestamp to show that a CNA is still active

-

Secretariat: Updates any organization's information

" +

Secretariat: Updates any organization's information

+

Non-secretariat: Updates 'last_active' timestamp to show that an org is still active

" #swagger.parameters['shortname'] = { description: 'The shortname of the organization' } #swagger.parameters['$ref'] = [ '#/components/parameters/id_quota', @@ -264,7 +264,12 @@ router.put('/org/:shortname', description: 'Returns information about the organization updated', content: { "application/json": { - schema: { $ref: '../schemas/org/update-org-response.json' } + schema: { + oneOf: [ + { $ref: '../schemas/org/update-org-response.json' }, + { $ref: '../schemas/org/am-i-alive-response.json' } + ] + } } } } diff --git a/src/controller/org.controller/org.controller.js b/src/controller/org.controller/org.controller.js index 566781265..7803da44c 100644 --- a/src/controller/org.controller/org.controller.js +++ b/src/controller/org.controller/org.controller.js @@ -364,9 +364,6 @@ async function updateOrg (req, res, next) { }) } } - if (shortName === orgMakingChanges) { - newOrg.last_active = Date.now() - } }) }