Collections vehicles, vehicle_models et vehicle_search_histories
Collection vehicle_models
Cache du catalogue TecDoc.
Un VehicleModel représente un modèle de véhicule générique (ex. "Peugeot 308 1.6 HDi 2012-2014") identifié par son K-Type TecDoc ou son Type Mine.
Un même modèle correspond à un nombre illimité de véhicules physiques — c’est pourquoi cette collection est séparée de vehicles.
Métadonnées
Service propriétaire |
|
Tenant scope |
Non (partagé entre tenants) |
Soft delete |
Non |
Index principaux |
|
Schéma
interface VehicleModel {
_id: ObjectId;
k_type?: string; // identifiant K-Type TecDoc (unique)
type_mine?: string; // type mine (carte grise), ex. "M10RHTE"
tecdoc_vehicle_id?: string;
label?: string; // désignation TecDoc, ex. "308 1.6 HDi 115"
brand?: string; // constructeur, ex. "PEUGEOT"
tecdoc_brand_id?: string;
created_at: Date;
updated_at: Date;
}
Sources de données
| Source | Déclencheur | Champs remplis |
|---|---|---|
TecDoc ( |
|
|
TecDoc ( |
|
|
Auto-Ways (immatriculation / VIN) |
|
|
Collection vehicles
Stocke les véhicules physiques identifiés par immatriculation ou VIN. Les données proviennent exclusivement de l’API Auto-Ways. Un véhicule est créé lors du premier lookup puis réutilisé (cache).
Métadonnées
Service propriétaire |
|
Tenant scope |
Non (partagé entre tenants) |
Soft delete |
Non |
Index principaux |
|
Schéma
interface Vehicle {
_id: ObjectId;
plate?: string; // immatriculation normalisée (majuscules, sans tirets)
vin?: string; // numéro VIN (majuscules)
registration_country?: string;
// Référence au modèle TecDoc associé
vehicle_model?: ObjectId; // ref → vehicle_models
// Identité
label: string; // désignation commerciale complète
commercial_name: string;
brand: string; // ex. "RENAULT"
brand_code: string;
brand_image: string;
car_model: string; // ex. "CLIO"
model_code: string;
model_image: string;
model_start_year: string;
model_end_year: string;
version: string;
version_id: string;
trim: string;
generation: string;
phase_id: string;
serial_number: string;
mine_type: string; // type mine issu de la carte grise (Auto-Ways)
variant_version_type: string;
study_model: string;
prf_model: string;
// Classification
vehicle_category: string;
vehicle_type: string;
vehicle_type_registration_card: string;
vehicle_type_code: string;
vehicle_type_label: string;
body_type: string;
body_type_registration_card: string;
body_type_ce: string;
body_brand: string;
body_style: string;
body_style_code: string;
segment: string;
price_class: string;
is_collection: string;
group: string;
// Dimensions
length: string;
width: string;
height: string;
wheelbase: string;
// Capacités
seat_count: string;
door_count: string;
axle_count: string;
volume_count: string;
gear_count: string;
tank_capacity: string;
// Moteur
engine_code: string;
engine_codes: string[];
engine_label: string;
engine_type: string;
engine_type_key: string;
engine_capacity: string;
engine_speed: string;
cylinder_capacity: string;
cylinder_count: string;
valve_count: string;
displacement_liters: string;
platform_code: string;
tecdoc_engines: Array<{ id: string; code: string }>;
// Carburant & consommation
fuel_type: string;
fuel_type_registration_card: string;
fuel_type_code: string;
fuel_mixture_type: string;
fuel_mixture_type_key: string;
urban_consumption: string;
extra_urban_consumption: string;
mixed_consumption: string;
// Transmission
gearbox_code: string;
gearbox_codes: string[];
gearbox_type: string;
transmission_mode: string;
transmission_mode_label: string;
transmission_type: string;
clutch_type: string;
drive_type: string;
drive_type_key: string;
drive_type_label: string;
// Turbo & injection
turbo_compressor: string;
turbo_compressor_count: string;
ad_blue: string;
injection_mode: string;
injection_type: string;
brake_type: string;
anti_theft_type: string;
// Performances & puissance
power_kw: string;
power_kw_to: string;
power_hp: string;
power_hp_to: string;
tax_power: string;
max_speed: string;
hybrid_performance?: {
system_power: number;
max_power: number;
combustion_power: number;
};
// Poids
gross_vehicle_weight: string;
manufacturer_gross_vehicle_weight: string;
gross_front_axle_weight: string;
gross_train_weight: string;
unladen_weight: string;
// Émissions & environnement
co2_emission: string;
co2_emission_prf: string;
euro_standard: string;
standardized_euro_standard: string;
euro_approval_type: string;
euro_approval_number_prf: string;
air_quality_certificate_code: string;
environment_class_ce: string;
depollution: string;
noise_level: string;
idle_noise_level: string;
// Immatriculation
first_registration_date: string;
first_registration_date_us: string;
registration_card_date: string;
color: string;
license_plate: string;
// SRA / Assurance
sra_code: string;
sra_codes: string[];
sra_group_code: string;
price: string;
// Références TecDoc / externes
k_type: string;
k_types: string[];
kba: string;
kbas: string[];
tecdoc_brand_id: string;
tecdoc_model_id: string;
tecdoc_model_description: string;
tecdoc_vehicle_id: string;
tecdoc_linkage_type: string;
tecdoc_sub_linkage_type: string;
tecdoc_images: Array<{
imageURL50: string;
imageURL100: string;
imageURL200: string;
imageURL400: string;
imageURL800: string;
}>;
rmi_type_id: string;
selector_brand_id: string;
selector_model_id: string;
selector_model_label: string;
// Pneumatiques
tires: string[];
created_by?: ObjectId;
updated_by?: ObjectId;
created_at: Date;
updated_at: Date;
}
Sources de données
| Source | Déclencheur | Champs remplis |
|---|---|---|
Auto-Ways (immatriculation) |
|
Tous les champs issus de |
Auto-Ways (VIN) |
|
Tous les champs issus de |
Les lookups par k_type et type_mine n’alimentent pas la collection vehicles — ils alimentent uniquement vehicle_models.
|
Règles d’intégrité
-
plateetvinsont uniques (index sparse — autorisent les documents sans ces champs). -
Chaque lookup plate/VIN crée toujours un nouveau document
Vehicle. Il n’y a pas de réconciliation park_type— plusieurs véhicules physiques peuvent partager le même modèle. -
Si Auto-Ways retourne un
k_type, le service crée ou retrouve leVehicleModelcorrespondant et lievehicle_modelpar référence. -
Le document n’est jamais supprimé.
Collection vehicle_search_histories
Enregistre chaque recherche de véhicule physique effectuée par un utilisateur au sein d’un tenant. Seules les recherches par immatriculation et VIN sont enregistrées — les lookups catalogue (k_type, type_mine) ne génèrent pas d’entrée.
Métadonnées
Service propriétaire |
|
Tenant scope |
Oui (champ |
Soft delete |
Non |
Index principaux |
|
Schéma
interface VehicleSearchHistory {
_id: ObjectId;
company: ObjectId; // tenant
queried_by: ObjectId; // utilisateur ayant effectué la recherche
query: string; // valeur recherchée (plaque ou VIN)
query_type: 'plate' | 'vin';
vehicle?: ObjectId; // référence au véhicule trouvé (absent si not found)
found: boolean;
created_at: Date;
}