u
This commit is contained in:
@@ -5,12 +5,23 @@ Protected. Requires a valid session cookie (`credentials: 'include'`).
|
||||
List deliveries
|
||||
|
||||
Lists goods receipts (`manifest` rows with `type = 'delivery'`)
|
||||
for the authenticated user's selected company.
|
||||
for the authenticated user's selected company. Supports pagination and filtering.
|
||||
|
||||
|
||||
## Query parameters
|
||||
|
||||
| Param | Required | Type | Description |
|
||||
|-------|----------|------|-------------|
|
||||
| `offset` | no | integer | Number of records to skip |
|
||||
| `limit` | no | integer | Number of records to return (1-1000) |
|
||||
| `search` | no | string | Substring match for delivery number, external number, or supplier name |
|
||||
| `onlyUnbooked` | no | boolean | When true, returns only deliveries with unbooked stock items |
|
||||
| `supplierId` | no | integer | Filter by supplier entity id |
|
||||
| `seekMonths` | no | integer | Negative integer cutoff months ago (e.g. -1) |
|
||||
|
||||
## Response `200`
|
||||
|
||||
Delivery list
|
||||
Delivery list (windowed when pagination/filters are used)
|
||||
|
||||
```json
|
||||
{
|
||||
@@ -28,7 +39,11 @@ Delivery list
|
||||
"completelyOnLedgerPositions": 1
|
||||
}
|
||||
}
|
||||
]
|
||||
],
|
||||
"total": 1,
|
||||
"unfilteredTotal": 1,
|
||||
"offset": 1,
|
||||
"limit": 1
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
@@ -1,63 +0,0 @@
|
||||
# `POST /ledger`
|
||||
|
||||
Protected. Requires a valid session cookie (`credentials: 'include'`).
|
||||
|
||||
Add ledger entry
|
||||
|
||||
Appends a new entry to the append-only ledger table.
|
||||
`hash_version` is fixed to 1. `prev_hash` is cryptographically chained:
|
||||
for the genesis row it defaults to `TODO_TSE_BASED_INITHASH`, and for subsequent rows
|
||||
it is the SHA-512 hex hash of the canonical JSON representation of the previous highest-id entry.
|
||||
Requires authentication and membership in the company owning the referenced manifest article.
|
||||
|
||||
|
||||
## Body (JSON)
|
||||
|
||||
| Field | Required | Type | Description |
|
||||
|-------|----------|------|-------------|
|
||||
| `manifestarticle_id` | yes | integer | References manifestarticle.id |
|
||||
| `transaction_type` | yes | string | Transaction identifier / type (max 100 chars) |
|
||||
| `amount` | yes | number | Movement amount |
|
||||
| `transaction_text` | yes | string | Transaction memo / details |
|
||||
|
||||
```json
|
||||
{
|
||||
"manifestarticle_id": 1,
|
||||
"transaction_type": "…",
|
||||
"amount": 1,
|
||||
"transaction_text": "…"
|
||||
}
|
||||
```
|
||||
|
||||
## Response `201`
|
||||
|
||||
Ledger entry added successfully
|
||||
|
||||
```json
|
||||
{
|
||||
"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 | Invalid ledger entry or no company selected — `{"error":"…"}` |
|
||||
| 401 | Unauthorized — `{"error":"…"}` |
|
||||
| 403 | Not authorized — `{"error":"…"}` |
|
||||
| 404 | Manifest article or company not found — `{"error":"…"}` |
|
||||
|
||||
---
|
||||
|
||||
_Generated from `@openapi` JSDoc. Do not edit by hand — run `npm run docs:api`._
|
||||
54
docs/api/routes/stock/accept.md
Normal file
54
docs/api/routes/stock/accept.md
Normal file
@@ -0,0 +1,54 @@
|
||||
# `POST /stock/accept`
|
||||
|
||||
Protected. Requires a valid session cookie (`credentials: 'include'`).
|
||||
|
||||
Accept delivery manifest item(s)
|
||||
|
||||
Books acceptance for a delivery manifest item on the ledger (warehouse_id = null).
|
||||
If the connected article has stock tracking enabled, an adjustment entry is also
|
||||
booked to adjust physical stock in the target warehouse.
|
||||
If line amount is negative, books as a delivery return (outgoing).
|
||||
|
||||
|
||||
## Body (JSON)
|
||||
|
||||
| Field | Required | Type | Description |
|
||||
|-------|----------|------|-------------|
|
||||
| `manifestarticleId` | no | integer | Manifest article ID of the delivery line |
|
||||
| `warehouseId` | no | integer | Optional warehouse ID for inventory intake |
|
||||
| `items` | no | object[] | |
|
||||
| `items[].manifestarticleId` | yes | integer | |
|
||||
| `items[].warehouseId` | no | integer | |
|
||||
|
||||
```json
|
||||
{
|
||||
"manifestarticleId": 1,
|
||||
"warehouseId": 1,
|
||||
"items": [
|
||||
{
|
||||
"manifestarticleId": 1,
|
||||
"warehouseId": 1
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
## Signals
|
||||
|
||||
On success, emits SSE signals: `stock`, `ledger`, `articles`, `delivery` (see [`GET /events`](../events.md)).
|
||||
|
||||
## Response `200`
|
||||
|
||||
Delivery item(s) accepted successfully
|
||||
|
||||
## Errors
|
||||
|
||||
| Status | Description |
|
||||
|--------|-------------|
|
||||
| 400 | Validation error or no company selected |
|
||||
| 404 | Manifest article or warehouse not found |
|
||||
| 409 | Delivery line already accepted on ledger |
|
||||
|
||||
---
|
||||
|
||||
_Generated from `@openapi` JSDoc. Do not edit by hand — run `npm run docs:api`._
|
||||
54
docs/api/routes/stock/ship.md
Normal file
54
docs/api/routes/stock/ship.md
Normal file
@@ -0,0 +1,54 @@
|
||||
# `POST /stock/ship`
|
||||
|
||||
Protected. Requires a valid session cookie (`credentials: 'include'`).
|
||||
|
||||
Ship shipment manifest item(s)
|
||||
|
||||
Books shipment for a shipment manifest item on the ledger (warehouse_id = null).
|
||||
If the connected article has stock tracking enabled, an adjustment entry is also
|
||||
booked to deduct physical stock from the target warehouse.
|
||||
If line amount is negative, books as a customer retoure (incoming).
|
||||
|
||||
|
||||
## Body (JSON)
|
||||
|
||||
| Field | Required | Type | Description |
|
||||
|-------|----------|------|-------------|
|
||||
| `manifestarticleId` | no | integer | Manifest article ID of the shipment line |
|
||||
| `warehouseId` | no | integer | Optional warehouse ID for inventory deduction |
|
||||
| `items` | no | object[] | |
|
||||
| `items[].manifestarticleId` | yes | integer | |
|
||||
| `items[].warehouseId` | no | integer | |
|
||||
|
||||
```json
|
||||
{
|
||||
"manifestarticleId": 1,
|
||||
"warehouseId": 1,
|
||||
"items": [
|
||||
{
|
||||
"manifestarticleId": 1,
|
||||
"warehouseId": 1
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
## Signals
|
||||
|
||||
On success, emits SSE signals: `stock`, `ledger`, `articles`, `shipping` (see [`GET /events`](../events.md)).
|
||||
|
||||
## Response `200`
|
||||
|
||||
Shipment item(s) shipped successfully
|
||||
|
||||
## Errors
|
||||
|
||||
| Status | Description |
|
||||
|--------|-------------|
|
||||
| 400 | Validation error or no company selected |
|
||||
| 404 | Manifest article or warehouse not found |
|
||||
| 409 | Shipment line already shipped on ledger |
|
||||
|
||||
---
|
||||
|
||||
_Generated from `@openapi` JSDoc. Do not edit by hand — run `npm run docs:api`._
|
||||
Reference in New Issue
Block a user