GTBitsOfGood/Healing4Heroes

[Backend] - Extend the API Wrapper

Closed this issue · 0 comments

Description

for this ticket, we will extend the API Wrapper (backend/server/utils/APIWrapper.ts) we have used throughout the previous sprints. Currently, we have functionality within the user to be verified by an admin but we are not doing anything with that field on the User model. We will want to handle this in our API wrapper (so we do not need to make this check in every API endpoint explicitly).

Acceptance Criteria

  • Add a field to the config dictionary called requireAdminVerification --> default this value to true
  • When the requireAdminVerfication is true, check if the user is verified by the admin (this is a field on the User Model) -- if not, throw an Error
  • This check should only be made if we also requireToken (because that is the only way we can get a user to check haha)

Other Notes

  • This is a relatively simple ticket but some things in the API Wrapper are confusing so please bother me if you have any questions 😃