Add delivery and supplier HTTP APIs with expanded response docs.

Wire store-backed CRUD for goods receipts and suppliers, and teach the API doc generator to expand $ref/allOf/array samples so route markdown shows full JSON shapes.
This commit is contained in:
seb
2026-08-06 05:32:48 +02:00
parent a748bd5f5c
commit 1860f38640
52 changed files with 2515 additions and 66 deletions

View File

@@ -65,6 +65,11 @@ Generated from `@openapi` annotations in [`src/api/routes/`](../../src/api/route
| [`routes/company/create.md`](routes/company/create.md) | `POST /company` |
| [`routes/company/delete.md`](routes/company/delete.md) | `DELETE /company/{id}` |
| [`routes/company/update.md`](routes/company/update.md) | `PUT /company/{id}` |
| [`routes/delivery/list.md`](routes/delivery/list.md) | `GET /delivery` |
| [`routes/delivery/create.md`](routes/delivery/create.md) | `POST /delivery` |
| [`routes/delivery/delete.md`](routes/delivery/delete.md) | `DELETE /delivery/{id}` |
| [`routes/delivery/get.md`](routes/delivery/get.md) | `GET /delivery/{id}` |
| [`routes/delivery/update.md`](routes/delivery/update.md) | `PATCH /delivery/{id}` |
| [`routes/events.md`](routes/events.md) | `GET /events` |
| [`routes/health.md`](routes/health.md) | `GET /health` |
| [`routes/image/get.md`](routes/image/get.md) | `GET /image/{fullHash}` |
@@ -75,6 +80,10 @@ Generated from `@openapi` annotations in [`src/api/routes/`](../../src/api/route
| [`routes/posterminal/setOnAll.md`](routes/posterminal/setOnAll.md) | `PUT /posterminal/{id}/all` |
| [`routes/posterminal/setOff.md`](routes/posterminal/setOff.md) | `DELETE /posterminal/{id}/category/{categoryId}` |
| [`routes/posterminal/setOn.md`](routes/posterminal/setOn.md) | `PUT /posterminal/{id}/category/{categoryId}` |
| [`routes/supplier/list.md`](routes/supplier/list.md) | `GET /supplier` |
| [`routes/supplier/create.md`](routes/supplier/create.md) | `POST /supplier` |
| [`routes/supplier/delete.md`](routes/supplier/delete.md) | `DELETE /supplier/{id}` |
| [`routes/supplier/update.md`](routes/supplier/update.md) | `PATCH /supplier/{id}` |
| [`routes/thumb/get.md`](routes/thumb/get.md) | `GET /thumb/{fullHash}` |
| [`routes/unit/delete.md`](routes/unit/delete.md) | `DELETE /unit` |
| [`routes/unit/list.md`](routes/unit/list.md) | `GET /unit` |

View File

@@ -44,9 +44,21 @@
"name": "Brand",
"description": "Company-scoped brands"
},
{
"name": "Supplier",
"description": "Company-scoped suppliers (Lieferanten)"
},
{
"name": "Delivery",
"description": "Company-scoped goods receipts (Lieferungen)"
},
{
"name": "Image",
"description": "Content-addressed AVIF by fullHash"
},
{
"name": "Posterminal",
"description": "Company-scoped POS terminals"
}
],
"paths": {
@@ -314,6 +326,343 @@
}
}
},
"/supplier": {
"get": {
"tags": [
"Supplier"
],
"summary": "List suppliers",
"description": "Lists suppliers (`entity` rows in the company `Lieferanten` customergroup)\nfor the authenticated user's selected company.\n",
"security": [
{
"cookieAuth": []
}
],
"x-markdown": "supplier/list.md",
"responses": {
"200": {
"description": "Supplier list",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"suppliers": {
"type": "array",
"items": {
"$ref": "#/components/schemas/Supplier"
}
}
}
}
}
}
},
"400": {
"description": "No company selected",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
},
"401": {
"description": "Unauthorized",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
},
"403": {
"description": "Not authorized",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
},
"404": {
"description": "Company not found",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
}
}
},
"post": {
"tags": [
"Supplier"
],
"summary": "Create supplier",
"description": "Creates a supplier in the company `Lieferanten` group (created on first use).\n",
"security": [
{
"cookieAuth": []
}
],
"x-markdown": "supplier/create.md",
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"type": "object",
"required": [
"name"
],
"properties": {
"name": {
"type": "string"
}
},
"example": {
"name": "Großhandel Müller"
}
}
}
}
},
"responses": {
"201": {
"description": "Created supplier",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"supplier": {
"$ref": "#/components/schemas/Supplier"
}
}
}
}
}
},
"400": {
"description": "Name required or no company selected",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
},
"401": {
"description": "Unauthorized",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
},
"403": {
"description": "Not authorized",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
},
"404": {
"description": "Company not found",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
}
}
}
},
"/supplier/{id}": {
"patch": {
"tags": [
"Supplier"
],
"summary": "Update supplier",
"description": "Renames a supplier for the selected company.",
"security": [
{
"cookieAuth": []
}
],
"x-markdown": "supplier/update.md",
"parameters": [
{
"in": "path",
"name": "id",
"required": true,
"schema": {
"type": "integer"
}
}
],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"type": "object",
"required": [
"name"
],
"properties": {
"name": {
"type": "string"
}
},
"example": {
"name": "Großhandel Müller GmbH"
}
}
}
}
},
"responses": {
"200": {
"description": "Updated supplier",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"supplier": {
"$ref": "#/components/schemas/Supplier"
}
}
}
}
}
},
"400": {
"description": "Name required, invalid id, or no company selected",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
},
"401": {
"description": "Unauthorized",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
},
"403": {
"description": "Not authorized",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
},
"404": {
"description": "Supplier or company not found",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
}
}
},
"delete": {
"tags": [
"Supplier"
],
"summary": "Delete supplier",
"description": "Deletes the supplier entity for the selected company.\nRelated `entityhistory` cascades; `manifest.entity_id` is set null.\n",
"security": [
{
"cookieAuth": []
}
],
"x-markdown": "supplier/delete.md",
"parameters": [
{
"in": "path",
"name": "id",
"required": true,
"schema": {
"type": "integer"
}
}
],
"responses": {
"204": {
"description": "Deleted"
},
"400": {
"description": "No company selected or invalid id",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
},
"401": {
"description": "Unauthorized",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
},
"403": {
"description": "Not authorized",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
},
"404": {
"description": "Supplier not found",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
}
}
}
},
"/posterminal": {
"get": {
"tags": [
@@ -1202,6 +1551,461 @@
}
}
},
"/delivery": {
"get": {
"tags": [
"Delivery"
],
"summary": "List deliveries",
"description": "Lists goods receipts (`manifest` rows with `type = 'delivery'`)\nfor the authenticated user's selected company.\n",
"security": [
{
"cookieAuth": []
}
],
"x-markdown": "delivery/list.md",
"responses": {
"200": {
"description": "Delivery list",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"deliveries": {
"type": "array",
"items": {
"$ref": "#/components/schemas/DeliverySummary"
}
}
}
}
}
}
},
"400": {
"description": "No company selected",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
},
"401": {
"description": "Unauthorized",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
},
"403": {
"description": "Not authorized",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
},
"404": {
"description": "Company not found",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
}
}
},
"post": {
"tags": [
"Delivery"
],
"summary": "Create delivery",
"description": "Creates a goods receipt with header and lines in one transaction.\nEach line requires `sku`, `amount`, `net`, and `tax` (rate).\n`rebate` defaults to `0`; `transactedAmount` defaults to `amount`.\n",
"security": [
{
"cookieAuth": []
}
],
"x-markdown": "delivery/create.md",
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"type": "object",
"required": [
"number",
"date",
"lines"
],
"properties": {
"number": {
"type": "string"
},
"date": {
"type": "string",
"format": "date-time"
},
"supplierId": {
"type": "integer",
"nullable": true
},
"lines": {
"type": "array",
"items": {
"$ref": "#/components/schemas/DeliveryLineInput"
}
}
},
"example": {
"number": "DHL-123",
"date": "2026-08-10",
"supplierId": 1,
"lines": [
{
"sku": "1",
"amount": 10,
"net": 99.5,
"tax": 19
}
]
}
}
}
}
},
"responses": {
"201": {
"description": "Created delivery",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"delivery": {
"$ref": "#/components/schemas/Delivery"
}
}
}
}
}
},
"400": {
"description": "Invalid delivery, invalid lines, or no company selected",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
},
"401": {
"description": "Unauthorized",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
},
"403": {
"description": "Not authorized",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
},
"404": {
"description": "Company, supplier, or article not found",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
}
}
}
},
"/delivery/{id}": {
"get": {
"tags": [
"Delivery"
],
"summary": "Get delivery",
"description": "Returns a goods receipt with lines for the selected company.",
"security": [
{
"cookieAuth": []
}
],
"x-markdown": "delivery/get.md",
"parameters": [
{
"in": "path",
"name": "id",
"required": true,
"schema": {
"type": "integer"
}
}
],
"responses": {
"200": {
"description": "Delivery",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"delivery": {
"$ref": "#/components/schemas/Delivery"
}
}
}
}
}
},
"400": {
"description": "No company selected or invalid id",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
},
"401": {
"description": "Unauthorized",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
},
"403": {
"description": "Not authorized",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
},
"404": {
"description": "Delivery or company not found",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
}
}
},
"patch": {
"tags": [
"Delivery"
],
"summary": "Update delivery",
"description": "Patches header fields that are present. If `lines` is present, replaces\nall lines; if omitted, leaves lines unchanged. Returns the full delivery.\n",
"security": [
{
"cookieAuth": []
}
],
"x-markdown": "delivery/update.md",
"parameters": [
{
"in": "path",
"name": "id",
"required": true,
"schema": {
"type": "integer"
}
}
],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"number": {
"type": "string"
},
"date": {
"type": "string",
"format": "date-time"
},
"supplierId": {
"type": "integer",
"nullable": true
},
"lines": {
"type": "array",
"items": {
"$ref": "#/components/schemas/DeliveryLineInput"
}
}
},
"example": {
"number": "DHL-124",
"lines": []
}
}
}
}
},
"responses": {
"200": {
"description": "Updated delivery",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"delivery": {
"$ref": "#/components/schemas/Delivery"
}
}
}
}
}
},
"400": {
"description": "Invalid delivery, invalid lines, invalid id, or no company selected",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
},
"401": {
"description": "Unauthorized",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
},
"403": {
"description": "Not authorized",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
},
"404": {
"description": "Delivery, supplier, article, or company not found",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
}
}
},
"delete": {
"tags": [
"Delivery"
],
"summary": "Delete delivery",
"description": "Deletes the goods receipt (`manifestarticle` rows cascade).\n",
"security": [
{
"cookieAuth": []
}
],
"x-markdown": "delivery/delete.md",
"parameters": [
{
"in": "path",
"name": "id",
"required": true,
"schema": {
"type": "integer"
}
}
],
"responses": {
"204": {
"description": "Deleted"
},
"400": {
"description": "No company selected or invalid id",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
},
"401": {
"description": "Unauthorized",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
},
"403": {
"description": "Not authorized",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
},
"404": {
"description": "Delivery not found",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
}
}
}
},
"/company": {
"get": {
"tags": [
@@ -4564,6 +5368,168 @@
}
}
},
"Supplier": {
"type": "object",
"required": [
"id",
"name",
"createdAt",
"updatedAt"
],
"properties": {
"id": {
"type": "integer"
},
"name": {
"type": "string"
},
"createdAt": {
"type": "string",
"format": "date-time"
},
"updatedAt": {
"type": "string",
"format": "date-time"
}
}
},
"DeliverySummary": {
"type": "object",
"required": [
"id",
"number",
"type",
"supplierId",
"date"
],
"properties": {
"id": {
"type": "integer"
},
"number": {
"type": "string"
},
"type": {
"type": "string",
"enum": [
"delivery"
]
},
"supplierId": {
"type": "integer",
"nullable": true,
"description": "manifest.entity_id"
},
"date": {
"type": "string",
"format": "date-time"
}
}
},
"DeliveryLine": {
"type": "object",
"required": [
"id",
"articleId",
"sku",
"amount",
"net",
"transactedAmount",
"rebate",
"tax",
"comment"
],
"properties": {
"id": {
"type": "integer"
},
"articleId": {
"type": "integer",
"nullable": true
},
"sku": {
"type": "string",
"nullable": true
},
"amount": {
"type": "number"
},
"net": {
"type": "number"
},
"transactedAmount": {
"type": "number"
},
"rebate": {
"type": "number"
},
"tax": {
"type": "number",
"description": "tax.rate"
},
"comment": {
"type": "string",
"nullable": true
}
}
},
"DeliveryLineInput": {
"type": "object",
"required": [
"sku",
"amount",
"net",
"tax"
],
"properties": {
"sku": {
"type": "string"
},
"amount": {
"type": "number"
},
"net": {
"type": "number"
},
"tax": {
"type": "number",
"description": "Tax rate (resolved via tax.ensure)"
},
"rebate": {
"type": "number",
"description": "Defaults to 0"
},
"transactedAmount": {
"type": "number",
"description": "Defaults to amount"
},
"comment": {
"type": "string",
"nullable": true
}
}
},
"Delivery": {
"allOf": [
{
"$ref": "#/components/schemas/DeliverySummary"
},
{
"type": "object",
"required": [
"lines"
],
"properties": {
"lines": {
"type": "array",
"items": {
"$ref": "#/components/schemas/DeliveryLine"
}
}
}
}
]
},
"ArticleImage": {
"type": "object",
"required": [

View File

@@ -30,7 +30,21 @@ Image stored and linked
```json
{
"image": { … }
"image": {
"picId": 1,
"sort": 1,
"full": {
"w": 1,
"h": 1,
"size": 1
},
"thumb": {
"w": 1,
"h": 1
},
"hash": "…",
"thumbHash": "…"
}
}
```

View File

@@ -25,7 +25,12 @@ Created
```json
{
"article": { … }
"article": {
"id": 1,
"parentId": 1,
"name": "…",
"sku": "…"
}
}
```

View File

@@ -18,7 +18,7 @@ Article detail
```json
{
"article": { … }
"article": {}
}
```

View File

@@ -35,7 +35,9 @@ New order
```json
{
"fullHashes": []
"fullHashes": [
"…"
]
}
```

View File

@@ -32,7 +32,7 @@ Updated article detail
```json
{
"article": { … }
"article": {}
}
```

View File

@@ -36,7 +36,7 @@ Updated article detail
```json
{
"article": { … }
"article": {}
}
```

View File

@@ -34,7 +34,7 @@ Updated article detail
```json
{
"article": { … }
"article": {}
}
```

View File

@@ -43,7 +43,7 @@ Updated article detail
```json
{
"article": { … }
"article": {}
}
```

View File

@@ -32,7 +32,7 @@ Updated article detail
```json
{
"article": { … }
"article": {}
}
```

View File

@@ -33,7 +33,7 @@ Updated article detail
```json
{
"article": { … }
"article": {}
}
```

View File

@@ -15,7 +15,19 @@ Search index
```json
{
"articles": []
"articles": [
{
"id": 1,
"sku": "…",
"name": "…",
"eans": [
"…"
],
"categoryIds": [
1
]
}
]
}
```

View File

@@ -24,7 +24,12 @@ Login successful; `token` cookie set
```json
{
"message": "Login successful",
"user": { … }
"user": {
"id": 1,
"email": "user@example.com",
"selectedCompanyId": 1,
"picture": "…"
}
}
```

View File

@@ -15,7 +15,12 @@ Authenticated
```json
{
"user": { … },
"user": {
"id": 1,
"email": "user@example.com",
"selectedCompanyId": 1,
"picture": "…"
},
"googleClientId": "…"
}
```

View File

@@ -20,7 +20,12 @@ Updated user
```json
{
"user": { … }
"user": {
"id": 1,
"email": "user@example.com",
"selectedCompanyId": 1,
"picture": "…"
}
}
```

View File

@@ -12,7 +12,13 @@ Brand list
```json
{
"brands": []
"brands": [
{
"id": 1,
"name": "…",
"gsprpinfo": "…"
}
]
}
```

View File

@@ -22,7 +22,11 @@ Upserted brand
```json
{
"brand": { … }
"brand": {
"id": 1,
"name": "…",
"gsprpinfo": "…"
}
}
```

View File

@@ -30,7 +30,12 @@ Image stored and linked
```json
{
"category": { … }
"category": {
"id": 1,
"thumbW": 1,
"thumbH": 1,
"thumbHash": "…"
}
}
```

View File

@@ -18,7 +18,9 @@ Articles list
```json
{
"articles": []
"articles": [
{}
]
}
```

View File

@@ -25,7 +25,12 @@ Created
```json
{
"category": { … }
"category": {
"id": 1,
"parentId": 1,
"sort": 1,
"name": "…"
}
}
```

View File

@@ -24,7 +24,12 @@ Image removed
```json
{
"category": { … }
"category": {
"id": 1,
"thumbW": 1,
"thumbH": 1,
"thumbHash": "…"
}
}
```

View File

@@ -34,7 +34,9 @@ New sibling order
```json
{
"categoryIds": []
"categoryIds": [
1
]
}
```

View File

@@ -13,8 +13,12 @@ Tree and articles for the selected company
```json
{
"languageId": 1,
"tree": [],
"articles": []
"tree": [
{}
],
"articles": [
{}
]
}
```

View File

@@ -34,7 +34,13 @@ Updated category (renamed and/or moved)
```json
{
"category": { … }
"category": {
"id": 1,
"name": "…",
"slug": "…",
"parentId": 1,
"sort": 1
}
}
```

View File

@@ -23,8 +23,19 @@ Created; selected company updated
```json
{
"company": { … },
"user": { … }
"company": {
"id": 1,
"iso639": "…",
"name": "…",
"taxrate": 1,
"reducedtaxrate": 1
},
"user": {
"id": 1,
"email": "user@example.com",
"selectedCompanyId": 1,
"picture": "…"
}
}
```

View File

@@ -12,7 +12,15 @@ Company list
```json
{
"companies": []
"companies": [
{
"id": 1,
"iso639": "…",
"name": "…",
"taxrate": 1,
"reducedtaxrate": 1
}
]
}
```

View File

@@ -29,7 +29,13 @@ Updated
```json
{
"company": { … }
"company": {
"id": 1,
"iso639": "…",
"name": "…",
"taxrate": 1,
"reducedtaxrate": 1
}
}
```

View File

@@ -0,0 +1,70 @@
# `POST /delivery`
Protected. Requires a valid session cookie (`credentials: 'include'`).
Create delivery
Creates a goods receipt with header and lines in one transaction.
Each line requires `sku`, `amount`, `net`, and `tax` (rate).
`rebate` defaults to `0`; `transactedAmount` defaults to `amount`.
## Body (JSON)
```json
{
"number": "DHL-123",
"date": "2026-08-10",
"supplierId": 1,
"lines": [
{
"sku": "1",
"amount": 10,
"net": 99.5,
"tax": 19
}
]
}
```
## Response `201`
Created delivery
```json
{
"delivery": {
"id": 1,
"number": "…",
"type": "delivery",
"supplierId": 1,
"date": "2026-08-10T00:00:00.000Z",
"lines": [
{
"id": 1,
"articleId": 1,
"sku": "…",
"amount": 1,
"net": 1,
"transactedAmount": 1,
"rebate": 1,
"tax": 1,
"comment": "…"
}
]
}
}
```
## Errors
| Status | Description |
|--------|-------------|
| 400 | Invalid delivery, invalid lines, or no company selected — `{"error":"…"}` |
| 401 | Unauthorized — `{"error":"…"}` |
| 403 | Not authorized — `{"error":"…"}` |
| 404 | Company, supplier, or article not found — `{"error":"…"}` |
---
_Generated from `@openapi` JSDoc. Do not edit by hand — run `npm run docs:api`._

View File

@@ -0,0 +1,33 @@
# `DELETE /delivery/{id}`
Protected. Requires a valid session cookie (`credentials: 'include'`).
Delete delivery
Deletes the goods receipt (`manifestarticle` rows cascade).
## Path parameters
| Param | Required | Type | Description |
|-------|----------|------|-------------|
| `id` | yes | integer | |
## Response `204`
Deleted
_No content_
## Errors
| Status | Description |
|--------|-------------|
| 400 | No company selected or invalid id — `{"error":"…"}` |
| 401 | Unauthorized — `{"error":"…"}` |
| 403 | Not authorized — `{"error":"…"}` |
| 404 | Delivery not found — `{"error":"…"}` |
---
_Generated from `@openapi` JSDoc. Do not edit by hand — run `npm run docs:api`._

View File

@@ -0,0 +1,55 @@
# `GET /delivery/{id}`
Protected. Requires a valid session cookie (`credentials: 'include'`).
Get delivery
Returns a goods receipt with lines for the selected company.
## Path parameters
| Param | Required | Type | Description |
|-------|----------|------|-------------|
| `id` | yes | integer | |
## Response `200`
Delivery
```json
{
"delivery": {
"id": 1,
"number": "…",
"type": "delivery",
"supplierId": 1,
"date": "2026-08-10T00:00:00.000Z",
"lines": [
{
"id": 1,
"articleId": 1,
"sku": "…",
"amount": 1,
"net": 1,
"transactedAmount": 1,
"rebate": 1,
"tax": 1,
"comment": "…"
}
]
}
}
```
## Errors
| Status | Description |
|--------|-------------|
| 400 | No company selected or invalid id — `{"error":"…"}` |
| 401 | Unauthorized — `{"error":"…"}` |
| 403 | Not authorized — `{"error":"…"}` |
| 404 | Delivery or company not found — `{"error":"…"}` |
---
_Generated from `@openapi` JSDoc. Do not edit by hand — run `npm run docs:api`._

View File

@@ -0,0 +1,40 @@
# `GET /delivery`
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.
## Response `200`
Delivery list
```json
{
"deliveries": [
{
"id": 1,
"number": "…",
"type": "delivery",
"supplierId": 1,
"date": "2026-08-10T00:00:00.000Z"
}
]
}
```
## Errors
| Status | Description |
|--------|-------------|
| 400 | No company selected — `{"error":"…"}` |
| 401 | Unauthorized — `{"error":"…"}` |
| 403 | Not authorized — `{"error":"…"}` |
| 404 | Company not found — `{"error":"…"}` |
---
_Generated from `@openapi` JSDoc. Do not edit by hand — run `npm run docs:api`._

View File

@@ -0,0 +1,66 @@
# `PATCH /delivery/{id}`
Protected. Requires a valid session cookie (`credentials: 'include'`).
Update delivery
Patches header fields that are present. If `lines` is present, replaces
all lines; if omitted, leaves lines unchanged. Returns the full delivery.
## Path parameters
| Param | Required | Type | Description |
|-------|----------|------|-------------|
| `id` | yes | integer | |
## Body (JSON)
```json
{
"number": "DHL-124",
"lines": []
}
```
## Response `200`
Updated delivery
```json
{
"delivery": {
"id": 1,
"number": "…",
"type": "delivery",
"supplierId": 1,
"date": "2026-08-10T00:00:00.000Z",
"lines": [
{
"id": 1,
"articleId": 1,
"sku": "…",
"amount": 1,
"net": 1,
"transactedAmount": 1,
"rebate": 1,
"tax": 1,
"comment": "…"
}
]
}
}
```
## Errors
| Status | Description |
|--------|-------------|
| 400 | Invalid delivery, invalid lines, invalid id, or no company selected — `{"error":"…"}` |
| 401 | Unauthorized — `{"error":"…"}` |
| 403 | Not authorized — `{"error":"…"}` |
| 404 | Delivery, supplier, article, or company not found — `{"error":"…"}` |
---
_Generated from `@openapi` JSDoc. Do not edit by hand — run `npm run docs:api`._

View File

@@ -12,7 +12,9 @@ Posterminal list
```json
{
"posterminals": []
"posterminals": [
{}
]
}
```

View File

@@ -20,7 +20,9 @@ Updated category IDs for this terminal
```json
{
"id": 1,
"categoryIds": []
"categoryIds": [
1
]
}
```

View File

@@ -19,7 +19,9 @@ Updated category IDs for this terminal
```json
{
"id": 1,
"categoryIds": []
"categoryIds": [
1
]
}
```

View File

@@ -20,7 +20,9 @@ Updated category IDs for this terminal
```json
{
"id": 1,
"categoryIds": []
"categoryIds": [
1
]
}
```

View File

@@ -21,7 +21,9 @@ Updated category IDs for this terminal
```json
{
"id": 1,
"categoryIds": []
"categoryIds": [
1
]
}
```

View File

@@ -22,7 +22,7 @@ Created posterminal with generated pairingpin
```json
{
"posterminal": { … }
"posterminal": {}
}
```

View File

@@ -0,0 +1,44 @@
# `POST /supplier`
Protected. Requires a valid session cookie (`credentials: 'include'`).
Create supplier
Creates a supplier in the company `Lieferanten` group (created on first use).
## Body (JSON)
```json
{
"name": "Großhandel Müller"
}
```
## Response `201`
Created supplier
```json
{
"supplier": {
"id": 1,
"name": "…",
"createdAt": "2026-08-10T00:00:00.000Z",
"updatedAt": "2026-08-10T00:00:00.000Z"
}
}
```
## Errors
| Status | Description |
|--------|-------------|
| 400 | Name required or no company selected — `{"error":"…"}` |
| 401 | Unauthorized — `{"error":"…"}` |
| 403 | Not authorized — `{"error":"…"}` |
| 404 | Company not found — `{"error":"…"}` |
---
_Generated from `@openapi` JSDoc. Do not edit by hand — run `npm run docs:api`._

View File

@@ -0,0 +1,34 @@
# `DELETE /supplier/{id}`
Protected. Requires a valid session cookie (`credentials: 'include'`).
Delete supplier
Deletes the supplier entity for the selected company.
Related `entityhistory` cascades; `manifest.entity_id` is set null.
## Path parameters
| Param | Required | Type | Description |
|-------|----------|------|-------------|
| `id` | yes | integer | |
## Response `204`
Deleted
_No content_
## Errors
| Status | Description |
|--------|-------------|
| 400 | No company selected or invalid id — `{"error":"…"}` |
| 401 | Unauthorized — `{"error":"…"}` |
| 403 | Not authorized — `{"error":"…"}` |
| 404 | Supplier not found — `{"error":"…"}` |
---
_Generated from `@openapi` JSDoc. Do not edit by hand — run `npm run docs:api`._

View File

@@ -0,0 +1,39 @@
# `GET /supplier`
Protected. Requires a valid session cookie (`credentials: 'include'`).
List suppliers
Lists suppliers (`entity` rows in the company `Lieferanten` customergroup)
for the authenticated user's selected company.
## Response `200`
Supplier list
```json
{
"suppliers": [
{
"id": 1,
"name": "…",
"createdAt": "2026-08-10T00:00:00.000Z",
"updatedAt": "2026-08-10T00:00:00.000Z"
}
]
}
```
## Errors
| Status | Description |
|--------|-------------|
| 400 | No company selected — `{"error":"…"}` |
| 401 | Unauthorized — `{"error":"…"}` |
| 403 | Not authorized — `{"error":"…"}` |
| 404 | Company not found — `{"error":"…"}` |
---
_Generated from `@openapi` JSDoc. Do not edit by hand — run `npm run docs:api`._

View File

@@ -0,0 +1,49 @@
# `PATCH /supplier/{id}`
Protected. Requires a valid session cookie (`credentials: 'include'`).
Update supplier
Renames a supplier for the selected company.
## Path parameters
| Param | Required | Type | Description |
|-------|----------|------|-------------|
| `id` | yes | integer | |
## Body (JSON)
```json
{
"name": "Großhandel Müller GmbH"
}
```
## Response `200`
Updated supplier
```json
{
"supplier": {
"id": 1,
"name": "…",
"createdAt": "2026-08-10T00:00:00.000Z",
"updatedAt": "2026-08-10T00:00:00.000Z"
}
}
```
## Errors
| Status | Description |
|--------|-------------|
| 400 | Name required, invalid id, or no company selected — `{"error":"…"}` |
| 401 | Unauthorized — `{"error":"…"}` |
| 403 | Not authorized — `{"error":"…"}` |
| 404 | Supplier or company not found — `{"error":"…"}` |
---
_Generated from `@openapi` JSDoc. Do not edit by hand — run `npm run docs:api`._

View File

@@ -12,7 +12,15 @@ Unit list
```json
{
"units": []
"units": [
{
"si": "…",
"basesi": "…",
"basesifactor": 1,
"symbol": "…",
"name": "…"
}
]
}
```

View File

@@ -26,7 +26,13 @@ Upserted unit
```json
{
"unit": { … }
"unit": {
"si": "…",
"basesi": "…",
"basesifactor": 1,
"symbol": "…",
"name": "…"
}
}
```