ucsb-cs156-m23 / proj-happycows-m23-10am-4

https://ucsb-cs156-m23.github.io/proj-happycows-m23-10am-4/
0 stars 1 forks source link

Qi delete user backend #85

Closed publicqi closed 1 year ago

publicqi commented 1 year ago

Overview

This PR adds code to allow an admin to delete (actually hide) a user. After hiding, the user does not have access to any api endpoints it previously had.

The added apis are endpoint "/api/admin/user/unhide" and "/api/admin/user/hide". The implementation is done via adding a field to the User class.

Other changes are to adapt tests.

Screenshots (Optional)

Feedback Request (Optional)

Future Possibilities (Optional)

Validation (Optional)

Tests

Linked Issues

Closes #84

dscpsyl commented 1 year ago

The only extra thing I would bring up is that this has to work with the chat feature. So when a user is "deleted", we need to deal with their messages as well.

publicqi commented 1 year ago

The only extra thing I would bring up is that this has to work with the chat feature. So when a user is "deleted", we need to deal with their messages as well.

I think there're two points worth noting:

  1. If you want to retrieve chat messages excluding hidden user's, you can use a function in chat Repository to filter
  2. All endpoints should check if the requesting user is hidden. This is a general problem I mentioned in #86 Future Possibilities. Maybe there's a better way to decouple the code

Once the Chat backend is ready for merge, I can add the checks to that

publicqi commented 1 year ago

I'll fix the conflict when all other approved PRs get merged into main

dscpsyl commented 1 year ago

Close this after #106 has been merged

pconrad commented 1 year ago

Closing because has many merge conflicts, and the feature was not implemented in the way the user wanted.