Purpose - Allow users to be promoted to admin status with the SUDO token, and then to review and promote the suggested draft resources through the web UI.
How to check -
Check out the branch and run npm run migration -- up to apply the migration
This will set any existing users to is_admin: false
Run npm run migration -- down 1, to ensure it can be reversed, then ... -- up again
Run the app and visit the home page, the "Drafts" menu option should not be visible
Log in as a non-admin user (all users start as non-admin), the "Drafts" menu option should still not be visible
Suggest some resources, to be reviewed later
Use the SUDO token auth (e.g. via the /docs) to view the user list (GET /api/users) and promote a user to admin (PATCH /api/users/:id)
Log in as that user (or refresh the page if already logged in as them), the "Drafts" menu option should be visible
Visit the Drafts page, you should see the suggested but not-yet-published resources
When you click a Publish button, the associated resource should disappear from the Drafts list and appear on the Home page
If the request responds 401 (e.g. set the user's admin status back to false in the DB before publishing) the user should be automatically returned to the home page in the logged out state
Review the API docs, /api/users endpoint descriptions should match the observed behaviour
Run npm run migration -- down 1 before switching back to any other branches
Links
N/A
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~
[ ] I have added tests, or ~new tests were not required~
[ ] I have updated any documentation (e.g. diagrams, schemas), or ~documentation updates were not required~
This is a:
Description
npm run migration -- up
to apply the migrationis_admin: false
npm run migration -- down 1
, to ensure it can be reversed, then... -- up
again/docs
) to view the user list (GET /api/users
) and promote a user to admin (PATCH /api/users/:id
)/api/users
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