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>
42 lines
1.4 KiB
Python
42 lines
1.4 KiB
Python
"""Routing query handlers — Phase 10.6."""
|
|
from __future__ import annotations
|
|
|
|
from uuid import UUID
|
|
|
|
from sqlalchemy.ext.asyncio import AsyncSession
|
|
|
|
from app.services.routing import OptimizationRunService, RoutePlanService
|
|
from app.specifications.routing import OptimizationRunListSpec, RoutePlanListSpec
|
|
|
|
|
|
class RoutingQueries:
|
|
def __init__(self, session: AsyncSession) -> None:
|
|
self.routes = RoutePlanService(session)
|
|
self.optimization = OptimizationRunService(session)
|
|
|
|
async def get_route(self, tenant_id: UUID, plan_id: UUID):
|
|
return await self.routes.get(tenant_id, plan_id)
|
|
|
|
async def list_routes(
|
|
self, tenant_id: UUID, *, offset: int, limit: int, spec: RoutePlanListSpec | None
|
|
):
|
|
return await self.routes.list(tenant_id, offset=offset, limit=limit, spec=spec)
|
|
|
|
async def list_stops(self, tenant_id: UUID, plan_id: UUID):
|
|
return await self.routes.list_stops(tenant_id, plan_id)
|
|
|
|
async def get_optimization_run(self, tenant_id: UUID, run_id: UUID):
|
|
return await self.optimization.get(tenant_id, run_id)
|
|
|
|
async def list_optimization_runs(
|
|
self,
|
|
tenant_id: UUID,
|
|
*,
|
|
offset: int,
|
|
limit: int,
|
|
spec: OptimizationRunListSpec | None,
|
|
):
|
|
return await self.optimization.list(
|
|
tenant_id, offset=offset, limit=limit, spec=spec
|
|
)
|