feat(api): implement articlesupplier endpoints, sort reordering, and openapi docs
This commit is contained in:
@@ -21,6 +21,7 @@ Assigns a supplier to an article with optional purchase price, stock, and suppli
|
||||
"sku": "MET-44910",
|
||||
"pu": 1,
|
||||
"stock": 140,
|
||||
"sort": 0,
|
||||
"netPrice": 4.2,
|
||||
"taxId": 1
|
||||
}
|
||||
@@ -44,6 +45,7 @@ Created supplier assignment
|
||||
"sku": "…",
|
||||
"pu": 1,
|
||||
"stock": 1,
|
||||
"sort": 1,
|
||||
"priceId": 1,
|
||||
"price": {
|
||||
"net": 1,
|
||||
|
||||
@@ -27,6 +27,7 @@ List of suppliers linked to the article
|
||||
"sku": "…",
|
||||
"pu": 1,
|
||||
"stock": 1,
|
||||
"sort": 1,
|
||||
"priceId": 1,
|
||||
"price": {
|
||||
"net": 1,
|
||||
|
||||
56
docs/api/routes/article/supplier/order.md
Normal file
56
docs/api/routes/article/supplier/order.md
Normal file
@@ -0,0 +1,56 @@
|
||||
# `PUT /article/{sku}/supplier/order`
|
||||
|
||||
Protected. Requires a valid session cookie (`credentials: 'include'`).
|
||||
|
||||
Reorder article suppliers
|
||||
|
||||
Sets the display sort order of supplier assignments for an article.
|
||||
Expects an array of all assigned `articlesupplier` IDs in the desired order.
|
||||
|
||||
|
||||
## Path parameters
|
||||
|
||||
| Param | Required | Type | Description |
|
||||
|-------|----------|------|-------------|
|
||||
| `sku` | yes | string | Article SKU |
|
||||
|
||||
## Body (JSON)
|
||||
|
||||
```json
|
||||
{
|
||||
"ids": [
|
||||
12,
|
||||
10,
|
||||
15
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
## Signals
|
||||
|
||||
On success, emits SSE signal: `article-<sku>` (see [`GET /events`](../events.md)).
|
||||
|
||||
## Response `200`
|
||||
|
||||
New order applied
|
||||
|
||||
```json
|
||||
{
|
||||
"ids": [
|
||||
1
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
## Errors
|
||||
|
||||
| Status | Description |
|
||||
|--------|-------------|
|
||||
| 400 | Invalid supplier order, ids is required, or no company selected — `{"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`._
|
||||
@@ -43,6 +43,7 @@ Updated supplier assignment
|
||||
"sku": "…",
|
||||
"pu": 1,
|
||||
"stock": 1,
|
||||
"sort": 1,
|
||||
"priceId": 1,
|
||||
"price": {
|
||||
"net": 1,
|
||||
|
||||
Reference in New Issue
Block a user