TheDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/123048152-JJDS/CafeteriaPM_S203/llms.txt
Use this file to discover all available pages before exploring further.
/gastos/ endpoints track day-to-day operational expenses that are not ingredient supply purchases. Typical use cases include utility bills, cleaning supplies, equipment maintenance, staff meals, or any other cost that should appear in the operational expenditure reports. Each expense is automatically attributed to the user who created it via the JWT token, so no id_usuario field is needed in the request body. Expenses can be assigned to a category and filtered by date range for reporting purposes.
Endpoints
List expenses
Bearer <token> — Roles: admin, caja.fecha descending (most recent first). Optionally filtered by date range — both boundaries are inclusive and matched against the fecha date field.
Query parameters
Start of the date filter in
YYYY-MM-DD format (e.g. "2024-01-01"). Inclusive.End of the date filter in
YYYY-MM-DD format (e.g. "2024-01-31"). Inclusive.Record an expense
Bearer <token> — Roles: admin, caja.id_usuario is populated automatically from the authenticated user in the JWT — it cannot be overridden in the request body. If id_categoria is provided, the category must exist; the endpoint returns 400 if the category ID is not found.
Request body
Description of the expense (e.g.
"Gas cylinder refill", "Monthly internet bill"). Used in reports and activity history.Amount in currency units. Must be greater than 0.
Optional category ID. For expense records, use a category with
tipo = "gasto" or tipo = "ambos". Omit to leave the expense uncategorized.Date the expense occurred, in
YYYY-MM-DD format. Can be a past date for retroactive logging.201 Created
| Status | Detail |
|---|---|
400 | "Categoría no encontrada" — id_categoria does not match any category. |
The GastoOut object
Internal expense ID.
Free-text description of the expense as entered by the user.
Expense amount in currency units.
Expanded category object
{id, nombre, tipo}, or null if uncategorized.ID of the user who recorded the expense (set from JWT, not from request body).
Full user object for the recorder:
{id, nombre, email, activo, created_at, role}.Date the expense occurred (
YYYY-MM-DD), as supplied by the caller.Timestamp when the expense record was created in the system.
Usage notes
Expenses vs. purchases: The/gastos/ endpoint is for general operational costs. Ingredient procurement should be recorded through POST /compras/ instead — supply purchases automatically increment ingredient stock levels and appear in inventory reports, while expenses do not affect stock.
Retroactive entries: The fecha field represents when the cost was incurred, not when it was entered into the system. created_at is always the actual database insertion time. This allows logging a bill for a past date without affecting the insertion audit trail.
Date filtering: Both GET /gastos/ and the stats endpoints (GET /stats/gastos-lista, GET /stats/gastos-diarios) filter on the fecha column. Ensure consistent date entry to get accurate reports.