Skip to content

Routes

openapi_first.templates.vet_app.routes

Veterinary Clinic route handlers bound via OpenAPI operationId.

Handlers explicitly control HTTP response status codes to ensure runtime behavior matches the OpenAPI contract. Domain models defined using Pydantic are used for request and response payloads.

No routing decorators, path definitions, or implicit framework behavior appear in this module. All routing, HTTP methods, and schemas are defined in the OpenAPI specification.

Functions

create_appointment

1
2
3
create_appointment(
    payload: AppointmentCreate, response: Response
)

Create an appointment.

create_parent

1
2
3
create_parent(
    payload: ParentCreate, response: Response
) -> Parent

Create a parent.

Parameters

payload : ParentCreate Parent data excluding the id field. response : Response Response object used to set the HTTP status code.

Returns

Parent The newly created parent.

create_pet

create_pet(payload: PetCreate, response: Response)

Create a pet.

create_treatment

1
2
3
create_treatment(
    payload: TreatmentCreate, response: Response
)

Add a treatment (admin only).

create_vet

create_vet(payload: VetCreate, response: Response)

Create a vet.

delete_appointment

delete_appointment(id: int, response: Response)

Delete an existing appointment.

delete_parent

delete_parent(id: int, response: Response) -> None

Delete an existing parent.

Parameters

id : int Identifier of the parent. response : Response Response object used to set the HTTP status code.

Raises

HTTPException 404 if the parent does not exist.

delete_pet

delete_pet(id: int, response: Response)

Delete an existing pet.

delete_treatment

delete_treatment(id: int, response: Response)

Delete an existing treatment.

delete_vet

delete_vet(id: int, response: Response)

Delete an existing vet.

get_appointment

get_appointment(id: int)

Retrieve a single appointment by ID.

get_parent

get_parent(id: int) -> Parent

Retrieve a single parent by ID.

Parameters

id : int Identifier of the parent.

Returns

Parent The requested parent.

Raises

HTTPException 404 if the parent does not exist.

get_pet

get_pet(id: int)

Retrieve a single pet by ID.

get_treatment

get_treatment(id: int)

Retrieve a single treatment by ID.

get_vet

get_vet(id: int)

Retrieve a single vet by ID.

list_appointments

1
2
3
4
5
6
7
list_appointments(
    limit: int = 20,
    offset: int = 0,
    date: str = None,
    vet: int = None,
    pet: int = None,
)

List appointments (paginated, filterable).

list_parents

list_parents(limit: int = 20, offset: int = 0) -> dict

List parents (paginated).

Parameters

limit : int Maximum number of records to return. offset : int Number of records to skip.

Returns

dict Paginated response with total and items.

list_pets

list_pets(limit: int = 20, offset: int = 0)

List pets (paginated).

list_treatments

list_treatments() -> list[Treatment]

List treatments (catalogue).

Returns

list[Treatment] A list of treatment domain objects.

list_vets

list_vets(limit: int = 20, offset: int = 0)

List vets (paginated).

stream_actions async

stream_actions(id: int)

Stream animal actions via SSE, scoped to a pet's species.

update_appointment

update_appointment(id: int, payload: AppointmentCreate)

Update an existing appointment.

update_parent

update_parent(id: int, payload: ParentCreate) -> Parent

Update an existing parent.

Parameters

id : int Identifier of the parent. payload : ParentCreate Updated parent data.

Returns

Parent The updated parent.

Raises

HTTPException 404 if the parent does not exist.

update_pet

update_pet(id: int, payload: PetCreate)

Update an existing pet.

update_treatment

update_treatment(id: int, payload: TreatmentCreate)

Update an existing treatment.

update_vet

update_vet(id: int, payload: VetCreate)

Update an existing vet.

upload_pet_photo

upload_pet_photo(id: int, file: UploadFile) -> dict

Upload a pet photo.

Parameters

id : int Identifier of the pet. file : UploadFile Image file to upload.

Returns

dict A confirmation with the pet ID.