30 lines
710 B
Python
Executable File
30 lines
710 B
Python
Executable File
from pydantic import BaseModel, Field, validator
|
|
from typing import Optional, List, Any
|
|
from uuid import UUID
|
|
from datetime import datetime
|
|
|
|
class EngineSpecBase(BaseModel):
|
|
engine_code: str
|
|
fuel_type: str
|
|
power_kw: int
|
|
default_service_interval_km: int = 15000
|
|
|
|
class VehicleBase(BaseModel):
|
|
brand_id: int
|
|
model_name: str
|
|
identification_number: str
|
|
license_plate: Optional[str] = None
|
|
tracking_mode: str = "km"
|
|
|
|
class VehicleCreate(VehicleBase):
|
|
current_company_id: int
|
|
engine_spec_id: int
|
|
|
|
class VehicleRead(VehicleBase):
|
|
id: UUID
|
|
current_rating_pct: int
|
|
total_real_usage: float
|
|
created_at: datetime
|
|
|
|
class Config:
|
|
from_attributes = True |