Overview
The Requests system manages spare part transfer requests between locations. It includes both historical requests and shopping cart items.RequestHistoryItem
Represents a completed or in-progress spare part request.Properties
Unique identifier for the request
Request creation timestamp (ISO 8601 format)
Current status of the request (e.g., “pendiente”, “aprobada”, “rechazada”, “completada”)
General notes or observations about the request
Destination location ID (where parts will be sent)
Name of the destination location
Origin location ID (where parts will come from)
Name of the origin location
User ID of the person who created the request
Full name of the requester
Example
CartItem
Represents an item in a user’s shopping cart before creating a formal request.Properties
Unique identifier for the cart item
User ID who added the item to cart
Location ID where the part will be requested from
Quantity of parts requested
Timestamp when item was added to cart (ISO 8601 format)
Name of the user requesting the part
Role of the user (e.g., “admin”, “tecnico”, “superuser”)
Spare part identifier
Part reference code
Name of the spare part
URL to the part image
Current stock available at the workshop/location
Example
API Methods
getRequestHistory
Fetches all request history items, ordered by creation date (newest first).src/entities/requests/api/index.ts:4
Query Details:
- View:
v_historial_solicitudes - Ordering:
fecha_creaciondescending (newest first) - Returns: Complete request history with location and user details
Example Usage
Request Workflow
- Add to Cart: User adds spare parts to their cart (CartItem entities)
- Review Cart: User reviews quantities and available stock
- Create Request: Cart items are converted to a formal RequestHistoryItem
- Approval: Request goes through approval workflow
- Fulfillment: Approved requests trigger inventory movements
- Completion: Request status updated to “completada”
Status Values
Common request status values:pendiente- Pending reviewaprobada- Approved, awaiting fulfillmenten_proceso- Being processed/fulfilledcompletada- Completed successfullyrechazada- Rejectedcancelada- Cancelled by requester
Relationships
- Belongs to: User via
id_usuario_solicitante - From: Location via
id_localizacion_origen - To: Location via
id_localizacion_destino - Contains: Spare Parts via
id_repuesto(in cart items) - Creates: Movements when fulfilled