Create new user without the need to be logged in.
(session: SessionDep, user_in: UserRegister)
| 21 | |
| 22 | @router.post("", response_model=UserPublic) |
| 23 | def register_user(session: SessionDep, user_in: UserRegister) -> Any: |
| 24 | """ |
| 25 | Create new user without the need to be logged in. |
| 26 | """ |
| 27 | if not settings.USERS_OPEN_REGISTRATION: |
| 28 | raise HTTPException( |
| 29 | status_code=403, |
| 30 | detail="Open user registration is forbidden on this server", |
| 31 | ) |
| 32 | user = services.get_user_by_email(session=session, email=user_in.email) |
| 33 | if user: |
| 34 | raise HTTPException( |
| 35 | status_code=409, |
| 36 | detail="The user with this email already exists in the system", |
| 37 | ) |
| 38 | user_create = UserCreate.model_validate(user_in) |
| 39 | user = services.create_user(session=session, user_create=user_create) |
| 40 | return user |
| 41 | |
| 42 | |
| 43 | @router.get("/users/me/ai-usage-quota", response_model=AIUsageQuota) |
nothing calls this directly
no outgoing calls
no test coverage detected