Purpose - so that we know who has suggested each resource, the user must be logged in to access and use the /suggest page (and POST /api/resources endpoint)
How to check -
Check out the branch and run npm run migration -- up to apply the migration
Note this will drop all existing resources from your database, so that it can make the source field non-nullable
Run npm run migration -- down 1 to ensure it can be reversed (although the deleted resources cannot be restored), then ... -- up again
Run the app and visit the home page, the "Suggest" menu option should not be visible
Log in and the menu option should appear
Visiting the suggest page and suggesting a resource should still work as before
If the request responds 401 (e.g. edit server/resources/resourcesController.js to .post((_, res) => res.sendStatus(401))) the user should be automatically returned to the home page in the logged out state (no "Suggest" menu option, "Log in" option rather than "Account")
Review the API docs, /api/resources endpoint descriptions should match the observed behaviour
Run npm run migration -- down 1 before switching back to any other branches
Links
Author checklist
[ ] ~I have written a title that reflects the relevant ticket~
[x] I have written a description that says what the PR does and how to validate it
[ ] ~I have linked to the project board ticket (and any related PRs/issues) in the Links section~
[ ] ~I have added a link to this PR to the ticket~
[x] I have made the PR to main from a branch named <category>/<name>, e.g. feature/edit-spaceships or bugfix/restore-oxygen
[x] I have manually tested that the app still works correctly
[ ] ~I have requested reviewers here and in my team chat channel~
[ ] ~I have spoken with my PM or TL about any parts of this task that may have become out-of-scope, or any additional improvements that I now realise may benefit my project~
[x] I have added tests, or ~new tests were not required~
[x] I have updated any documentation (e.g. diagrams, schemas), or ~documentation updates were not required~
This is a:
Description
/suggest
page (andPOST /api/resources
endpoint)npm run migration -- up
to apply the migrationsource
field non-nullablenpm run migration -- down 1
to ensure it can be reversed (although the deleted resources cannot be restored), then... -- up
againserver/resources/resourcesController.js
to.post((_, res) => res.sendStatus(401))
) the user should be automatically returned to the home page in the logged out state (no "Suggest" menu option, "Log in" option rather than "Account")/api/resources
endpoint descriptions should match the observed behaviournpm run migration -- down 1
before switching back to any other branchesLinks
Author checklist
main
from a branch named<category>/<name>
, e.g.feature/edit-spaceships
orbugfix/restore-oxygen