feat: user management api#302
Conversation
|
Looks like you did not link an issue to this PR. If this PR completes a task, consider linking it. |
|
aha i tak chyba źle podpiałem issue |
|
the workflow that reminds you to link issues only looks at your pull request's description, so it only checks for issues linked with keywords, not manually |
|
also you don't need to manually request reviews on our repos, github automatically requests reviews from appropriate users/teams based on the codeowners file we've created |
mini-bomba
left a comment
There was a problem hiding this comment.
yeah no, this aint finished at all
mini-bomba
left a comment
There was a problem hiding this comment.
only general review pass for now, focusing on the source of your lint issues and possible api design problems
| const page = request.input("page", 1) as number; | ||
| const limit = request.input("limit", 10) as number; |
There was a problem hiding this comment.
do not use input/param, validate everything (applies to the entire file)
| async findOne({ request, auth }: HttpContext) { | ||
| await this.requireSuperUserOrSelf(auth, parseInt(request.param("id"))); |
There was a problem hiding this comment.
i think it would be more reasonable to have an endpoint such as /users/me rather than allowing the user to get "get" themselves using the standard endpoint if they know their own id
also we might already have such an endpoint, in the auth controller...
| } | ||
|
|
||
| async update({ request, auth }: HttpContext) { | ||
| await this.requireSuperUserOrSelf(auth, parseInt(request.param("id"))); |
There was a problem hiding this comment.
and also be careful with what the user can update themselves
tbh i think they should only be able to edit their own password, and we likely have such a method in the auth controller already
* feat: user management api * refactor: user contoller to custom one, transactions" * fix: lint * fix: fix: lint * refactor: changes * fix: delete endpoint wrap with transactions and arrow function error creation
I tested a few functionalities: