All protected endpoints require a valid JWT token obtained fromDocumentation 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.
POST /api/users/login. Include it in the Authorization header:
Products (Items)
Products (referred to asItem in the database) represent physical goods sold at the autolavado — air fresheners, wax, polish, etc. Every item automatically gets an Inventory record that tracks its current stock quantity.
Get All Products
Public endpoint — no authentication required. Returns the full product catalog, with each item’s current inventory stock nested inside.UUID of the product.
Product name (unique across all items).
Unit sale price in USD.
Filename of the product photo.
null if no image has been uploaded.Nested inventory record containing
id, itemId, and quantity (current stock).Create a Product
🔒 Requires:ADMIN role
Creates a new product and atomically creates its linked Inventory record in a single database transaction. The initialQuantity sets the opening stock.
Unique name for the product (e.g.
"Ambientador Pino"). Names must be unique across all items.Unit sale price in USD.
Optional filename of the product image. Can also be uploaded as
multipart/form-data with a photo file field.Starting stock count. Defaults to
0 if not provided.Inventory record is created in the same transaction but is not included in this response; fetch it via GET /api/items):
Photo uploads are supported via
multipart/form-data. When uploading a file, send the image as a photo field alongside the other text fields. The stored filename is returned in the photo field on subsequent reads.Update a Product
🔒 Requires:ADMIN role
Updates one or more metadata fields of an existing product. All fields are optional — only the fields you include are updated.
UUID of the item to update. Use the
id returned by GET /api/items.New product name. Must be unique across all items.
New unit sale price in USD.
New photo filename or URL. Can also be uploaded as
multipart/form-data with a photo file field.This endpoint updates product metadata only (
name, priceUsd, photo). To adjust the current stock level, use PUT /api/inventory/:itemId.Inventory Stock
Directly manage the stock quantity for an existing product.Update Stock Quantity
🔒 Requires:ADMIN role
Directly sets the stock quantity for a product’s inventory record. This is an absolute assignment — it replaces the current quantity rather than incrementing or decrementing it. Uses an upsert internally, so it works even if the inventory record was somehow missing.
UUID of the Item (product), not the Inventory record itself. Use the
id field returned from GET /api/items.The new absolute stock count (e.g.
15 sets stock to exactly 15, regardless of current value).Automatic stock decrements occur when:
- (a) A customer places a product in their web order via
POST /api/customer/orders— inventory is decremented immediately upon order creation, before payment is received. - (b) A service order is finalized via
PATCH /api/service-orders/:id/finish— any items defined as service resources (ServiceResource) are automatically decremented. - (c) A service order state is manually set to
FINALIZADOviaPATCH /api/service-orders/:id/state— the same resource decrement logic applies.
PUT /api/inventory/:itemId only for manual corrections, opening stock adjustments, or post-physical-count reconciliation.Expenses
Record financial outflows from the business. Expenses automatically deduct from the AutoLavado’s general balance. When an expense is linked to a product (itemId) with a quantity, it also restocks that product’s inventory — making this the recommended way to record product purchases.
Get All Expenses
🔒 Requires:ADMIN role
Returns the full expense history, ordered by most recent first. Each expense includes the linked item details if an itemId was provided.
UUID of the expense record.
Human-readable description of what was purchased or spent.
Amount spent in USD. Deducted from the autolavado’s USD balance.
Amount spent in bolívares. Deducted from the autolavado’s BS balance. Use
0 if not applicable.Number of units purchased. Used to restock inventory when
itemId is also provided.UUID of the restocked product.
null for general expenses (utilities, fuel, etc.).ISO 8601 datetime when the expense was recorded (auto-generated).
Create an Expense
🔒 Requires:ADMIN role
Records a new expense. The following side effects occur atomically in a single database transaction:
- An
Expenserecord is created. - The specified amounts are deducted from the AutoLavado’s
balanceUsdandbalanceBs. - If
itemIdandquantityare provided, the item’s inventory stock is incremented byquantity.
A clear description of the expense (e.g.
"Compra de 10 ambientadores pino").Amount in USD to deduct from the business balance.
Amount in bolívares to deduct from the business balance. Pass
0 if the purchase was made entirely in USD.Optional number of units purchased. If provided alongside
itemId, the linked product’s stock will be restocked by this amount.Optional UUID of the product being restocked. Use the
id from GET /api/items. Has no effect if quantity is not also provided.