The Inventario module is a read-only ledger that records every change to product stock in Tiendas Mi Cholo. Movements are created automatically by the system — aDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/interezante456-pixel/Miercoles-Proyecto/llms.txt
Use this file to discover all available pages before exploring further.
SALIDA is written each time a sale is registered (or reversed when a sale is voided), and an ENTRADA is written each time a purchase order is received. This audit trail lets you trace every unit in and out of the warehouse, who performed the operation, and which transaction triggered it. All authenticated roles can query inventory movements; no role may create or modify movements directly through the API.
GET /api/inventario
List all inventory movements across all products, in default database order.GET http://localhost:8080/api/inventario
Authorization
Bearer token —
Authorization: Bearer <token>Response 200 OK
Internal identifier of the movement record.
Movement direction:
ENTRADA (stock in), SALIDA (stock out), or AJUSTE (manual adjustment).Number of units moved in this event.
Product’s
stockActual value before this movement was applied.Product’s
stockActual value after this movement was applied.Human-readable description of why the movement occurred (e.g.
"Venta VNT-00001" or "Recepción compra CMP-00003").Primary key of the source transaction (Venta ID or Compra ID) that triggered this movement.
Source transaction type:
VENTA, COMPRA, or AJUSTE.Embedded product snapshot:
id, codigo, nombre.Embedded user who triggered the operation:
id, nombre, apellido.Timestamp when the movement was persisted (
@PrePersist).Example response
cURL
GET /api/inventario/producto/{productoId}
Retrieve the complete movement history for a specific product, ordered byfecha descending (most recent first). Use this endpoint to audit stock changes for an individual SKU.
GET http://localhost:8080/api/inventario/producto/{productoId}
Authorization
Bearer token —
Authorization: Bearer <token>Path Parameters
The internal ID of the product whose movement history you want to retrieve.
Response 200 OK
Returns an array of movement objects (same shape as GET /api/inventario) ordered by fecha DESC. Returns an empty array [] if no movements exist for the given product ID.
Example response — product 1 history
cURL
Error Codes
| Status | Meaning |
|---|---|
401 Unauthorized | Token missing, invalid, or expired. |
How Movements Are Created
Inventory movements are created automatically by the system in response to transactional events. You cannot POST, PUT, or DELETE movements through the API — the
/api/inventario endpoints are intentionally read-only.| Event | Movement Type | Triggered by |
|---|---|---|
POST /api/ventas | SALIDA per line item | VentaService.registrarVenta() |
PATCH /api/ventas/{id}/anular | ENTRADA per line item (reversal) | VentaService.anularVenta() |
PATCH /api/compras/{id}/recibir | ENTRADA per line item | CompraService.recibirCompra() |
| Manual adjustment | AJUSTE | Future back-office flow |
The
referenciaTipo field tells you what kind of transaction triggered the movement, and referenciaId gives you its primary key so you can cross-reference with /api/ventas/{id} or /api/compras/{id} for the full context.