Files
dashback/docs/api/routes/stock/adjust.md
2026-09-30 19:29:13 +02:00

82 lines
1.8 KiB
Markdown

# `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)
| Field | Required | Type | Description |
|-------|----------|------|-------------|
| `sku` | no | string | Article SKU (for single-item adjustment) |
| `warehouseId` | no | integer | Target warehouse ID |
| `amount` | no | number | Signed adjustment quantity (+ to add, - to remove) |
| `text` | no | string | Reason or memo |
| `lines` | no | object[] | Batch adjustment lines |
```json
{
"sku": "…",
"warehouseId": 1,
"amount": 1,
"text": "…",
"lines": [
{
"sku": "…",
"warehouseId": 1,
"amount": 1,
"text": "…"
}
]
}
```
## Response `201`
Stock adjusted successfully
```json
{
"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`._