This commit is contained in:
seb
2026-09-17 11:46:22 +02:00
parent ab6d018a1f
commit 49efd5f8a1
23 changed files with 1384 additions and 79 deletions

View File

@@ -0,0 +1,69 @@
# `POST /article/{sku}/supplier`
Protected. Requires a valid session cookie (`credentials: 'include'`).
Assign supplier to article
Assigns a supplier to an article with optional purchase price, stock, and supplier SKU.
## Path parameters
| Param | Required | Type | Description |
|-------|----------|------|-------------|
| `sku` | yes | string | Article SKU |
## Body (JSON)
```json
{
"entityId": 88,
"sku": "MET-44910",
"pu": 1,
"stock": 140,
"netPrice": 4.2,
"taxId": 1
}
```
## Signals
On success, emits SSE signal: `article-<sku>` (see [`GET /events`](../events.md)).
## Response `201`
Created supplier assignment
```json
{
"supplier": {
"id": 1,
"articleId": 1,
"entityId": 1,
"supplierName": "…",
"sku": "…",
"pu": 1,
"stock": 1,
"priceId": 1,
"price": {
"net": 1,
"taxId": 1,
"taxRate": 1
}
}
}
```
## Errors
| Status | Description |
|--------|-------------|
| 400 | entityId required, invalid pu, invalid stock, invalid price, or no company selected — `{"error":"…"}` |
| 401 | Unauthorized — `{"error":"…"}` |
| 403 | Not authorized — `{"error":"…"}` |
| 404 | Article, supplier, or company not found — `{"error":"…"}` |
| 409 | Supplier already assigned — `{"error":"…"}` |
---
_Generated from `@openapi` JSDoc. Do not edit by hand — run `npm run docs:api`._

View File

@@ -0,0 +1,38 @@
# `DELETE /article/{sku}/supplier/{id}`
Protected. Requires a valid session cookie (`credentials: 'include'`).
Remove supplier assignment from article
Removes a supplier assignment from the article and cleans up its associated purchase price.
## Path parameters
| Param | Required | Type | Description |
|-------|----------|------|-------------|
| `sku` | yes | string | Article SKU |
| `id` | yes | integer | articlesupplier assignment ID |
## Signals
On success, emits SSE signal: `article-<sku>` (see [`GET /events`](../events.md)).
## Response `204`
Deleted
_No content_
## Errors
| Status | Description |
|--------|-------------|
| 400 | Invalid id, invalid sku, or no company selected — `{"error":"…"}` |
| 401 | Unauthorized — `{"error":"…"}` |
| 403 | Not authorized — `{"error":"…"}` |
| 404 | Supplier assignment or article not found — `{"error":"…"}` |
---
_Generated from `@openapi` JSDoc. Do not edit by hand — run `npm run docs:api`._

View File

@@ -0,0 +1,52 @@
# `GET /article/{sku}/supplier`
Protected. Requires a valid session cookie (`credentials: 'include'`).
List article suppliers
Fetches all suppliers linked to the specified article SKU.
## Path parameters
| Param | Required | Type | Description |
|-------|----------|------|-------------|
| `sku` | yes | string | Article SKU |
## Response `200`
List of suppliers linked to the article
```json
{
"suppliers": [
{
"id": 1,
"articleId": 1,
"entityId": 1,
"supplierName": "…",
"sku": "…",
"pu": 1,
"stock": 1,
"priceId": 1,
"price": {
"net": 1,
"taxId": 1,
"taxRate": 1
}
}
]
}
```
## Errors
| Status | Description |
|--------|-------------|
| 400 | No company selected or invalid sku — `{"error":"…"}` |
| 401 | Unauthorized — `{"error":"…"}` |
| 403 | Not authorized — `{"error":"…"}` |
| 404 | Article or company not found — `{"error":"…"}` |
---
_Generated from `@openapi` JSDoc. Do not edit by hand — run `npm run docs:api`._

View File

@@ -0,0 +1,67 @@
# `PATCH /article/{sku}/supplier/{id}`
Protected. Requires a valid session cookie (`credentials: 'include'`).
Update article supplier assignment
Updates an existing article-supplier association (supplier SKU, packaging unit, stock, purchase price).
## Path parameters
| Param | Required | Type | Description |
|-------|----------|------|-------------|
| `sku` | yes | string | Article SKU |
| `id` | yes | integer | articlesupplier assignment ID |
## Body (JSON)
```json
{
"sku": "MET-44910-B",
"pu": 6,
"stock": 95,
"netPrice": 22.5
}
```
## Signals
On success, emits SSE signal: `article-<sku>` (see [`GET /events`](../events.md)).
## Response `200`
Updated supplier assignment
```json
{
"supplier": {
"id": 1,
"articleId": 1,
"entityId": 1,
"supplierName": "…",
"sku": "…",
"pu": 1,
"stock": 1,
"priceId": 1,
"price": {
"net": 1,
"taxId": 1,
"taxRate": 1
}
}
}
```
## Errors
| Status | Description |
|--------|-------------|
| 400 | Invalid pu, invalid stock, invalid price, invalid id, or no company selected — `{"error":"…"}` |
| 401 | Unauthorized — `{"error":"…"}` |
| 403 | Not authorized — `{"error":"…"}` |
| 404 | Supplier assignment, article, or company not found — `{"error":"…"}` |
---
_Generated from `@openapi` JSDoc. Do not edit by hand — run `npm run docs:api`._

