Fix: Add pagination to admin appointments endpoint

- Added pagination with page/per_page query params
- Fixed N+1 query by using eager-loaded user relationship
- Removed unused _get_user_email helper function
- Updated frontend to handle paginated response
- Regenerated API types
This commit is contained in:
counterweight 2025-12-21 17:32:25 +01:00
parent 1cd60b4bbc
commit 77e7f98e1e
Signed by: counterweight
GPG key ID: 883EDBAA726BD96C
4 changed files with 70 additions and 28 deletions

View file

@ -445,7 +445,7 @@ export interface paths {
};
/**
* Get All Appointments
* @description Get all appointments (admin only), sorted by date descending.
* @description Get all appointments (admin only), sorted by date descending with pagination.
*/
get: operations["get_all_appointments_api_admin_appointments_get"];
put?: never;
@ -704,6 +704,19 @@ export interface components {
/** Revoked At */
revoked_at: string | null;
};
/** PaginatedResponse[AppointmentResponse] */
PaginatedResponse_AppointmentResponse_: {
/** Records */
records: components["schemas"]["AppointmentResponse"][];
/** Total */
total: number;
/** Page */
page: number;
/** Per Page */
per_page: number;
/** Total Pages */
total_pages: number;
};
/** PaginatedResponse[CounterRecordResponse] */
PaginatedResponse_CounterRecordResponse_: {
/** Records */
@ -1617,7 +1630,10 @@ export interface operations {
};
get_all_appointments_api_admin_appointments_get: {
parameters: {
query?: never;
query?: {
page?: number;
per_page?: number;
};
header?: never;
path?: never;
cookie?: never;
@ -1630,7 +1646,16 @@ export interface operations {
[name: string]: unknown;
};
content: {
"application/json": components["schemas"]["AppointmentResponse"][];
"application/json": components["schemas"]["PaginatedResponse_AppointmentResponse_"];
};
};
/** @description Validation Error */
422: {
headers: {
[name: string]: unknown;
};
content: {
"application/json": components["schemas"]["HTTPValidationError"];
};
};
};