This commit is contained in:
seb
2026-10-17 05:10:25 +02:00
parent 988b4848cf
commit 7197a6ddb7
28 changed files with 1172 additions and 166 deletions

View File

@@ -0,0 +1,37 @@
# `GET /carrier`
Protected. Requires a valid session cookie (`credentials: 'include'`).
List carriers
Lists carriers for the selected company, ordered by sort and name.
## Response `200`
List of carriers
```json
{
"carriers": [
{
"id": 1,
"name": "…",
"sort": 1,
"hasPackages": true,
"isReverse": true
}
]
}
```
## Errors
| Status | Description |
|--------|-------------|
| 400 | No company selected — `{"error":"…"}` |
| 401 | Unauthorized — `{"error":"…"}` |
| 403 | Not authorized — `{"error":"…"}` |
---
_Generated from `@openapi` JSDoc. Do not edit by hand — run `npm run docs:api`._

View File

@@ -0,0 +1,60 @@
# `POST /carrier`
Protected. Requires a valid session cookie (`credentials: 'include'`).
Create carrier
Creates a new carrier for the selected company.
Sort order will be automatically appended if omitted.
## Body (JSON)
| Field | Required | Type | Description |
|-------|----------|------|-------------|
| `name` | yes | string | |
| `sort` | no | integer | Optional sort order |
| `hasPackages` | no | boolean | |
| `isReverse` | no | boolean | |
```json
{
"name": "…",
"sort": 1,
"hasPackages": true,
"isReverse": true
}
```
## Signals
On success, emits SSE signal: `carrier` (see [`GET /events`](../events.md)).
## Response `201`
Created carrier
```json
{
"carrier": {
"id": 1,
"name": "…",
"sort": 1,
"hasPackages": true,
"isReverse": true
}
}
```
## Errors
| Status | Description |
|--------|-------------|
| 400 | Invalid input or missing fields — `{"error":"…"}` |
| 401 | Unauthorized — `{"error":"…"}` |
| 403 | Not authorized — `{"error":"…"}` |
| 409 | Carrier already exists — `{"error":"…"}` |
---
_Generated from `@openapi` JSDoc. Do not edit by hand — run `npm run docs:api`._

View File

@@ -0,0 +1,37 @@
# `DELETE /carrier/{id}`
Protected. Requires a valid session cookie (`credentials: 'include'`).
Delete carrier
Deletes a carrier for the selected company, unless referenced in shipping.
## Path parameters
| Param | Required | Type | Description |
|-------|----------|------|-------------|
| `id` | yes | integer | Carrier ID |
## Signals
On success, emits SSE signal: `carrier` (see [`GET /events`](../events.md)).
## Response `204`
Carrier deleted
_No content_
## Errors
| Status | Description |
|--------|-------------|
| 400 | Invalid ID or no company selected — `{"error":"…"}` |
| 401 | Unauthorized — `{"error":"…"}` |
| 403 | Not authorized — `{"error":"…"}` |
| 404 | Carrier not found — `{"error":"…"}` |
| 409 | Carrier in use in shipping — `{"error":"…"}` |
---
_Generated from `@openapi` JSDoc. Do not edit by hand — run `npm run docs:api`._

View File

@@ -0,0 +1,42 @@
# `GET /carrier/{id}`
Protected. Requires a valid session cookie (`credentials: 'include'`).
Get carrier by ID
Retrieves a single carrier for the authenticated user's selected company.
## Path parameters
| Param | Required | Type | Description |
|-------|----------|------|-------------|
| `id` | yes | integer | Carrier ID |
## Response `200`
Carrier details
```json
{
"carrier": {
"id": 1,
"name": "…",
"sort": 1,
"hasPackages": true,
"isReverse": true
}
}
```
## Errors
| Status | Description |
|--------|-------------|
| 400 | Invalid ID or no company selected — `{"error":"…"}` |
| 401 | Unauthorized — `{"error":"…"}` |
| 403 | Not authorized — `{"error":"…"}` |
| 404 | Carrier not found — `{"error":"…"}` |
---
_Generated from `@openapi` JSDoc. Do not edit by hand — run `npm run docs:api`._

View File

@@ -0,0 +1,65 @@
# `PATCH /carrier/{id}`
Protected. Requires a valid session cookie (`credentials: 'include'`).
Update carrier
Updates carrier name, sort order, hasPackages, and/or isReverse for the selected company.
## Path parameters
| Param | Required | Type | Description |
|-------|----------|------|-------------|
| `id` | yes | integer | Carrier ID |
## Body (JSON)
| Field | Required | Type | Description |
|-------|----------|------|-------------|
| `name` | no | string | |
| `sort` | no | integer | |
| `hasPackages` | no | boolean | |
| `isReverse` | no | boolean | |
```json
{
"name": "…",
"sort": 1,
"hasPackages": true,
"isReverse": true
}
```
## Signals
On success, emits SSE signal: `carrier` (see [`GET /events`](../events.md)).
## Response `200`
Updated carrier
```json
{
"carrier": {
"id": 1,
"name": "…",
"sort": 1,
"hasPackages": true,
"isReverse": true
}
}
```
## Errors
| Status | Description |
|--------|-------------|
| 400 | Invalid input or missing fields — `{"error":"…"}` |
| 401 | Unauthorized — `{"error":"…"}` |
| 403 | Not authorized — `{"error":"…"}` |
| 404 | Carrier not found — `{"error":"…"}` |
| 409 | Carrier already exists — `{"error":"…"}` |
---
_Generated from `@openapi` JSDoc. Do not edit by hand — run `npm run docs:api`._

View File

@@ -0,0 +1,51 @@
# `PUT /carrier/order`
Protected. Requires a valid session cookie (`credentials: 'include'`).
Reorder carriers
Reorders carriers for the selected company.
`carrierIds` must include all existing carrier IDs exactly once.
## Body (JSON)
| Field | Required | Type | Description |
|-------|----------|------|-------------|
| `carrierIds` | yes | integer[] | |
```json
{
"carrierIds": [
1
]
}
```
## Signals
On success, emits SSE signal: `carrier` (see [`GET /events`](../events.md)).
## Response `200`
Applied carrier order
```json
{
"carrierIds": [
1
]
}
```
## Errors
| Status | Description |
|--------|-------------|
| 400 | Invalid carrier order or no company selected — `{"error":"…"}` |
| 401 | Unauthorized — `{"error":"…"}` |
| 403 | Not authorized — `{"error":"…"}` |
---
_Generated from `@openapi` JSDoc. Do not edit by hand — run `npm run docs:api`._

View File

@@ -48,6 +48,7 @@ List of shipments
"manifestId": 1,
"number": "…",
"trackingCode": "…",
"carrierId": 1,
"carrier": "…",
"type": "…",
"state": "…"

View File

@@ -88,6 +88,7 @@ Created shipment
"manifestId": 1,
"number": "…",
"trackingCode": "…",
"carrierId": 1,
"carrier": "…",
"type": "…",
"state": "…"

View File

@@ -24,6 +24,7 @@ List of shippings
"manifestId": 1,
"number": "…",
"trackingCode": "…",
"carrierId": 1,
"carrier": "…",
"type": "…",
"state": "…"

View File

@@ -19,14 +19,18 @@ If `state` is `shipped`, stock is adjusted via the ledger and article history is
| Field | Required | Type | Description |
|-------|----------|------|-------------|
| `carrierId` | yes | integer | Carrier ID |
| `type` | yes | string | |
| `state` | yes | string | |
| `trackingCode` | no | string | Carrier parcel tracking code |
| `warehouseId` | no | integer | Optional warehouse ID for stock deduction when state is shipped |
```json
{
"carrierId": 1,
"type": "…",
"state": "…",
"trackingCode": "…",
"warehouseId": 1
}
```
@@ -42,6 +46,7 @@ Created shipping
"manifestId": 1,
"number": "…",
"trackingCode": "…",
"carrierId": 1,
"carrier": "…",
"type": "…",
"state": "…"

View File

@@ -70,6 +70,7 @@ Created order
"manifestId": 1,
"number": "…",
"trackingCode": "…",
"carrierId": 1,
"carrier": "…",
"type": "…",
"state": "…"
@@ -80,6 +81,7 @@ Created order
"manifestId": 1,
"number": "…",
"trackingCode": "…",
"carrierId": 1,
"carrier": "…",
"type": "…",
"state": "…"
@@ -138,6 +140,7 @@ Created order
"manifestId": 1,
"number": "…",
"trackingCode": "…",
"carrierId": 1,
"carrier": "…",
"type": "…",
"state": "…"

View File

@@ -44,6 +44,7 @@ Order
"manifestId": 1,
"number": "…",
"trackingCode": "…",
"carrierId": 1,
"carrier": "…",
"type": "…",
"state": "…"
@@ -54,6 +55,7 @@ Order
"manifestId": 1,
"number": "…",
"trackingCode": "…",
"carrierId": 1,
"carrier": "…",
"type": "…",
"state": "…"
@@ -112,6 +114,7 @@ Order
"manifestId": 1,
"number": "…",
"trackingCode": "…",
"carrierId": 1,
"carrier": "…",
"type": "…",
"state": "…"

View File

@@ -53,6 +53,7 @@ Order list
"manifestId": 1,
"number": "…",
"trackingCode": "…",
"carrierId": 1,
"carrier": "…",
"type": "…",
"state": "…"
@@ -63,6 +64,7 @@ Order list
"manifestId": 1,
"number": "…",
"trackingCode": "…",
"carrierId": 1,
"carrier": "…",
"type": "…",
"state": "…"
@@ -121,6 +123,7 @@ Order list
"manifestId": 1,
"number": "…",
"trackingCode": "…",
"carrierId": 1,
"carrier": "…",
"type": "…",
"state": "…"

View File

@@ -64,6 +64,7 @@ Updated order
"manifestId": 1,
"number": "…",
"trackingCode": "…",
"carrierId": 1,
"carrier": "…",
"type": "…",
"state": "…"
@@ -74,6 +75,7 @@ Updated order
"manifestId": 1,
"number": "…",
"trackingCode": "…",
"carrierId": 1,
"carrier": "…",
"type": "…",
"state": "…"
@@ -132,6 +134,7 @@ Updated order
"manifestId": 1,
"number": "…",
"trackingCode": "…",
"carrierId": 1,
"carrier": "…",
"type": "…",
"state": "…"

View File

@@ -82,6 +82,7 @@ Created order
"manifestId": 1,
"number": "…",
"trackingCode": "…",
"carrierId": 1,
"carrier": "…",
"type": "…",
"state": "…"
@@ -92,6 +93,7 @@ Created order
"manifestId": 1,
"number": "…",
"trackingCode": "…",
"carrierId": 1,
"carrier": "…",
"type": "…",
"state": "…"
@@ -150,6 +152,7 @@ Created order
"manifestId": 1,
"number": "…",
"trackingCode": "…",
"carrierId": 1,
"carrier": "…",
"type": "…",
"state": "…"

View File

@@ -47,6 +47,7 @@ Shipment details
"manifestId": 1,
"number": "…",
"trackingCode": "…",
"carrierId": 1,
"carrier": "…",
"type": "…",
"state": "…"

View File

@@ -65,6 +65,7 @@ Updated shipment
"manifestId": 1,
"number": "…",
"trackingCode": "…",
"carrierId": 1,
"carrier": "…",
"type": "…",
"state": "…"

View File

@@ -24,6 +24,7 @@ List of packages
"manifestId": 1,
"number": "…",
"trackingCode": "…",
"carrierId": 1,
"carrier": "…",
"type": "…",
"state": "…"

View File

@@ -19,18 +19,18 @@ deducts stock for the shipment's lines via ledger movements.
| Field | Required | Type | Description |
|-------|----------|------|-------------|
| `carrierId` | yes | integer | Carrier ID |
| `type` | yes | string | |
| `state` | yes | string | |
| `trackingCode` | no | string | Carrier parcel tracking code |
| `carrier` | no | string | Carrier name (e.g. DHL, UPS, DPD) |
| `warehouseId` | no | integer | Optional warehouse ID for stock deduction when state is shipped |
```json
{
"carrierId": 1,
"type": "…",
"state": "…",
"trackingCode": "…",
"carrier": "…",
"warehouseId": 1
}
```
@@ -46,6 +46,7 @@ Created package
"manifestId": 1,
"number": "…",
"trackingCode": "…",
"carrierId": 1,
"carrier": "…",
"type": "…",
"state": "…"

View File

@@ -21,7 +21,7 @@ via ledger and article history is written. Once shipped, it cannot be undone.
| `type` | no | string | |
| `state` | no | string | |
| `trackingCode` | no | string | Carrier parcel tracking code |
| `carrier` | no | string | Carrier name (e.g. DHL, UPS, DPD) |
| `carrierId` | no | integer | Carrier ID |
| `warehouseId` | no | integer | Warehouse ID for stock deduction when transitioning to shipped |
```json
@@ -29,7 +29,7 @@ via ledger and article history is written. Once shipped, it cannot be undone.
"type": "…",
"state": "…",
"trackingCode": "…",
"carrier": "…",
"carrierId": 1,
"warehouseId": 1
}
```
@@ -45,6 +45,7 @@ Updated shipping
"manifestId": 1,
"number": "…",
"trackingCode": "…",
"carrierId": 1,
"carrier": "…",
"type": "…",
"state": "…"