TorbatYar/backend/services/delivery/app/queries/dispatch.py
Mortezakoohjani 72077908f1 feat(delivery): deploy backend phases 10.2-10.8 through settlement
Ship fleet, availability, pricing, dispatch, routing, tracking, and settlement on delivery-service 0.10.8.0 with migrations and phase tests green.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-27 21:01:23 +03:30

39 lines
1.3 KiB
Python

"""Dispatch query handlers — Phase 10.5."""
from __future__ import annotations
from uuid import UUID
from sqlalchemy.ext.asyncio import AsyncSession
from app.services.dispatch import DispatchJobService, JobAssignmentService
from app.specifications.dispatch import DispatchJobListSpec, JobAssignmentListSpec
class DispatchQueries:
def __init__(self, session: AsyncSession) -> None:
self.jobs = DispatchJobService(session)
self.assignments = JobAssignmentService(session)
async def get_job(self, tenant_id: UUID, job_id: UUID):
return await self.jobs.get(tenant_id, job_id)
async def list_jobs(
self, tenant_id: UUID, *, offset: int, limit: int, spec: DispatchJobListSpec | None
):
return await self.jobs.list(tenant_id, offset=offset, limit=limit, spec=spec)
async def get_assignment(self, tenant_id: UUID, assignment_id: UUID):
return await self.assignments.get(tenant_id, assignment_id)
async def list_assignments(
self,
tenant_id: UUID,
*,
offset: int,
limit: int,
spec: JobAssignmentListSpec | None,
):
return await self.assignments.list(
tenant_id, offset=offset, limit=limit, spec=spec
)