Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resolved issue #1258, adds feature to PUT /org/{shortname} to update new last_active field. #1262

Merged
merged 18 commits into from
Aug 21, 2024

Conversation

jack-flores
Copy link
Collaborator

@jack-flores jack-flores commented Jul 29, 2024

Closes Issue #1258

Summary

Adds a new field last_active to the Org schema, and updates this field to Date.now() when PUT /org/{shortname} is hit. Only a secretariat can use this endpoint to make changes to fields other than last_active.

Important Changes

src/controller/org.controller/index.js

  • Replaced mw.onlySecretariat with mw.validateOrg -- all Orgs can now call this endpoint, but only secretariats can use this endpoint to make changes to fields other than last_active

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

  • Added functionality to update the last_active field, and only allow secretariats to make other changes.

src/middleware/middleware.js

  • new function validateOrg checks to see if either 1) the requester is the secretariat, or 2) the requester is trying to make changes to their own org. If one of these cases is true, continue with the request. Otherwise, return 403 forbidden.

src/model/org.js

  • added last_active field to org schema

test/integration-tests/org/putOrgTest.js

  • Added 5 integration tests for updated endpoint functionality

Testing

Steps to manually test updated functionality

  • [ npm run test:integration] 1) Run integration test suite
  • [ npm run test:unit-tests] 1) Run unit test suite

Notes

  • time.modified field also updates when endpoint is called

@jack-flores jack-flores marked this pull request as ready for review August 21, 2024 15:13
@jdaigneau5 jdaigneau5 merged commit 3300b06 into dev Aug 21, 2024
9 checks passed
jdaigneau5 added a commit that referenced this pull request Oct 30, 2024
This reverts commit 3300b06, reversing
changes made to 8fc52ad.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

2 participants