The inventory module in SCO Autolavados tracks stock levels for all physical products — cleaning chemicals, lubricants, accessories such as air fresheners, and any other item sold or consumed during services. Inventory is deeply integrated with both the sales/POS system and the service order pipeline, meaning stock is automatically decremented through normal business operations without requiring separate manual adjustments.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/Luisangelebp/SCO_Autolavados/llms.txt
Use this file to discover all available pages before exploring further.
Items and Inventory
Every product in the system is represented by anItem record with a 1:1 linked Inventory record. Creating an item via POST /api/items automatically creates the corresponding inventory entry in a single database transaction — there is no separate step to “add” the product to inventory.
| Field | Type | Required | Description |
|---|---|---|---|
name | string | ✅ | Unique product name |
priceUsd | float | ✅ | Unit price in USD |
photo | string | ❌ | URL or path to product image |
initialQuantity | integer | ❌ | Starting stock level (defaults to 0 if omitted) |
Updating an Item
To update a product’s name, price, or photo, usePUT /api/items/:id. This is an Admin-only endpoint and also accepts multipart/form-data for photo uploads via Multer.
name, priceUsd, photo) are optional — only the fields provided will be updated. This endpoint updates the Item record only; to change the stock quantity use PUT /api/inventory/:itemId instead.
Service Resources
Services can declare the consumable inventory items they require via theServiceResource join table. This links a Services record to one or more Item records with a specified quantity per use.
When a service order transitions to FINALIZADO, the system automatically iterates over the service’s resources and decrements each linked item’s inventory quantity. This eliminates the need for manual stock adjustments after every wash.
Example: A “Lavado Completo” service might declare:
- 1× Ambientador Pino
- 50ml × Shampoo Carrocería
Stock Operations
The following operations affect inventory stock levels:| Operation | Effect on Stock | Endpoint |
|---|---|---|
| Sale of a product item | Decremented by cant sold | POST /api/sales with itemId in details |
| Customer order containing a product | Decremented at order creation | POST /api/customer/orders |
| Service order finalized with resources | Decremented per ServiceResource quantities | PATCH /api/service-orders/:id/finish |
| Manual stock adjustment | Set to exact value specified | PUT /api/inventory/:itemId |
Expense with itemId + quantity | Incremented (restocking) | POST /api/expenses |
Manual Stock Adjustment
To set a product’s stock to a specific quantity (e.g., after a physical count):upsert operation — it will create the inventory record if it somehow doesn’t exist yet, or update it if it does.
Restocking via Expenses
When recording a supply purchase as an expense, including the optionalitemId and quantity fields will automatically add the purchased quantity to that item’s inventory. This way, a single call to POST /api/expenses both records the financial outflow and updates the stock:
Viewing Products
GET /api/items returns all products ordered alphabetically by name, with each item’s current stock nested in an inventory object:
Inventory API Reference
Full endpoint reference for item creation, inventory updates, and stock management including request/response schemas.