The Trucks module provides a complete registry of every vehicle in the Aibar SRL App fleet. Each truck record stores the essential identification data — licence plate, manufacturer, model, model year, and vehicle type — that appears on trip assignments and reports. Trucks can be created, updated, and soft-deleted, ensuring that vehicles taken out of service do not corrupt historical trip records that still reference them.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/lucavallini/aibar-frontend/llms.txt
Use this file to discover all available pages before exploring further.
Data Models
Camion Interface
The full read model returned by the API for every truck record:
CamionCreate Interface
The payload used when registering a new truck. Only patente is required:
CamionCreate Fields
The vehicle’s licence plate number. This is the unique identifier for trucks within the system — no two active trucks may share the same
patente. If a duplicate plate is submitted the API returns 400 Bad Request and the UI displays “Ya existe un camión con esa patente”.Vehicle manufacturer name (e.g.,
"Volvo", "Scania", "Mercedes-Benz").Model designation of the vehicle (e.g.,
"FH16", "R 500").Four-digit model year of manufacture (e.g.,
2019).Free-text category describing the vehicle’s configuration or purpose (e.g.,
"Semirremolque", "Chasis", "Cisterna").patente (licence plate) is the unique, human-readable identifier for trucks. The id field is a UUID used internally by the API, but plate numbers are what appear in every dropdown, report, and trip record across the application.CamionesService
CamionesService is an Angular Injectable provided at the root level. It handles all REST calls to the /camiones resource.
listar()
Returns a paginated list of trucks. By default, only active trucks (activo: true) are returned.
ListaViajes component calls camionesService.listar(true, 1, 1000) to populate the truck dropdown in the new-trip modal — only active vehicles are offered for assignment.
crear()
Registers a new truck in the fleet.
CamionCreate object serialised as JSON.
Returns the newly created Camion. The component enforces that patente is non-empty before calling this method. A 400 response indicates a duplicate licence plate.
actualizar()
Performs a partial update on an existing truck record. Accepts any subset of CamionCreate fields. Note that patente cannot be changed after creation (the edit form only exposes marca, modelo, anio, and tipo).
Camion. The edit modal pre-populates marca, modelo, anio, and tipo from the selected truck before sending only the changed values.
darDeBaja()
Soft-deletes a truck by setting activo: false on the backend. The truck record and all historical trip associations are fully preserved.
Camion with activo: false. Deactivated trucks are excluded from the default listing (activos_only=true) and will no longer appear in the new-trip dropdown.
Truck Lifecycle
Register a new truck
Open the registration modal via + Nuevo camión. The only mandatory field is the licence plate (
patente). Optionally fill in make, model, year, and type for richer records.Assign to a trip
When creating a trip, the truck dropdown is populated from
camionesService.listar(true, 1, 1000). Select the desired truck or leave it blank — the camion_id field on a trip is optional.Update vehicle details
Use the Editar row action to correct or enrich
marca, modelo, anio, or tipo at any time via PATCH /camiones/{id}.Soft Delete — Preserving Historical Data
CallingdarDeBaja() does not remove the truck from the database. It flips the activo flag to false, which means:
- The truck is excluded from
GET /camiones/?activos_only=true(the default query used by both the truck list and the trip form). - All past
Viajerecords that reference the truck’sidremain intact and continue to display correctly — deactivating a truck never breaks trip history. - The record can be retrieved directly by
idor by querying withactivos_only=falseif needed for auditing.
Pagination Wrapper
Alllistar() responses are typed as RespuestaPaginada<Camion>. This generic interface is shared across every list endpoint in the application:
The array of records for the current page.
Total number of records matching the query (across all pages).
The current page number (1-indexed).
Maximum number of records per page as requested.
Total number of pages available at the current
tamano_pagina.ListaCamiones is managed with Angular signals, and the shared <app-paginacion> component handles navigation: