TorbatYar/backend/services/beauty_business/app/commands/appointments.py
Mortezakoohjani d579d0b142 feat(loyalty): add Loyalty Platform Frontend module
Add frontend/modules/loyalty with types, API client, design system, feature pages and thin App Router routes under app/loyalty/. BFF proxy at app/api/loyalty/. Include loyalty frontend docs.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-27 10:50:55 +03:30

71 lines
2.8 KiB
Python

"""Appointment command handlers — Phase 14.1."""
from __future__ import annotations
from uuid import UUID
from sqlalchemy.ext.asyncio import AsyncSession
from app.models.types import AppointmentLifecycleAction
from app.schemas.appointment_core import (
AppointmentCreate,
AppointmentLifecycleRequest,
AppointmentUpdate,
)
from app.services.appointment_core import AppointmentCoreService
from shared.security import CurrentUser
class AppointmentCommands:
def __init__(self, session: AsyncSession) -> None:
self.service = AppointmentCoreService(session)
async def create(self, tenant_id: UUID, body: AppointmentCreate, *, actor: CurrentUser | None):
return await self.service.create(tenant_id, body, actor=actor)
async def update(
self, tenant_id: UUID, appointment_id: UUID, body: AppointmentUpdate, *, actor: CurrentUser | None
):
return await self.service.update(tenant_id, appointment_id, body, actor=actor)
async def confirm(
self, tenant_id: UUID, appointment_id: UUID, body: AppointmentLifecycleRequest, *, actor: CurrentUser | None
):
return await self.service.apply_lifecycle(
tenant_id, appointment_id, AppointmentLifecycleAction.CONFIRM, body, actor=actor
)
async def check_in(
self, tenant_id: UUID, appointment_id: UUID, body: AppointmentLifecycleRequest, *, actor: CurrentUser | None
):
return await self.service.apply_lifecycle(
tenant_id, appointment_id, AppointmentLifecycleAction.CHECK_IN, body, actor=actor
)
async def start(
self, tenant_id: UUID, appointment_id: UUID, body: AppointmentLifecycleRequest, *, actor: CurrentUser | None
):
return await self.service.apply_lifecycle(
tenant_id, appointment_id, AppointmentLifecycleAction.START, body, actor=actor
)
async def complete(
self, tenant_id: UUID, appointment_id: UUID, body: AppointmentLifecycleRequest, *, actor: CurrentUser | None
):
return await self.service.apply_lifecycle(
tenant_id, appointment_id, AppointmentLifecycleAction.COMPLETE, body, actor=actor
)
async def cancel(
self, tenant_id: UUID, appointment_id: UUID, body: AppointmentLifecycleRequest, *, actor: CurrentUser | None
):
return await self.service.apply_lifecycle(
tenant_id, appointment_id, AppointmentLifecycleAction.CANCEL, body, actor=actor
)
async def no_show(
self, tenant_id: UUID, appointment_id: UUID, body: AppointmentLifecycleRequest, *, actor: CurrentUser | None
):
return await self.service.apply_lifecycle(
tenant_id, appointment_id, AppointmentLifecycleAction.NO_SHOW, body, actor=actor
)