[Feature]: Unify create user logic #146

Closed
opened 2026-02-04 18:11:04 +03:00 by OVERLORD · 3 comments
Owner

Originally created by @jbaez on GitHub (Jul 15, 2022).

Feature detail

Currently there are 2 endpoints that creates users introducing duplicated logic:

  • POST /auth/admin-sign-up
  • POST /user

They can be both merged into a single endpoint POST /user with the following business logic:

  • admin can only be created if no admin was created before
  • prevent creating a user with the same email
  • a user can be created only by the admin user

Platform

Server / Web / maybe Mobile

Originally created by @jbaez on GitHub (Jul 15, 2022). ### Feature detail Currently there are 2 endpoints that creates users introducing duplicated logic: - `POST /auth/admin-sign-up` - `POST /user` They can be both merged into a single endpoint `POST /user` with the following business logic: - admin can only be created if no admin was created before - prevent creating a user with the same email - a user can be created only by the admin user ### Platform Server / Web / maybe Mobile
Author
Owner

@FelixHaimmerer commented on GitHub (Aug 20, 2022):

And it would be cool to add the function to delete users again.
Maybe in the add user screen a third button to delete the user. :)

@FelixHaimmerer commented on GitHub (Aug 20, 2022): And it would be cool to add the function to delete users again. Maybe in the add user screen a third button to delete the user. :)
Author
Owner

@jrasm91 commented on GitHub (Dec 28, 2022):

Can this be closed? The logic is pretty much unified through user core. I also don't think it makes sense to merge an authenticated route with an unauthenticated one.

@jrasm91 commented on GitHub (Dec 28, 2022): Can this be closed? The logic is pretty much unified through user core. I also don't think it makes sense to merge an authenticated route with an unauthenticated one.
Author
Owner

@jbaez commented on GitHub (Dec 28, 2022):

Yeah let's close this. I think now we probably only have some duplication in the request DTO validation. And yes you are right, it would make it more complicated to merge the API endpoints

@jbaez commented on GitHub (Dec 28, 2022): Yeah let's close this. I think now we probably only have some duplication in the request DTO validation. And yes you are right, it would make it more complicated to merge the API endpoints
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: immich-app/immich#146