feat(api): add GET and POST /supplier/:id/articles endpoints and openapi docs
This commit is contained in:
92
docs/api/routes/supplier/articles.get.md
Normal file
92
docs/api/routes/supplier/articles.get.md
Normal file
@@ -0,0 +1,92 @@
|
||||
# `GET /supplier/{id}/articles`
|
||||
|
||||
Protected. Requires a valid session cookie (`credentials: 'include'`).
|
||||
|
||||
List supplier articles by SKUs
|
||||
|
||||
Lists article-supplier assignments for the specified supplier (entity ID),
|
||||
optionally filtered by a list of SKUs (matching either article SKU or supplier SKU).
|
||||
Includes linked article details (name, slug, photos/articlepic, eans/articleean).
|
||||
|
||||
|
||||
## Path parameters
|
||||
|
||||
| Param | Required | Type | Description |
|
||||
|-------|----------|------|-------------|
|
||||
| `id` | yes | integer | Supplier entity ID |
|
||||
|
||||
## Query parameters
|
||||
|
||||
| Param | Required | Type | Description |
|
||||
|-------|----------|------|-------------|
|
||||
| `skus` | no | | Optional SKU or comma-separated SKUs to filter by |
|
||||
|
||||
## Response `200`
|
||||
|
||||
List of supplier articles
|
||||
|
||||
```json
|
||||
{
|
||||
"articles": [
|
||||
{
|
||||
"id": 1,
|
||||
"articleId": 1,
|
||||
"entityId": 1,
|
||||
"supplierName": "…",
|
||||
"sku": "…",
|
||||
"pu": 1,
|
||||
"stock": 1,
|
||||
"sort": 1,
|
||||
"priceId": 1,
|
||||
"price": {
|
||||
"net": 1,
|
||||
"taxId": 1,
|
||||
"taxRate": 1
|
||||
},
|
||||
"article": {
|
||||
"id": 1,
|
||||
"sku": "…",
|
||||
"name": "…",
|
||||
"slug": "…",
|
||||
"photos": [
|
||||
{
|
||||
"sort": 1,
|
||||
"thumbhash": "…",
|
||||
"hash": "…",
|
||||
"thumbw": 1,
|
||||
"thumbh": 1
|
||||
}
|
||||
],
|
||||
"articlepic": [
|
||||
{
|
||||
"sort": 1,
|
||||
"thumbhash": "…",
|
||||
"hash": "…",
|
||||
"thumbw": 1,
|
||||
"thumbh": 1
|
||||
}
|
||||
],
|
||||
"eans": [
|
||||
"…"
|
||||
],
|
||||
"articleean": [
|
||||
"…"
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
## Errors
|
||||
|
||||
| Status | Description |
|
||||
|--------|-------------|
|
||||
| 400 | No company selected or invalid id — `{"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`._
|
||||
97
docs/api/routes/supplier/articles.post.md
Normal file
97
docs/api/routes/supplier/articles.post.md
Normal file
@@ -0,0 +1,97 @@
|
||||
# `POST /supplier/{id}/articles`
|
||||
|
||||
Protected. Requires a valid session cookie (`credentials: 'include'`).
|
||||
|
||||
Query supplier articles by SKUs (bulk)
|
||||
|
||||
Queries article-supplier assignments for the specified supplier (entity ID) with a
|
||||
JSON list of SKUs in the request body, avoiding URL length limits for large SKU lists.
|
||||
Includes linked article details (name, slug, photos/articlepic, eans/articleean).
|
||||
|
||||
|
||||
## Path parameters
|
||||
|
||||
| Param | Required | Type | Description |
|
||||
|-------|----------|------|-------------|
|
||||
| `id` | yes | integer | Supplier entity ID |
|
||||
|
||||
## Body (JSON)
|
||||
|
||||
```json
|
||||
{
|
||||
"skus": [
|
||||
"SKU-1",
|
||||
"SKU-2"
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
## Response `200`
|
||||
|
||||
List of supplier articles
|
||||
|
||||
```json
|
||||
{
|
||||
"articles": [
|
||||
{
|
||||
"id": 1,
|
||||
"articleId": 1,
|
||||
"entityId": 1,
|
||||
"supplierName": "…",
|
||||
"sku": "…",
|
||||
"pu": 1,
|
||||
"stock": 1,
|
||||
"sort": 1,
|
||||
"priceId": 1,
|
||||
"price": {
|
||||
"net": 1,
|
||||
"taxId": 1,
|
||||
"taxRate": 1
|
||||
},
|
||||
"article": {
|
||||
"id": 1,
|
||||
"sku": "…",
|
||||
"name": "…",
|
||||
"slug": "…",
|
||||
"photos": [
|
||||
{
|
||||
"sort": 1,
|
||||
"thumbhash": "…",
|
||||
"hash": "…",
|
||||
"thumbw": 1,
|
||||
"thumbh": 1
|
||||
}
|
||||
],
|
||||
"articlepic": [
|
||||
{
|
||||
"sort": 1,
|
||||
"thumbhash": "…",
|
||||
"hash": "…",
|
||||
"thumbw": 1,
|
||||
"thumbh": 1
|
||||
}
|
||||
],
|
||||
"eans": [
|
||||
"…"
|
||||
],
|
||||
"articleean": [
|
||||
"…"
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
## Errors
|
||||
|
||||
| Status | Description |
|
||||
|--------|-------------|
|
||||
| 400 | No company selected or invalid id — `{"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`._
|
||||
Reference in New Issue
Block a user