M2: implement vehicle return vertical slice
Transactional return command with idempotency, row-lock concurrency control, odometer-regression handling, vehicle status derivation, outbox event, audit trail. Result-summary UI on booking detail. 26 backend tests passing, ruff clean. Verified end-to-end via browser against S1 demo scenario; fixed two real defects found only through browser testing (UI state loss on status transition, unflushed UUID default).
This commit is contained in:
+27
-1
@@ -3,7 +3,7 @@ from __future__ import annotations
|
||||
from datetime import datetime
|
||||
from typing import Any, Literal
|
||||
|
||||
from pydantic import BaseModel, Field
|
||||
from pydantic import BaseModel, Field, conint
|
||||
|
||||
Role = Literal["operations_manager", "rental_employee"]
|
||||
|
||||
@@ -48,6 +48,32 @@ class BookingOut(BookingSummaryOut):
|
||||
customer_name: str
|
||||
|
||||
|
||||
class RegisterReturnRequest(BaseModel):
|
||||
end_odometer_km: conint(ge=0)
|
||||
fuel_level_percent: conint(ge=0, le=100)
|
||||
cleanliness_ok: bool
|
||||
damage_reported: bool
|
||||
technical_warning: bool
|
||||
notes: str | None = Field(default=None, max_length=2000)
|
||||
|
||||
|
||||
class NextBookingRisk(BaseModel):
|
||||
booking_ref: str
|
||||
starts_at: datetime
|
||||
at_risk: bool
|
||||
|
||||
|
||||
class RegisterReturnResult(BaseModel):
|
||||
booking_ref: str
|
||||
vehicle_ref: str
|
||||
inspection_ref: str
|
||||
resulting_vehicle_status: str
|
||||
odometer_regression: bool
|
||||
quality_issue_ref: str | None
|
||||
workflow_event_id: str
|
||||
next_booking_risk: NextBookingRisk | None
|
||||
|
||||
|
||||
class InspectionOut(BaseModel):
|
||||
public_ref: str
|
||||
booking_ref: str
|
||||
|
||||
Reference in New Issue
Block a user