This commit is contained in:
seb
2026-10-12 13:11:28 +02:00
parent 4429294d8b
commit 1f09e620e3
8 changed files with 233 additions and 9 deletions

View File

@@ -6,6 +6,7 @@ Create shipping for an order
Creates a shipping for the order. The shipping number is allocated from the
`shipping` number sequence (prefix and counter from the numbers API).
If `state` is `shipped`, stock is adjusted via the ledger and article history is written.
## Path parameters
@@ -20,11 +21,13 @@ Creates a shipping for the order. The shipping number is allocated from the
|-------|----------|------|-------------|
| `type` | yes | string | |
| `state` | yes | string | |
| `warehouseId` | no | integer | Optional warehouse ID for stock deduction when state is shipped |
```json
{
"type": "…",
"state": "…"
"state": "…",
"warehouseId": 1
}
```
@@ -51,7 +54,8 @@ Created shipping
| 400 | Validation error or no company selected — `{"error":"…"}` |
| 401 | Unauthorized — `{"error":"…"}` |
| 403 | Not authorized — `{"error":"…"}` |
| 404 | Order not found — `{"error":"…"}` |
| 404 | Order or warehouse not found — `{"error":"…"}` |
| 409 | Order already shipped — `{"error":"…"}` |
---

View File

@@ -5,6 +5,8 @@ Protected. Requires a valid session cookie (`credentials: 'include'`).
Delete shipping
Deletes a shipping of the selected company. Its packages are removed as well.
Shipped shippings cannot be deleted because stock movements have been ledgered.
## Path parameters
@@ -25,6 +27,8 @@ _No content_
| 400 | Invalid ID or no company selected — `{"error":"…"}` |
| 401 | Unauthorized — `{"error":"…"}` |
| 403 | Not authorized — `{"error":"…"}` |
| 404 | Shipping not found — `{"error":"…"}` |
| 409 | Shipped shipping cannot be deleted — `{"error":"…"}` |
---

View File

@@ -0,0 +1,61 @@
# `PATCH /shipping/{id}`
Protected. Requires a valid session cookie (`credentials: 'include'`).
Update shipping
Updates a shipping record. If transitioned to `shipped`, stock is adjusted
via ledger and article history is written. Once shipped, it cannot be undone.
## Path parameters
| Param | Required | Type | Description |
|-------|----------|------|-------------|
| `id` | yes | integer | Shipping ID |
## Body (JSON)
| Field | Required | Type | Description |
|-------|----------|------|-------------|
| `type` | no | string | |
| `state` | no | string | |
| `warehouseId` | no | integer | Warehouse ID for stock deduction when transitioning to shipped |
```json
{
"type": "…",
"state": "…",
"warehouseId": 1
}
```
## Response `200`
Updated shipping
```json
{
"shipping": {
"id": 1,
"manifestId": 1,
"number": "…",
"type": "…",
"state": "…"
}
}
```
## Errors
| Status | Description |
|--------|-------------|
| 400 | Validation error or no company selected — `{"error":"…"}` |
| 401 | Unauthorized — `{"error":"…"}` |
| 403 | Not authorized — `{"error":"…"}` |
| 404 | Shipping or warehouse not found — `{"error":"…"}` |
| 409 | Shipped shipping cannot be undone, or order already shipped — `{"error":"…"}` |
---
_Generated from `@openapi` JSDoc. Do not edit by hand — run `npm run docs:api`._