- Split mother's name in KYC (last/first) - Added mileage_unit and fuel_type to Assets - Expanded AssetCost for international VAT and original currency - Fixed SQLAlchemy IndexError in asset catalog lookup - Added exchange_rate and ratings tables to models
43 lines
1.5 KiB
Python
43 lines
1.5 KiB
Python
from pydantic import BaseModel, Field
|
|
from typing import Optional
|
|
from uuid import UUID
|
|
from datetime import datetime
|
|
|
|
class AssetCreate(BaseModel):
|
|
# Alapadatok
|
|
make: str = Field(..., example="Ford")
|
|
model: str = Field(..., example="Mondeo")
|
|
vin: str = Field(..., min_length=17, max_length=17, description="Alvázszám")
|
|
license_plate: Optional[str] = Field(None, max_length=20, example="RRR-555")
|
|
|
|
# Nemzetközi és Admin szempontok
|
|
vehicle_class: str = Field("land", description="land, sea, air - Admin által bővíthető")
|
|
fuel_type: str = Field(..., example="Diesel", description="Admin által definiált üzemanyag típusok")
|
|
|
|
# Technikai adatok
|
|
engine_description: Optional[str] = Field(None, example="2.0 TDCI")
|
|
year_of_manufacture: int = Field(..., ge=1900, le=2100)
|
|
|
|
# Kezdő állapot
|
|
current_reading: int = Field(..., ge=0, description="Kezdő km/üzemóra állás")
|
|
reading_unit: str = Field("km", description="km, miles, hours - Nemzetközi beállítás")
|
|
|
|
# Felhasználói adatok
|
|
name: Optional[str] = Field(None, description="Egyedi elnevezés")
|
|
|
|
class AssetResponse(BaseModel):
|
|
id: UUID
|
|
catalog_id: Optional[int]
|
|
vin: str
|
|
license_plate: Optional[str] = None # JAVÍTVA: Lehet None a válaszban
|
|
name: Optional[str] = None
|
|
fuel_type: str
|
|
vehicle_class: str
|
|
is_verified: bool
|
|
year_of_manufacture: int
|
|
system_mileage: int
|
|
quality_index: float
|
|
created_at: datetime
|
|
|
|
class Config:
|
|
from_attributes = True |