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

S24/sayi/add user management endpoints #35

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

sthuray
Copy link
Contributor

@sthuray sthuray commented Oct 4, 2024

Notion ticket link

Ticket Name

Implementation description

  • Changed UpdateUserDTO/UpdateUserDtoValidator so that users can update a user without providing every field
  • If a behaviourist tries to update a user and they update a value that they don't have access to, entire request is invalidated

Steps to test

GET

  1. No queries (get all users)
UME - GET - all users
  1. Query with both userId & email
UME - GET - email and userId query
  1. Invalid userId
UME - GET - invalid userId
  1. UserId not in database
UME - GET - nonexisting userid
  1. Get with userId (successful)
UME - GET by userid
  1. Invalid email
UME - GET - invalid email
  1. Email not in database
UME - DELETE - nonexisting email
  1. Get with email (successful)
UME - GET by email

PUT:

  1. (Behaviourist) userId not in database (similarly, test invalid userId)
UME - AM - userId not found
  1. (Behaviourist) Update only invalid fields
UME - AM - Update only invalid fields
  1. (Behaviourist) Update invalid & valid fields
UME - AM - Update a few valid:invalid fields
  1. (Behaviourist) Update valid fields
UME - AM - Successful Update
  1. (Admin) Update all fields
UME - Admin - Success

DELETE:

  1. Query with both userId & email
UME - DELETE - both params
  1. Query without parameters
UME - DELETE - no params
  1. Invalid userId
UME - DELETE - Invalid userid
  1. userId not in database
UME - DELETE - nonexisting userid
  1. Delete user with "Active" status by userId/email
UME - DELETE - active by userid
  1. Delete Animal Behaviourist with "Inactive" status by userId
UME - DELETE - inactive behaviourist by email
  1. Invalid email
UME - DELETE - invalid email
  1. Email not in database
UME - DELETE - nonexisting email
  1. Delete volunteer with "Invited" status (by email)
UME - DELETE - invited volunteer by id
  1. Delete as a Behaviourist
UME - DELETE - delete as behaviourist

What should reviewers focus on?

  • Refactored try catch statements in PUT
  • Set filtering for PUT
  • Querying with a non-existent email doesn't return a NotFoundError (add this to emailService?)
  • Querying with userId=10. gets through since Number(10.) returns 10, doesn't cause any problems, only visible when returning "userId 10. not found in database" (still checks database for userId 10 here)

Checklist

  • My PR name is descriptive and in imperative tense
  • My commit messages are descriptive and in imperative tense. My commits are atomic and trivial commits are squashed or fixup'd into non-trivial commits
  • I have run the appropriate linter(s)
  • I have requested a review from the PL, as well as other devs who have background knowledge on this PR or who will be building on top of this PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant