u
This commit is contained in:
71
docs/api/routes/order/_id/shipment.get.md
Normal file
71
docs/api/routes/order/_id/shipment.get.md
Normal file
@@ -0,0 +1,71 @@
|
||||
# `GET /order/{id}/shipment`
|
||||
|
||||
Protected. Requires a valid session cookie (`credentials: 'include'`).
|
||||
|
||||
List shipments of an order
|
||||
|
||||
Lists all shipment manifests belonging to the specified order.
|
||||
|
||||
## Path parameters
|
||||
|
||||
| Param | Required | Type | Description |
|
||||
|-------|----------|------|-------------|
|
||||
| `id` | yes | integer | Order ID |
|
||||
|
||||
## Response `200`
|
||||
|
||||
List of shipments
|
||||
|
||||
```json
|
||||
{
|
||||
"shipments": [
|
||||
{
|
||||
"id": 1,
|
||||
"number": "…",
|
||||
"type": "shipment",
|
||||
"entityId": 1,
|
||||
"externalNumber": "…",
|
||||
"date": "…",
|
||||
"createdAt": "…",
|
||||
"lineCount": 1,
|
||||
"packageCount": 1,
|
||||
"lines": [
|
||||
{
|
||||
"id": 1,
|
||||
"sku": "…",
|
||||
"name": "…",
|
||||
"pu": 1,
|
||||
"amount": 1,
|
||||
"net": 1,
|
||||
"rebate": 1,
|
||||
"taxrate": 1,
|
||||
"comment": "…"
|
||||
}
|
||||
],
|
||||
"shippings": [
|
||||
{
|
||||
"id": 1,
|
||||
"manifestId": 1,
|
||||
"number": "…",
|
||||
"trackingCode": "…",
|
||||
"carrier": "…",
|
||||
"type": "…",
|
||||
"state": "…"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
## Errors
|
||||
|
||||
| Status | Description |
|
||||
|--------|-------------|
|
||||
| 400 | Invalid ID or no company selected — `{"error":"…"}` |
|
||||
| 401 | Unauthorized — `{"error":"…"}` |
|
||||
| 404 | Order not found — `{"error":"…"}` |
|
||||
|
||||
---
|
||||
|
||||
_Generated from `@openapi` JSDoc. Do not edit by hand — run `npm run docs:api`._
|
||||
108
docs/api/routes/order/_id/shipment.post.md
Normal file
108
docs/api/routes/order/_id/shipment.post.md
Normal file
@@ -0,0 +1,108 @@
|
||||
# `POST /order/{id}/shipment`
|
||||
|
||||
Protected. Requires a valid session cookie (`credentials: 'include'`).
|
||||
|
||||
Create shipment for an order
|
||||
|
||||
Creates a new partial or full shipment manifest for the order.
|
||||
Validates that article positions belong to the order and cumulative shipped quantities
|
||||
do not exceed ordered quantities.
|
||||
|
||||
|
||||
## Path parameters
|
||||
|
||||
| Param | Required | Type | Description |
|
||||
|-------|----------|------|-------------|
|
||||
| `id` | yes | integer | Order ID |
|
||||
|
||||
## Body (JSON)
|
||||
|
||||
| Field | Required | Type | Description |
|
||||
|-------|----------|------|-------------|
|
||||
| `date` | no | string | |
|
||||
| `externalNumber` | no | string | |
|
||||
| `lines` | yes | object[] | |
|
||||
| `lines[].sku` | yes | string | |
|
||||
| `lines[].amount` | yes | number | |
|
||||
| `lines[].name` | no | string | |
|
||||
| `lines[].pu` | no | number | |
|
||||
| `lines[].net` | no | number | |
|
||||
| `lines[].rebate` | no | number | |
|
||||
| `lines[].taxrate` | no | number | |
|
||||
| `lines[].comment` | no | string | |
|
||||
|
||||
```json
|
||||
{
|
||||
"date": "2026-08-10",
|
||||
"externalNumber": "…",
|
||||
"lines": [
|
||||
{
|
||||
"sku": "…",
|
||||
"amount": 1,
|
||||
"name": "…",
|
||||
"pu": 1,
|
||||
"net": 1,
|
||||
"rebate": 1,
|
||||
"taxrate": 1,
|
||||
"comment": "…"
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
## Response `201`
|
||||
|
||||
Created shipment
|
||||
|
||||
```json
|
||||
{
|
||||
"shipment": {
|
||||
"id": 1,
|
||||
"number": "…",
|
||||
"type": "shipment",
|
||||
"entityId": 1,
|
||||
"externalNumber": "…",
|
||||
"date": "…",
|
||||
"createdAt": "…",
|
||||
"lineCount": 1,
|
||||
"packageCount": 1,
|
||||
"lines": [
|
||||
{
|
||||
"id": 1,
|
||||
"sku": "…",
|
||||
"name": "…",
|
||||
"pu": 1,
|
||||
"amount": 1,
|
||||
"net": 1,
|
||||
"rebate": 1,
|
||||
"taxrate": 1,
|
||||
"comment": "…"
|
||||
}
|
||||
],
|
||||
"shippings": [
|
||||
{
|
||||
"id": 1,
|
||||
"manifestId": 1,
|
||||
"number": "…",
|
||||
"trackingCode": "…",
|
||||
"carrier": "…",
|
||||
"type": "…",
|
||||
"state": "…"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Errors
|
||||
|
||||
| Status | Description |
|
||||
|--------|-------------|
|
||||
| 400 | Validation error or article not in order — `{"error":"…"}` |
|
||||
| 401 | Unauthorized — `{"error":"…"}` |
|
||||
| 404 | Order not found — `{"error":"…"}` |
|
||||
| 409 | Cumulative shipment amount exceeds ordered amount — `{"error":"…"}` |
|
||||
|
||||
---
|
||||
|
||||
_Generated from `@openapi` JSDoc. Do not edit by hand — run `npm run docs:api`._
|
||||
@@ -23,6 +23,8 @@ List of shippings
|
||||
"id": 1,
|
||||
"manifestId": 1,
|
||||
"number": "…",
|
||||
"trackingCode": "…",
|
||||
"carrier": "…",
|
||||
"type": "…",
|
||||
"state": "…"
|
||||
}
|
||||
|
||||
@@ -41,6 +41,8 @@ Created shipping
|
||||
"id": 1,
|
||||
"manifestId": 1,
|
||||
"number": "…",
|
||||
"trackingCode": "…",
|
||||
"carrier": "…",
|
||||
"type": "…",
|
||||
"state": "…"
|
||||
}
|
||||
|
||||
@@ -67,6 +67,8 @@ Created order
|
||||
"id": 1,
|
||||
"manifestId": 1,
|
||||
"number": "…",
|
||||
"trackingCode": "…",
|
||||
"carrier": "…",
|
||||
"type": "…",
|
||||
"state": "…"
|
||||
},
|
||||
@@ -75,6 +77,8 @@ Created order
|
||||
"id": 1,
|
||||
"manifestId": 1,
|
||||
"number": "…",
|
||||
"trackingCode": "…",
|
||||
"carrier": "…",
|
||||
"type": "…",
|
||||
"state": "…"
|
||||
}
|
||||
@@ -96,7 +100,49 @@ Created order
|
||||
}
|
||||
],
|
||||
"paid": true,
|
||||
"delivered": true
|
||||
"shipped": true,
|
||||
"delivered": true,
|
||||
"orderTotal": 1,
|
||||
"paidTotal": 1,
|
||||
"orderedQuantity": 1,
|
||||
"shippedQuantity": 1,
|
||||
"shipments": [
|
||||
{
|
||||
"id": 1,
|
||||
"number": "…",
|
||||
"type": "shipment",
|
||||
"entityId": 1,
|
||||
"externalNumber": "…",
|
||||
"date": "…",
|
||||
"createdAt": "…",
|
||||
"lineCount": 1,
|
||||
"packageCount": 1,
|
||||
"lines": [
|
||||
{
|
||||
"id": 1,
|
||||
"sku": "…",
|
||||
"name": "…",
|
||||
"pu": 1,
|
||||
"amount": 1,
|
||||
"net": 1,
|
||||
"rebate": 1,
|
||||
"taxrate": 1,
|
||||
"comment": "…"
|
||||
}
|
||||
],
|
||||
"shippings": [
|
||||
{
|
||||
"id": 1,
|
||||
"manifestId": 1,
|
||||
"number": "…",
|
||||
"trackingCode": "…",
|
||||
"carrier": "…",
|
||||
"type": "…",
|
||||
"state": "…"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
@@ -42,6 +42,8 @@ Order
|
||||
"id": 1,
|
||||
"manifestId": 1,
|
||||
"number": "…",
|
||||
"trackingCode": "…",
|
||||
"carrier": "…",
|
||||
"type": "…",
|
||||
"state": "…"
|
||||
},
|
||||
@@ -50,6 +52,8 @@ Order
|
||||
"id": 1,
|
||||
"manifestId": 1,
|
||||
"number": "…",
|
||||
"trackingCode": "…",
|
||||
"carrier": "…",
|
||||
"type": "…",
|
||||
"state": "…"
|
||||
}
|
||||
@@ -71,7 +75,49 @@ Order
|
||||
}
|
||||
],
|
||||
"paid": true,
|
||||
"delivered": true
|
||||
"shipped": true,
|
||||
"delivered": true,
|
||||
"orderTotal": 1,
|
||||
"paidTotal": 1,
|
||||
"orderedQuantity": 1,
|
||||
"shippedQuantity": 1,
|
||||
"shipments": [
|
||||
{
|
||||
"id": 1,
|
||||
"number": "…",
|
||||
"type": "shipment",
|
||||
"entityId": 1,
|
||||
"externalNumber": "…",
|
||||
"date": "…",
|
||||
"createdAt": "…",
|
||||
"lineCount": 1,
|
||||
"packageCount": 1,
|
||||
"lines": [
|
||||
{
|
||||
"id": 1,
|
||||
"sku": "…",
|
||||
"name": "…",
|
||||
"pu": 1,
|
||||
"amount": 1,
|
||||
"net": 1,
|
||||
"rebate": 1,
|
||||
"taxrate": 1,
|
||||
"comment": "…"
|
||||
}
|
||||
],
|
||||
"shippings": [
|
||||
{
|
||||
"id": 1,
|
||||
"manifestId": 1,
|
||||
"number": "…",
|
||||
"trackingCode": "…",
|
||||
"carrier": "…",
|
||||
"type": "…",
|
||||
"state": "…"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
@@ -47,6 +47,8 @@ Order list
|
||||
"id": 1,
|
||||
"manifestId": 1,
|
||||
"number": "…",
|
||||
"trackingCode": "…",
|
||||
"carrier": "…",
|
||||
"type": "…",
|
||||
"state": "…"
|
||||
},
|
||||
@@ -55,6 +57,8 @@ Order list
|
||||
"id": 1,
|
||||
"manifestId": 1,
|
||||
"number": "…",
|
||||
"trackingCode": "…",
|
||||
"carrier": "…",
|
||||
"type": "…",
|
||||
"state": "…"
|
||||
}
|
||||
@@ -76,7 +80,49 @@ Order list
|
||||
}
|
||||
],
|
||||
"paid": true,
|
||||
"delivered": true
|
||||
"shipped": true,
|
||||
"delivered": true,
|
||||
"orderTotal": 1,
|
||||
"paidTotal": 1,
|
||||
"orderedQuantity": 1,
|
||||
"shippedQuantity": 1,
|
||||
"shipments": [
|
||||
{
|
||||
"id": 1,
|
||||
"number": "…",
|
||||
"type": "shipment",
|
||||
"entityId": 1,
|
||||
"externalNumber": "…",
|
||||
"date": "…",
|
||||
"createdAt": "…",
|
||||
"lineCount": 1,
|
||||
"packageCount": 1,
|
||||
"lines": [
|
||||
{
|
||||
"id": 1,
|
||||
"sku": "…",
|
||||
"name": "…",
|
||||
"pu": 1,
|
||||
"amount": 1,
|
||||
"net": 1,
|
||||
"rebate": 1,
|
||||
"taxrate": 1,
|
||||
"comment": "…"
|
||||
}
|
||||
],
|
||||
"shippings": [
|
||||
{
|
||||
"id": 1,
|
||||
"manifestId": 1,
|
||||
"number": "…",
|
||||
"trackingCode": "…",
|
||||
"carrier": "…",
|
||||
"type": "…",
|
||||
"state": "…"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"total": 1,
|
||||
|
||||
@@ -61,6 +61,8 @@ Updated order
|
||||
"id": 1,
|
||||
"manifestId": 1,
|
||||
"number": "…",
|
||||
"trackingCode": "…",
|
||||
"carrier": "…",
|
||||
"type": "…",
|
||||
"state": "…"
|
||||
},
|
||||
@@ -69,6 +71,8 @@ Updated order
|
||||
"id": 1,
|
||||
"manifestId": 1,
|
||||
"number": "…",
|
||||
"trackingCode": "…",
|
||||
"carrier": "…",
|
||||
"type": "…",
|
||||
"state": "…"
|
||||
}
|
||||
@@ -90,7 +94,49 @@ Updated order
|
||||
}
|
||||
],
|
||||
"paid": true,
|
||||
"delivered": true
|
||||
"shipped": true,
|
||||
"delivered": true,
|
||||
"orderTotal": 1,
|
||||
"paidTotal": 1,
|
||||
"orderedQuantity": 1,
|
||||
"shippedQuantity": 1,
|
||||
"shipments": [
|
||||
{
|
||||
"id": 1,
|
||||
"number": "…",
|
||||
"type": "shipment",
|
||||
"entityId": 1,
|
||||
"externalNumber": "…",
|
||||
"date": "…",
|
||||
"createdAt": "…",
|
||||
"lineCount": 1,
|
||||
"packageCount": 1,
|
||||
"lines": [
|
||||
{
|
||||
"id": 1,
|
||||
"sku": "…",
|
||||
"name": "…",
|
||||
"pu": 1,
|
||||
"amount": 1,
|
||||
"net": 1,
|
||||
"rebate": 1,
|
||||
"taxrate": 1,
|
||||
"comment": "…"
|
||||
}
|
||||
],
|
||||
"shippings": [
|
||||
{
|
||||
"id": 1,
|
||||
"manifestId": 1,
|
||||
"number": "…",
|
||||
"trackingCode": "…",
|
||||
"carrier": "…",
|
||||
"type": "…",
|
||||
"state": "…"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
32
docs/api/routes/shipment/_id.delete.md
Normal file
32
docs/api/routes/shipment/_id.delete.md
Normal file
@@ -0,0 +1,32 @@
|
||||
# `DELETE /shipment/{id}`
|
||||
|
||||
Protected. Requires a valid session cookie (`credentials: 'include'`).
|
||||
|
||||
Delete shipment
|
||||
|
||||
Deletes an unshipped shipment manifest. Shipped shipments cannot be deleted.
|
||||
|
||||
## Path parameters
|
||||
|
||||
| Param | Required | Type | Description |
|
||||
|-------|----------|------|-------------|
|
||||
| `id` | yes | integer | Shipment ID |
|
||||
|
||||
## Response `204`
|
||||
|
||||
Shipment deleted
|
||||
|
||||
_No content_
|
||||
|
||||
## Errors
|
||||
|
||||
| Status | Description |
|
||||
|--------|-------------|
|
||||
| 400 | Invalid ID or no company selected — `{"error":"…"}` |
|
||||
| 401 | Unauthorized — `{"error":"…"}` |
|
||||
| 404 | Shipment not found — `{"error":"…"}` |
|
||||
| 409 | Shipped shipment cannot be deleted — `{"error":"…"}` |
|
||||
|
||||
---
|
||||
|
||||
_Generated from `@openapi` JSDoc. Do not edit by hand — run `npm run docs:api`._
|
||||
69
docs/api/routes/shipment/_id.get.md
Normal file
69
docs/api/routes/shipment/_id.get.md
Normal file
@@ -0,0 +1,69 @@
|
||||
# `GET /shipment/{id}`
|
||||
|
||||
Protected. Requires a valid session cookie (`credentials: 'include'`).
|
||||
|
||||
Get shipment by ID
|
||||
|
||||
Retrieves shipment header, article positions, and attached packages.
|
||||
|
||||
## Path parameters
|
||||
|
||||
| Param | Required | Type | Description |
|
||||
|-------|----------|------|-------------|
|
||||
| `id` | yes | integer | Shipment ID |
|
||||
|
||||
## Response `200`
|
||||
|
||||
Shipment details
|
||||
|
||||
```json
|
||||
{
|
||||
"shipment": {
|
||||
"id": 1,
|
||||
"number": "…",
|
||||
"type": "shipment",
|
||||
"entityId": 1,
|
||||
"externalNumber": "…",
|
||||
"date": "…",
|
||||
"createdAt": "…",
|
||||
"lineCount": 1,
|
||||
"packageCount": 1,
|
||||
"lines": [
|
||||
{
|
||||
"id": 1,
|
||||
"sku": "…",
|
||||
"name": "…",
|
||||
"pu": 1,
|
||||
"amount": 1,
|
||||
"net": 1,
|
||||
"rebate": 1,
|
||||
"taxrate": 1,
|
||||
"comment": "…"
|
||||
}
|
||||
],
|
||||
"shippings": [
|
||||
{
|
||||
"id": 1,
|
||||
"manifestId": 1,
|
||||
"number": "…",
|
||||
"trackingCode": "…",
|
||||
"carrier": "…",
|
||||
"type": "…",
|
||||
"state": "…"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Errors
|
||||
|
||||
| Status | Description |
|
||||
|--------|-------------|
|
||||
| 400 | Invalid ID or no company selected — `{"error":"…"}` |
|
||||
| 401 | Unauthorized — `{"error":"…"}` |
|
||||
| 404 | Shipment not found — `{"error":"…"}` |
|
||||
|
||||
---
|
||||
|
||||
_Generated from `@openapi` JSDoc. Do not edit by hand — run `npm run docs:api`._
|
||||
45
docs/api/routes/shipment/_id/shipping.get.md
Normal file
45
docs/api/routes/shipment/_id/shipping.get.md
Normal file
@@ -0,0 +1,45 @@
|
||||
# `GET /shipment/{id}/shipping`
|
||||
|
||||
Protected. Requires a valid session cookie (`credentials: 'include'`).
|
||||
|
||||
List packages of a shipment
|
||||
|
||||
Lists all packages (shippings) belonging to the specified shipment manifest.
|
||||
|
||||
## Path parameters
|
||||
|
||||
| Param | Required | Type | Description |
|
||||
|-------|----------|------|-------------|
|
||||
| `id` | yes | integer | Shipment ID |
|
||||
|
||||
## Response `200`
|
||||
|
||||
List of packages
|
||||
|
||||
```json
|
||||
{
|
||||
"shippings": [
|
||||
{
|
||||
"id": 1,
|
||||
"manifestId": 1,
|
||||
"number": "…",
|
||||
"trackingCode": "…",
|
||||
"carrier": "…",
|
||||
"type": "…",
|
||||
"state": "…"
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
## Errors
|
||||
|
||||
| Status | Description |
|
||||
|--------|-------------|
|
||||
| 400 | Invalid ID or no company selected — `{"error":"…"}` |
|
||||
| 401 | Unauthorized — `{"error":"…"}` |
|
||||
| 404 | Shipment not found — `{"error":"…"}` |
|
||||
|
||||
---
|
||||
|
||||
_Generated from `@openapi` JSDoc. Do not edit by hand — run `npm run docs:api`._
|
||||
66
docs/api/routes/shipment/_id/shipping.post.md
Normal file
66
docs/api/routes/shipment/_id/shipping.post.md
Normal file
@@ -0,0 +1,66 @@
|
||||
# `POST /shipment/{id}/shipping`
|
||||
|
||||
Protected. Requires a valid session cookie (`credentials: 'include'`).
|
||||
|
||||
Create package for a shipment
|
||||
|
||||
Creates a physical package (shipping) for the shipment manifest.
|
||||
Accepts carrier and parcel tracking code. If state is `shipped`,
|
||||
deducts stock for the shipment's lines via ledger movements.
|
||||
|
||||
|
||||
## Path parameters
|
||||
|
||||
| Param | Required | Type | Description |
|
||||
|-------|----------|------|-------------|
|
||||
| `id` | yes | integer | Shipment ID |
|
||||
|
||||
## Body (JSON)
|
||||
|
||||
| Field | Required | Type | Description |
|
||||
|-------|----------|------|-------------|
|
||||
| `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
|
||||
{
|
||||
"type": "…",
|
||||
"state": "…",
|
||||
"trackingCode": "…",
|
||||
"carrier": "…",
|
||||
"warehouseId": 1
|
||||
}
|
||||
```
|
||||
|
||||
## Response `201`
|
||||
|
||||
Created package
|
||||
|
||||
```json
|
||||
{
|
||||
"shipping": {
|
||||
"id": 1,
|
||||
"manifestId": 1,
|
||||
"number": "…",
|
||||
"trackingCode": "…",
|
||||
"carrier": "…",
|
||||
"type": "…",
|
||||
"state": "…"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Errors
|
||||
|
||||
| Status | Description |
|
||||
|--------|-------------|
|
||||
| 400 | Validation error, manifest is not a shipment, or no company selected — `{"error":"…"}` |
|
||||
| 401 | Unauthorized — `{"error":"…"}` |
|
||||
| 404 | Shipment or warehouse not found — `{"error":"…"}` |
|
||||
|
||||
---
|
||||
|
||||
_Generated from `@openapi` JSDoc. Do not edit by hand — run `npm run docs:api`._
|
||||
@@ -20,12 +20,16 @@ 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) |
|
||||
| `warehouseId` | no | integer | Warehouse ID for stock deduction when transitioning to shipped |
|
||||
|
||||
```json
|
||||
{
|
||||
"type": "…",
|
||||
"state": "…",
|
||||
"trackingCode": "…",
|
||||
"carrier": "…",
|
||||
"warehouseId": 1
|
||||
}
|
||||
```
|
||||
@@ -40,6 +44,8 @@ Updated shipping
|
||||
"id": 1,
|
||||
"manifestId": 1,
|
||||
"number": "…",
|
||||
"trackingCode": "…",
|
||||
"carrier": "…",
|
||||
"type": "…",
|
||||
"state": "…"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user