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>
64 lines
1.8 KiB
Python
64 lines
1.8 KiB
Python
"""Component query handlers — Phase 11.2."""
|
|
from __future__ import annotations
|
|
|
|
from uuid import UUID
|
|
|
|
from sqlalchemy.ext.asyncio import AsyncSession
|
|
|
|
from app.services.components import ExperienceComponentService
|
|
from app.specifications.components import (
|
|
ComponentListSpec,
|
|
ComponentVersionListSpec,
|
|
PlacementListSpec,
|
|
)
|
|
|
|
|
|
class ComponentQueries:
|
|
def __init__(self, session: AsyncSession) -> None:
|
|
self.service = ExperienceComponentService(session)
|
|
|
|
async def get_component(self, tenant_id: UUID, component_id: UUID):
|
|
return await self.service.get_component(tenant_id, component_id)
|
|
|
|
async def list_components(
|
|
self,
|
|
tenant_id: UUID,
|
|
*,
|
|
offset: int,
|
|
limit: int,
|
|
spec: ComponentListSpec | None,
|
|
):
|
|
return await self.service.list_components(
|
|
tenant_id, offset=offset, limit=limit, spec=spec
|
|
)
|
|
|
|
async def get_version(self, tenant_id: UUID, version_id: UUID):
|
|
return await self.service.get_version(tenant_id, version_id)
|
|
|
|
async def list_versions(
|
|
self,
|
|
tenant_id: UUID,
|
|
*,
|
|
offset: int,
|
|
limit: int,
|
|
spec: ComponentVersionListSpec | None,
|
|
):
|
|
return await self.service.list_versions(
|
|
tenant_id, offset=offset, limit=limit, spec=spec
|
|
)
|
|
|
|
async def get_placement(self, tenant_id: UUID, placement_id: UUID):
|
|
return await self.service.get_placement(tenant_id, placement_id)
|
|
|
|
async def list_placements(
|
|
self,
|
|
tenant_id: UUID,
|
|
*,
|
|
offset: int,
|
|
limit: int,
|
|
spec: PlacementListSpec | None,
|
|
):
|
|
return await self.service.list_placements(
|
|
tenant_id, offset=offset, limit=limit, spec=spec
|
|
)
|