This commit is contained in:
seb
2026-09-26 23:06:09 +02:00
parent cbb2fdeb6d
commit 69f27a2942
19 changed files with 2231 additions and 0 deletions

View File

@@ -0,0 +1,73 @@
# `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)
```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`._