MCPcopy Create free account
hub / github.com/0010aor/FlashNotes / register_user

Function register_user

backend/src/users/api.py:23–40  ·  view source on GitHub ↗

Create new user without the need to be logged in.

(session: SessionDep, user_in: UserRegister)

Source from the content-addressed store, hash-verified

21
22@router.post("", response_model=UserPublic)
23def 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)

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected