STABLE: Final schema sync, optimized gitignore
This commit is contained in:
@@ -1,56 +1,20 @@
|
||||
# /opt/docker/dev/service_finder/backend/app/schemas/fleet.py
|
||||
from pydantic import BaseModel, ConfigDict
|
||||
from typing import Optional, List
|
||||
from datetime import date, datetime
|
||||
from app.models.expense import ExpenseCategory
|
||||
from datetime import date
|
||||
from uuid import UUID
|
||||
|
||||
# --- Vehicle Schemas ---
|
||||
class VehicleBase(BaseModel):
|
||||
license_plate: str
|
||||
make: str
|
||||
model: str
|
||||
year: int
|
||||
fuel_type: Optional[str] = None
|
||||
vin: Optional[str] = None
|
||||
initial_odometer: int = 0
|
||||
mot_expiry_date: Optional[date] = None
|
||||
insurance_expiry_date: Optional[date] = None
|
||||
|
||||
class VehicleCreate(VehicleBase):
|
||||
pass
|
||||
|
||||
class VehicleResponse(VehicleBase):
|
||||
id: int
|
||||
current_odometer: int
|
||||
created_at: datetime
|
||||
model_config = ConfigDict(from_attributes=True)
|
||||
|
||||
# --- Event / Expense Schemas ---
|
||||
class EventBase(BaseModel):
|
||||
event_type: ExpenseCategory
|
||||
class EventCreate(BaseModel):
|
||||
asset_id: UUID
|
||||
event_type: str # 'SERVICE', 'FUEL', 'MOT'
|
||||
date: date
|
||||
odometer_value: int
|
||||
cost_amount: int
|
||||
cost_amount: float
|
||||
description: Optional[str] = None
|
||||
is_diy: bool = False
|
||||
|
||||
# Ad-Hoc Provider mező: Ha stringet kapunk, a service megkeresi vagy létrehozza
|
||||
provider_name: Optional[str] = None
|
||||
provider_id: Optional[int] = None # Ha már ismert ID-t küldünk
|
||||
|
||||
class EventCreate(EventBase):
|
||||
pass
|
||||
|
||||
class EventResponse(EventBase):
|
||||
id: int
|
||||
vehicle_id: int
|
||||
odometer_anomaly: bool
|
||||
service_provider_id: Optional[int]
|
||||
image_paths: Optional[List[str]] = []
|
||||
|
||||
model_config = ConfigDict(from_attributes=True)
|
||||
provider_id: Optional[int] = None
|
||||
|
||||
class TCOStats(BaseModel):
|
||||
vehicle_id: int
|
||||
total_cost: int
|
||||
breakdown: dict[str, int] # Kategóriánkénti bontás
|
||||
cost_per_km: Optional[float] = 0.0
|
||||
asset_id: UUID
|
||||
total_cost_huf: float
|
||||
cost_per_km: float
|
||||
model_config = ConfigDict(from_attributes=True)
|
||||
Reference in New Issue
Block a user