user
This module defines router for the api that is dedicated to user related responsibilities.
create_user
create_user(user_create: models.UserCreate, session: Annotated[Session, Depends(database.get_session)])
Endpoint for creating a new user.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
user_create |
UserCreate
|
The data required to create a new user. |
required |
session |
Session
|
The session to interact with the database. |
required |
Returns:
Type | Description |
---|---|
UserRead
|
The created user data to be read. |
Raises:
Type | Description |
---|---|
HTTPException
|
If a user with the same email already exists, raises status code 409 (CONFLICT). |
Source code in api/routers/user.py
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
|
get_users
get_users(session: Annotated[Session, Depends(database.get_session)], current_user: Annotated[models.User, Depends(oauth2.get_current_user)])
Endpoint for retrieving all users.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
session |
Session
|
The session to interact with the database. |
required |
current_user |
User
|
The current authenticated user. |
required |
Returns:
Type | Description |
---|---|
list[UserRead]
|
A list of user data to be read. |
Source code in api/routers/user.py
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 |
|