feat: implement pivot-currency model, rbac smart tokens & fix circular imports
This commit is contained in:
@@ -1,43 +1,54 @@
|
||||
from pydantic import BaseModel, Field
|
||||
from typing import Optional
|
||||
from pydantic import BaseModel, ConfigDict, Field
|
||||
from typing import Optional, Dict, Any, List
|
||||
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")
|
||||
# --- KATALÓGUS SÉMÁK (Gyári adatok) ---
|
||||
class AssetCatalogBase(BaseModel):
|
||||
make: str
|
||||
model: str
|
||||
generation: Optional[str] = None
|
||||
year_from: Optional[int] = None
|
||||
year_to: Optional[int] = None
|
||||
vehicle_class: Optional[str] = None
|
||||
fuel_type: Optional[str] = None
|
||||
engine_code: Optional[str] = None
|
||||
|
||||
class AssetResponse(BaseModel):
|
||||
id: UUID
|
||||
catalog_id: Optional[int]
|
||||
vin: str
|
||||
license_plate: Optional[str] = None # JAVÍTVA: Lehet None a válaszban
|
||||
class AssetCatalogResponse(AssetCatalogBase):
|
||||
id: int
|
||||
factory_data: Optional[Dict[str, Any]] = None # A robot által gyűjtött adatok
|
||||
|
||||
model_config = ConfigDict(from_attributes=True)
|
||||
|
||||
# --- JÁRMŰ SÉMÁK (Asset) ---
|
||||
class AssetBase(BaseModel):
|
||||
vin: str = Field(..., min_length=17, max_length=17)
|
||||
license_plate: str
|
||||
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
|
||||
year_of_manufacture: Optional[int] = None
|
||||
|
||||
class Config:
|
||||
from_attributes = True
|
||||
class AssetCreate(AssetBase):
|
||||
# A létrehozáshoz kellenek a katalógus infók is
|
||||
make: str
|
||||
model: str
|
||||
vehicle_class: Optional[str] = "land"
|
||||
fuel_type: Optional[str] = None
|
||||
current_reading: Optional[int] = 0
|
||||
|
||||
class AssetResponse(AssetBase):
|
||||
id: UUID
|
||||
catalog_id: int
|
||||
is_verified: bool
|
||||
status: str
|
||||
|
||||
model_config = ConfigDict(from_attributes=True)
|
||||
|
||||
# --- DIGITÁLIS IKER (Full Profile) ---
|
||||
# Ez a séma felel a 9 pontos költség és a mélységi szerviz adatok átadásáért
|
||||
class AssetFullProfile(BaseModel):
|
||||
identity: Dict[str, Any]
|
||||
telemetry: Dict[str, Any]
|
||||
financial_summary: Dict[str, Any]
|
||||
service_history: List[Dict[str, Any]]
|
||||
|
||||
model_config = ConfigDict(from_attributes=True)
|
||||
Reference in New Issue
Block a user