TorbatYar/backend/services/delivery/app/queries/pricing.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

45 lines
1.6 KiB
Python

"""Pricing query handlers — Phase 10.4."""
from __future__ import annotations
from uuid import UUID
from sqlalchemy.ext.asyncio import AsyncSession
from app.services.pricing import BundleService, CapabilityService, PricingRuleService
from app.specifications.pricing import (
BundleListSpec,
CapabilityListSpec,
PricingRuleListSpec,
)
class PricingQueries:
def __init__(self, session: AsyncSession) -> None:
self.rules = PricingRuleService(session)
self.capabilities = CapabilityService(session)
self.bundles = BundleService(session)
async def get_rule(self, tenant_id: UUID, rule_id: UUID):
return await self.rules.get(tenant_id, rule_id)
async def list_rules(
self, tenant_id: UUID, *, offset: int, limit: int, spec: PricingRuleListSpec | None
):
return await self.rules.list(tenant_id, offset=offset, limit=limit, spec=spec)
async def get_capability(self, tenant_id: UUID, cap_id: UUID):
return await self.capabilities.get(tenant_id, cap_id)
async def list_capabilities(
self, tenant_id: UUID, *, offset: int, limit: int, spec: CapabilityListSpec | None
):
return await self.capabilities.list(tenant_id, offset=offset, limit=limit, spec=spec)
async def get_bundle(self, tenant_id: UUID, bundle_id: UUID):
return await self.bundles.get(tenant_id, bundle_id)
async def list_bundles(
self, tenant_id: UUID, *, offset: int, limit: int, spec: BundleListSpec | None
):
return await self.bundles.list(tenant_id, offset=offset, limit=limit, spec=spec)