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 @@
# `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`._