mathesar-foundation / mathesar

Web application providing an intuitive user experience to databases.
https://mathesar.org/
GNU General Public License v3.0
2.39k stars 333 forks source link

Move `User` model manipulation to RPC endpoint #3993

Open mathemancer opened 1 week ago

mathemancer commented 1 week ago

Problem

One of our few remaining REST endpoints is /api/ui/v0/users/. Keeping that endpoint requires keeping around DRF, and in particular, requires keeping around our DRF error handling machinery. This adds an astonishing amount of complexity and code to our repo.

Proposed solution

We should move Mathesar user-wrangling functionality to RPC functions. The current list of endponts mapped to functions (from the wiki) is:

Endpoint HTTP Method Function
/api/ui/v0/users/{userId}/ DELETE users.delete
/api/ui/v0/users/{userId}/ GET users.get
/api/ui/v0/users/{userId}/ PATCH users.patch
/api/ui/v0/users/{userId}/password_reset/ POST users.password.revoke
/api/ui/v0/users/ GET users.list
/api/ui/v0/users/ POST users.add
/api/ui/v0/users/password_change/ POST users.password.replace_own

Additional context

We elected to forgo moving these endpoints as part of the architectural transition to save time.

### Tasks
- [ ] https://github.com/mathesar-foundation/mathesar/issues/4000
- [ ] https://github.com/mathesar-foundation/mathesar/issues/4001
- [ ] https://github.com/mathesar-foundation/mathesar/issues/4002
- [ ] https://github.com/mathesar-foundation/mathesar/issues/4003
- [ ] https://github.com/mathesar-foundation/mathesar/issues/4004
- [ ] https://github.com/mathesar-foundation/mathesar/issues/4005
- [ ] https://github.com/mathesar-foundation/mathesar/issues/4006
nilaygit-10721 commented 4 days ago

can you assign me this issue?

mathemancer commented 4 days ago

Hey @nilaygit-10721, this issue isn't quite ready for community contribution yet. I need to split it into a number of sub-tasks.

However, once I do that, you are welcome to try to solve one of the sub-tasks and submit a PR. We'll assign the issue for the sub-task you choose to you once you submit the PR, so no one else works on it while we're reviewing your work.

Thank you!

nilaygit-10721 commented 4 days ago

okay @mathemancer thank you let me know when i can do that

mathemancer commented 2 days ago

@nilaygit-10721 Okay, I've specced out some issues.

Please submit PRs for each individual linked issue, and wait for the first to be reviewed before proceeding to the next.