Files
dashback/docs/api/routes/stock/adjust.md
2026-09-26 23:06:09 +02:00

1.4 KiB

POST /stock/adjust

Protected. Requires a valid session cookie (credentials: 'include').

Adjust stock manually

Writes signed (+ or -) entries to the append-only ledger under an implicit manifest of type "adjustment", allocating a number from the "adjustment" number scheme.

Body (JSON)

{
  "sku": "…",
  "warehouseId": 1,
  "amount": 1,
  "text": "…",
  "lines": [
    {
      "sku": "…",
      "warehouseId": 1,
      "amount": 1,
      "text": "…"
    }
  ]
}

Response 201

Stock adjusted successfully

{
  "manifest": {
    "id": 1,
    "number": "…",
    "type": "adjustment",
    "date": "2026-08-10T00:00:00.000Z",
    "createdAt": "2026-08-10T00:00:00.000Z"
  },
  "lines": [
    {}
  ],
  "ledger": [
    {
      "id": 1,
      "manifestarticle_id": 1,
      "transaction_type": "…",
      "amount": 1,
      "transaction_text": "…",
      "hash_version": 1,
      "prev_hash": "…",
      "sku": "…",
      "created_at": "2026-08-10T00:00:00.000Z"
    }
  ]
}

Errors

Status Description
400 Missing fields, invalid amount, or no company selected — {"error":"…"}
401 Unauthorized — {"error":"…"}
403 Not authorized — {"error":"…"}
404 Article or warehouse not found — {"error":"…"}

Generated from @openapi JSDoc. Do not edit by hand — run npm run docs:api.