TorbatYar/backend/services/healthcare/app/queries/appointments.py
Mortezakoohjani 625275e55b feat(healthcare): add backend service and finalize frontend build
Add the Healthcare platform backend (phases 13.0–13.7) with Alembic migration revision fix, production deploy script, validation reports, shared UI exports, and loyalty list page client directives so Next.js build succeeds.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-27 11:38:31 +03:30

50 lines
1.9 KiB
Python

"""Appointment query handlers — Phase 13.1."""
from __future__ import annotations
from uuid import UUID
from sqlalchemy.ext.asyncio import AsyncSession
from app.services.appointments import (
AppointmentService,
AppointmentTypeService,
AvailabilityWindowService,
ScheduleService,
WaitingListService,
)
from app.specifications.appointments import AppointmentListSpec
class AppointmentQueries:
def __init__(self, session: AsyncSession) -> None:
self.schedules = ScheduleService(session)
self.availability = AvailabilityWindowService(session)
self.types = AppointmentTypeService(session)
self.appointments = AppointmentService(session)
self.waiting_list = WaitingListService(session)
async def list_schedules(self, tenant_id: UUID, *, offset: int = 0, limit: int = 20):
return await self.schedules.list(tenant_id, offset=offset, limit=limit)
async def list_availability(self, tenant_id: UUID, *, offset: int = 0, limit: int = 20):
return await self.availability.list(tenant_id, offset=offset, limit=limit)
async def list_types(self, tenant_id: UUID, *, offset: int = 0, limit: int = 20):
return await self.types.list(tenant_id, offset=offset, limit=limit)
async def get_appointment(self, tenant_id: UUID, appointment_id: UUID):
return await self.appointments.get(tenant_id, appointment_id)
async def list_appointments(
self,
tenant_id: UUID,
*,
offset: int = 0,
limit: int = 20,
spec: AppointmentListSpec | None = None,
):
return await self.appointments.list(tenant_id, offset=offset, limit=limit, spec=spec)
async def list_waiting_list(self, tenant_id: UUID, *, offset: int = 0, limit: int = 20):
return await self.waiting_list.list(tenant_id, offset=offset, limit=limit)