u
This commit is contained in:
73
docs/api/routes/stock/adjust.md
Normal file
73
docs/api/routes/stock/adjust.md
Normal 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`._
|
||||
Reference in New Issue
Block a user