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>
26 lines
675 B
Python
26 lines
675 B
Python
"""Routing validators — Phase 10.6."""
|
|
from __future__ import annotations
|
|
|
|
from shared.exceptions import AppError
|
|
|
|
|
|
def validate_route_code_present(code: str) -> str:
|
|
code = str(code).strip()
|
|
if not code:
|
|
raise AppError(
|
|
"کد مسیر الزامی است",
|
|
status_code=422,
|
|
error_code="route_code_required",
|
|
)
|
|
return code
|
|
|
|
|
|
def validate_stop_sequence(sequence: int) -> int:
|
|
if sequence < 0:
|
|
raise AppError(
|
|
"ترتیب توقف نامعتبر است",
|
|
status_code=422,
|
|
error_code="invalid_stop_sequence",
|
|
)
|
|
return sequence
|