Járműkezelés majdnem kész frontend
This commit is contained in:
55
frontend/src/types/vehicle.ts
Normal file
55
frontend/src/types/vehicle.ts
Normal file
@@ -0,0 +1,55 @@
|
||||
/**
|
||||
* Unified VehicleData interface.
|
||||
* Covers both API response (Vehicle from store) and mock data shapes.
|
||||
* Used across all vehicle-related components for type safety.
|
||||
*
|
||||
* The backend AssetResponse uses `current_mileage` as the canonical field.
|
||||
* Components should use `current_mileage` for display; `mileage` is kept
|
||||
* as a backward-compatible alias for mock data.
|
||||
*/
|
||||
export interface VehicleData {
|
||||
id: number | string
|
||||
license_plate: string
|
||||
brand: string
|
||||
model: string
|
||||
|
||||
// Display fields (unified)
|
||||
year: number | null
|
||||
/** @deprecated Use current_mileage instead */
|
||||
mileage?: number
|
||||
/** Canonical mileage field from backend AssetResponse.current_mileage */
|
||||
current_mileage: number
|
||||
engine: string
|
||||
color: string
|
||||
nextService?: string
|
||||
image: string | null
|
||||
nickname?: string
|
||||
countryCode?: string
|
||||
|
||||
// Extended API fields (optional — present in store Vehicle but not in mock)
|
||||
vin?: string | null
|
||||
year_of_manufacture?: number | null
|
||||
fuel_type?: string
|
||||
engine_capacity?: number | null
|
||||
power_kw?: number | null
|
||||
transmission_type?: string
|
||||
drive_type?: string
|
||||
trim_level?: string
|
||||
vehicle_class?: string
|
||||
status?: string
|
||||
is_verified?: boolean
|
||||
is_primary?: boolean
|
||||
created_at?: string
|
||||
updated_at?: string | null
|
||||
is_for_sale?: boolean
|
||||
price?: number | null
|
||||
currency?: string
|
||||
|
||||
// JSONB individual_equipment from backend (color, notes, engine_code, etc.)
|
||||
individual_equipment?: {
|
||||
color?: string
|
||||
notes?: string
|
||||
engine_code?: string
|
||||
[key: string]: any
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user