View File

@@ -8,7 +8,7 @@ Creates a goods receipt with header and lines in one transaction.
The manifest `number` is allocated automatically via
`nextNumber('delivery')`; the user-supplied reference is stored as
`externalNumber`. Each line requires `sku` or `name`, `amount`, `net`, and
`tax` (rate). `pu` defaults to `1`; `rebate` defaults to `0`.
`taxrate` (rate). `pu` defaults to `1`; `rebate` defaults to `0`.
## Body (JSON)
@@ -25,7 +25,7 @@ The manifest `number` is allocated automatically via
"pu": 1,
"amount": 10,
"net": 99.5,
"tax": 19
"taxrate": 19
}
]
}
@@ -53,7 +53,7 @@ Created delivery
"amount": 1,
"net": 1,
"rebate": 1,
"tax": 1,
"taxrate": 1,
"comment": "…"
}
]

View File

@@ -34,7 +34,7 @@ Delivery
"amount": 1,
"net": 1,
"rebate": 1,
"tax": 1,
"taxrate": 1,
"comment": "…"
}
]

View File

@@ -47,7 +47,7 @@ Updated delivery
"amount": 1,
"net": 1,
"rebate": 1,
"tax": 1,
"taxrate": 1,
"comment": "…"
}
]

View File

@@ -7,7 +7,7 @@ Create order
Creates a sales order with header and lines in one transaction.
`date` is the document date (expected delivery).
`entityId` must be a company customer (not Lieferanten/POS), or null.
Each line requires `sku` or `name`, `amount`, `net`, and `tax` (rate); `pu` defaults to `1`; `rebate` defaults to `0`.
Each line requires `sku` or `name`, `amount`, `net`, and `taxrate` (rate); `pu` defaults to `1`; `rebate` defaults to `0`.
## Body (JSON)
@@ -24,7 +24,7 @@ Each line requires `sku` or `name`, `amount`, `net`, and `tax` (rate); `pu` defa
"pu": 1,
"amount": 10,
"net": 99.5,
"tax": 19
"taxrate": 19
}
]
}
@@ -51,7 +51,7 @@ Created order
"amount": 1,
"net": 1,
"rebate": 1,
"tax": 1,
"taxrate": 1,
"comment": "…"
}
]

View File

@@ -33,7 +33,7 @@ Order
"amount": 1,
"net": 1,
"rebate": 1,
"tax": 1,
"taxrate": 1,
"comment": "…"
}
]

View File

@@ -45,7 +45,7 @@ Updated order
"amount": 1,
"net": 1,
"rebate": 1,
"tax": 1,
"taxrate": 1,
"comment": "…"
}
]

View File

@@ -7,7 +7,7 @@ Create quote
Creates a quote with header and lines in one transaction.
`date` is the document date (valid-until).
`entityId` must be a company customer (not Lieferanten/POS), or null.
Each line requires `sku` or `name`, `amount`, `net`, and `tax` (rate); `pu` defaults to `1`; `rebate` defaults to `0`.
Each line requires `sku` or `name`, `amount`, `net`, and `taxrate` (rate); `pu` defaults to `1`; `rebate` defaults to `0`.
## Body (JSON)
@@ -24,7 +24,7 @@ Each line requires `sku` or `name`, `amount`, `net`, and `tax` (rate); `pu` defa
"pu": 1,
"amount": 10,
"net": 99.5,
"tax": 19
"taxrate": 19
}
]
}
@@ -51,7 +51,7 @@ Created quote
"amount": 1,
"net": 1,
"rebate": 1,
"tax": 1,
"taxrate": 1,
"comment": "…"
}
]

View File

@@ -33,7 +33,7 @@ Quote
"amount": 1,
"net": 1,
"rebate": 1,
"tax": 1,
"taxrate": 1,
"comment": "…"
}
]

View File

@@ -45,7 +45,7 @@ Updated quote
"amount": 1,
"net": 1,
"rebate": 1,
"tax": 1,
"taxrate": 1,
"comment": "…"
}
]