Restofy Docs
Control de inventario POST

Listar mermas

POST /api/inventory/list-wastes

Descripción

Devuelve el historial paginado de mermas con los indicadores del periodo.

Detalles

Cada merma trae su bodega, su motivo, su costo, quién la registró y la línea que más pesa. Filtra por bodega, motivo, estado, texto y rango de fechas. Los indicadores suman solo las mermas vigentes y muestran el motivo y el insumo que más plata se perdió.

Permisos requeridos

inventory.waste.create

Request

Nombre Tipo Requerido Reglas
search string No
max:100
storageLocationId int No
min_value:1
wasteReasonId int No
min_value:1
statusCode string No
enum:completed,cancelled
dateFrom datetime No —
dateTo datetime No —

Paginación

defaultLimit 50
maxLimit 100
defaultSort createdAt
defaultDir desc
withTotal true
allowedSorts [createdAt, totalCostCents]

Ejemplo de request

curl -X POST https://restofy.pro/api/inventory/list-wastes \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer <accessToken>"

Los valores son demo: reemplázalos por datos reales del negocio.

Ejemplo de respuesta

Actualizado: 2026-11-02T19:00:57Z
HTTP 200

Request

[]

Response

{
    "success": true,
    "message": "Operación realizada correctamente",
    "data": {
        "wastes": [
            {
                "wasteId": 3,
                "wasteUuid": "ae6c17ca-fbdc-4537-b75f-f76b9e91ae61",
                "locationName": "Bodega Bebidas",
                "reasonName": "Vencido",
                "notes": "Se venció en el cuarto frío",
                "totalCostCents": 1000,
                "statusCode": "completed",
                "actorName": "App Testing",
                "linesCount": 1,
                "mainLineName": "Insumo Test 6ae8d7c2297ff",
                "createdAt": "2026-11-02T18:34:43.000Z"
            },
            {
                "wasteId": 2,
                "wasteUuid": "2c41bccc-b636-43ed-be78-2ac73c50c273",
                "locationName": "Bodega Bebidas",
                "reasonName": "Vencido",
                "notes": null,
                "totalCostCents": 4000,
                "statusCode": "completed",
                "actorName": "App Testing",
                "linesCount": 1,
                "mainLineName": "Plato costo 6ae8d7b91f0d1",
                "createdAt": "2026-11-02T18:34:34.000Z"
            },
            {
                "wasteId": 1,
                "wasteUuid": "08e3cb45-86fe-433b-8ccf-56c5460bcbcc",
                "locationName": "Bodega Bebidas",
                "reasonName": "Vencido",
                "notes": "Se venció en el cuarto frío",
                "totalCostCents": 1500,
                "statusCode": "completed",
                "actorName": "App Testing",
                "linesCount": 1,
                "mainLineName": "Insumo Test 6ae8d7b6734f3",
                "createdAt": "2026-11-02T18:34:31.000Z"
            }
        ],
        "pagination": {
            "page": 1,
            "limit": 50,
            "total": 3,
            "totalPages": 1,
            "hasNext": false,
            "hasPrev": false
        },
        "kpis": {
            "totalWastes": 3,
            "totalCostCents": 6500,
            "topReasonName": "Vencido",
            "topItemName": "Insumo Test 6ae8d7b87fb6e"
        }
    }
}