TorbatYar/backend/services/healthcare/app/commands/clinic_management.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

52 lines
2.2 KiB
Python

"""Clinic management command/query handlers — Phase 13.3."""
from __future__ import annotations
from uuid import UUID
from sqlalchemy.ext.asyncio import AsyncSession
from app.schemas.clinic_management import (
ClinicPolicyCreate,
ClinicServiceCreate,
OperatingHoursPolicyCreate,
StaffAssignmentCreate,
)
from app.services.clinic_management import ClinicManagementService
from shared.security import CurrentUser
class ClinicManagementCommands:
def __init__(self, session: AsyncSession) -> None:
self.svc = ClinicManagementService(session)
async def create_service(self, tenant_id: UUID, body: ClinicServiceCreate, *, actor=None):
return await self.svc.create_service(tenant_id, body, actor=actor)
async def create_staff(self, tenant_id: UUID, body: StaffAssignmentCreate, *, actor=None):
return await self.svc.create_staff_assignment(tenant_id, body, actor=actor)
async def create_policy(self, tenant_id: UUID, body: ClinicPolicyCreate, *, actor=None):
return await self.svc.create_policy(tenant_id, body, actor=actor)
async def create_hours(self, tenant_id: UUID, body: OperatingHoursPolicyCreate, *, actor=None):
return await self.svc.create_operating_hours(tenant_id, body, actor=actor)
class ClinicManagementQueries:
def __init__(self, session: AsyncSession) -> None:
self.svc = ClinicManagementService(session)
async def list_services(
self, tenant_id: UUID, *, clinic_id: UUID | None = None, offset: int = 0, limit: int = 20
):
return await self.svc.list_services(tenant_id, clinic_id=clinic_id, offset=offset, limit=limit)
async def list_staff(self, tenant_id: UUID, *, offset: int = 0, limit: int = 20):
return await self.svc.list_staff(tenant_id, offset=offset, limit=limit)
async def list_policies(self, tenant_id: UUID, *, offset: int = 0, limit: int = 20):
return await self.svc.list_policies(tenant_id, offset=offset, limit=limit)
async def list_hours(self, tenant_id: UUID, *, offset: int = 0, limit: int = 20):
return await self.svc.list_operating_hours(tenant_id, offset=offset, limit=limit)