TorbatYar/backend/services/experience/app/queries/forms.py
Mortezakoohjani 203671a7bf feat(experience): ship Experience Platform phases 11.0-11.10
Add the experience service with sites through analytics/AI hooks, migrations through 0011, and phase docs/manifests marking the track complete.

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

112 lines
3.2 KiB
Python

"""Forms / surveys / appointments query handlers — Phase 11.6."""
from __future__ import annotations
from uuid import UUID
from sqlalchemy.ext.asyncio import AsyncSession
from app.services.forms import ExperienceFormsService
from app.specifications.forms import (
AppointmentBookingListSpec,
AppointmentPageListSpec,
FormListSpec,
FormSubmissionListSpec,
SurveyListSpec,
SurveyResponseListSpec,
)
class FormsQueries:
def __init__(self, session: AsyncSession) -> None:
self.service = ExperienceFormsService(session)
async def get_form(self, tenant_id: UUID, form_id: UUID):
return await self.service.get_form(tenant_id, form_id)
async def list_forms(
self,
tenant_id: UUID,
*,
offset: int,
limit: int,
spec: FormListSpec | None,
):
return await self.service.list_forms(
tenant_id, offset=offset, limit=limit, spec=spec
)
async def get_submission(self, tenant_id: UUID, submission_id: UUID):
return await self.service.get_submission(tenant_id, submission_id)
async def list_submissions(
self,
tenant_id: UUID,
*,
offset: int,
limit: int,
spec: FormSubmissionListSpec | None,
):
return await self.service.list_submissions(
tenant_id, offset=offset, limit=limit, spec=spec
)
async def get_survey(self, tenant_id: UUID, survey_id: UUID):
return await self.service.get_survey(tenant_id, survey_id)
async def list_surveys(
self,
tenant_id: UUID,
*,
offset: int,
limit: int,
spec: SurveyListSpec | None,
):
return await self.service.list_surveys(
tenant_id, offset=offset, limit=limit, spec=spec
)
async def get_survey_response(self, tenant_id: UUID, response_id: UUID):
return await self.service.get_survey_response(tenant_id, response_id)
async def list_survey_responses(
self,
tenant_id: UUID,
*,
offset: int,
limit: int,
spec: SurveyResponseListSpec | None,
):
return await self.service.list_survey_responses(
tenant_id, offset=offset, limit=limit, spec=spec
)
async def get_appointment_page(self, tenant_id: UUID, page_id: UUID):
return await self.service.get_appointment_page(tenant_id, page_id)
async def list_appointment_pages(
self,
tenant_id: UUID,
*,
offset: int,
limit: int,
spec: AppointmentPageListSpec | None,
):
return await self.service.list_appointment_pages(
tenant_id, offset=offset, limit=limit, spec=spec
)
async def get_booking_ref(self, tenant_id: UUID, booking_id: UUID):
return await self.service.get_booking_ref(tenant_id, booking_id)
async def list_booking_refs(
self,
tenant_id: UUID,
*,
offset: int,
limit: int,
spec: AppointmentBookingListSpec | None,
):
return await self.service.list_booking_refs(
tenant_id, offset=offset, limit=limit, spec=spec
)