The inventory resource tracks real-time stock levels for products that haveDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/luisumit/LaPreviaRestobar/llms.txt
Use this file to discover all available pages before exploring further.
trackInventory: true. Each inventory record is keyed to a product and carries the current quantity, a minimum-stock threshold for low-stock alerts, the unit of measure, and the product’s category. Stock is decremented automatically when a tracked product appears in an order that moves to ACEPTADO. You can also adjust stock directly via PUT /inventory/{productId}/stock — useful for manual stocktakes or receiving deliveries.
The backend exposes two sets of inventory endpoints: the typed REST routes consumed by Retrofit (/inventory, /inventory/{productId}/stock) and two raw Firebase pass-through routes (/inventario, POST /inventario) from the original server.js implementation. Both sets write to the same inventory node in Firebase Realtime Database.
Inventory Object
Internal numeric record ID (serialised as
Long from Gson @SerializedName("id")).Numeric ID linking this inventory record to a product (
@SerializedName("productId")).Display name of the product at the time the inventory record was created.
Current quantity in stock (
@SerializedName("stockQuantity")). Maps to currentStock in the local Inventory model.Category of the product, used for grouping in the inventory dashboard.
Minimum acceptable stock level. When
stockQuantity falls below this value the dashboard flags the item as low-stock. Defaults to 10.Local model mapping:InventoryDto.toInventory()convertsproductId(Long) to aString, mapsstockQuantitytocurrentStock: Double, and hard-codesunitOfMeasureto"unidades". Theversionfield is tracked locally on theInventorymodel but is not present in the DTO.
GET /inventory
Returns the full list of inventory records from theinventory node in Firebase.
200 OK
stockQuantity (3) is below minimumStock (10), so the inventory dashboard would display a low-stock alert for that item.
PUT /inventory/{productId}/stock
Updates the stock quantity for a single tracked product. Call this endpoint to reflect a manual stock adjustment (e.g., after a delivery) or to correct a discrepancy found during a stocktake. Path parametersThe product ID whose stock should be updated. Corresponds to the
productId field in the inventory record.StockUpdateRequest)
The new absolute stock quantity. This is a full replacement of the current value, not a delta.
200 OK — returns the updated InventoryDto.
Raw Firebase Endpoints
These two routes are part of the originalserver.js implementation and provide direct read/write access to the inventory node in Firebase Realtime Database. They do not enforce the typed InventoryDto schema — any JSON object can be pushed. They are retained for tooling and admin scripts that need to bulk-load inventory data.
GET /inventario
Reads all documents from theinventory Firebase node and returns them as a flat array.
200 OK — an array of raw inventory objects as stored in Firebase. Returns [] if the node is empty.
POST /inventario
Pushes a new document to theinventory Firebase node using db.ref('inventory').push(data). No schema validation is applied — the body is stored verbatim. Responds with a confirmation message.
Request body
Any valid JSON object representing an inventory record. The recommended shape matches the InventoryDto fields.
200 OK