Skip to content

sjenk 0.1.0

A web-based booking system for managing time slots at various locations (e.g., football fields, gyms).


License: MIT

users


GET /users

Read Users

Description

Read all users.

Parameters

session : SessionDep

The database session.

Returns

list[UserRead]

The users.

Response 200 OK

[
    {
        "id": 0,
        "username": "string",
        "role": "admin"
    }
]
⚠️ This example has been generated automatically from the schema and it is not accurate. Refer to the schema for more information.

Schema of the response body
{
    "items": {
        "$ref": "#/components/schemas/UserRead"
    },
    "type": "array",
    "title": "Response Read Users Users Get"
}

POST /users

Create User

Description

Create a user.

Parameters

user : UserCreate

The user to create.

session : SessionDep

The database session.

Returns

UserRead

The created user.

Request body

{
    "username": "string",
    "password_hash": "string",
    "role": "admin"
}
⚠️ This example has been generated automatically from the schema and it is not accurate. Refer to the schema for more information.

Schema of the request body
{
    "properties": {
        "username": {
            "type": "string",
            "title": "Username"
        },
        "password_hash": {
            "type": "string",
            "title": "Password Hash"
        },
        "role": {
            "$ref": "#/components/schemas/UserRole"
        }
    },
    "type": "object",
    "required": [
        "username",
        "password_hash",
        "role"
    ],
    "title": "UserCreate",
    "description": "Model for creating user.\n\nParameters\n----------\nUserBase : UserBase\n    Base model for user."
}

Response 201 Created

{
    "id": 0,
    "username": "string",
    "role": "admin"
}
⚠️ This example has been generated automatically from the schema and it is not accurate. Refer to the schema for more information.

Schema of the response body
{
    "properties": {
        "id": {
            "type": "integer",
            "title": "Id"
        },
        "username": {
            "type": "string",
            "title": "Username"
        },
        "role": {
            "$ref": "#/components/schemas/UserRole"
        }
    },
    "type": "object",
    "required": [
        "id",
        "username",
        "role"
    ],
    "title": "UserRead",
    "description": "Model for reading user.\n\nParameters\n----------\nBaseModel : pydantic.BaseModel\n    Base model for Pydantic."
}

Response 422 Unprocessable Content

{
    "detail": [
        {
            "loc": [
                null
            ],
            "msg": "string",
            "type": "string"
        }
    ]
}
⚠️ This example has been generated automatically from the schema and it is not accurate. Refer to the schema for more information.

Schema of the response body
{
    "properties": {
        "detail": {
            "items": {
                "$ref": "#/components/schemas/ValidationError"
            },
            "type": "array",
            "title": "Detail"
        }
    },
    "type": "object",
    "title": "HTTPValidationError"
}

GET /users/{user_id}

Read User

Description

Read a user.

Parameters

user_id : int

The user ID.

session : SessionDep

The database session.

Returns

UserRead

The user.

Input parameters

Parameter In Type Default Nullable Description
user_id path integer No

Response 200 OK

{
    "id": 0,
    "username": "string",
    "role": "admin"
}
⚠️ This example has been generated automatically from the schema and it is not accurate. Refer to the schema for more information.

Schema of the response body
{
    "properties": {
        "id": {
            "type": "integer",
            "title": "Id"
        },
        "username": {
            "type": "string",
            "title": "Username"
        },
        "role": {
            "$ref": "#/components/schemas/UserRole"
        }
    },
    "type": "object",
    "required": [
        "id",
        "username",
        "role"
    ],
    "title": "UserRead",
    "description": "Model for reading user.\n\nParameters\n----------\nBaseModel : pydantic.BaseModel\n    Base model for Pydantic."
}

Response 422 Unprocessable Content

{
    "detail": [
        {
            "loc": [
                null
            ],
            "msg": "string",
            "type": "string"
        }
    ]
}
⚠️ This example has been generated automatically from the schema and it is not accurate. Refer to the schema for more information.

Schema of the response body
{
    "properties": {
        "detail": {
            "items": {
                "$ref": "#/components/schemas/ValidationError"
            },
            "type": "array",
            "title": "Detail"
        }
    },
    "type": "object",
    "title": "HTTPValidationError"
}

PUT /users/{user_id}

Update User

Description

Update a user.

Parameters

user_id : int

The user ID.

user : UserUpdate

The user to update.

session : SessionDep

The database session

Returns

UserRead

The updated user.

Input parameters

Parameter In Type Default Nullable Description
user_id path integer No

Request body

{
    "username": null,
    "password_hash": null,
    "role": null
}
⚠️ This example has been generated automatically from the schema and it is not accurate. Refer to the schema for more information.

Schema of the request body
{
    "properties": {
        "username": {
            "anyOf": [
                {
                    "type": "string"
                },
                {
                    "type": "null"
                }
            ],
            "title": "Username"
        },
        "password_hash": {
            "anyOf": [
                {
                    "type": "string"
                },
                {
                    "type": "null"
                }
            ],
            "title": "Password Hash"
        },
        "role": {
            "anyOf": [
                {
                    "$ref": "#/components/schemas/UserRole"
                },
                {
                    "type": "null"
                }
            ]
        }
    },
    "type": "object",
    "title": "UserUpdate",
    "description": "Model for updating user.\n\nParameters\n----------\nBaseModel : pydantic.BaseModel\n    Base model for Pydantic."
}

Response 200 OK

{
    "id": 0,
    "username": "string",
    "role": "admin"
}
⚠️ This example has been generated automatically from the schema and it is not accurate. Refer to the schema for more information.

Schema of the response body
{
    "properties": {
        "id": {
            "type": "integer",
            "title": "Id"
        },
        "username": {
            "type": "string",
            "title": "Username"
        },
        "role": {
            "$ref": "#/components/schemas/UserRole"
        }
    },
    "type": "object",
    "required": [
        "id",
        "username",
        "role"
    ],
    "title": "UserRead",
    "description": "Model for reading user.\n\nParameters\n----------\nBaseModel : pydantic.BaseModel\n    Base model for Pydantic."
}

Response 422 Unprocessable Content

{
    "detail": [
        {
            "loc": [
                null
            ],
            "msg": "string",
            "type": "string"
        }
    ]
}
⚠️ This example has been generated automatically from the schema and it is not accurate. Refer to the schema for more information.

Schema of the response body
{
    "properties": {
        "detail": {
            "items": {
                "$ref": "#/components/schemas/ValidationError"
            },
            "type": "array",
            "title": "Detail"
        }
    },
    "type": "object",
    "title": "HTTPValidationError"
}

Schemas

HTTPValidationError

Name Type
detail Array<ValidationError>

UserCreate

Name Type
password_hash string
role UserRole
username string

UserRead

Name Type
id integer
role UserRole
username string

UserRole

Type: string

UserUpdate

Name Type
password_hash
role
username

ValidationError

Name Type
loc Array<>
msg string
type string

Tags

Name Description
users Operations with users.
places Operations with places.
bookings Operations with bookings.