83 lines
1.9 KiB
Markdown
83 lines
1.9 KiB
Markdown
# `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)
|
|
|
|
| Field | Required | Type | Description |
|
|
|-------|----------|------|-------------|
|
|
| `entityId` | yes | integer | Supplier entity ID (in Lieferanten group) |
|
|
| `sku` | no | string | Supplier's item number |
|
|
| `pu` | no | number | Packaging unit (VPE) |
|
|
| `stock` | no | number | Supplier stock |
|
|
| `sort` | no | integer | Display sort order (defaults to next sort) |
|
|
| `netPrice` | no | number | Net purchase price |
|
|
| `taxId` | no | integer | Tax ID for purchase price |
|
|
| `taxRate` | no | number | Tax rate in percent |
|
|
|
|
```json
|
|
{
|
|
"entityId": 88,
|
|
"sku": "MET-44910",
|
|
"pu": 1,
|
|
"stock": 140,
|
|
"sort": 0,
|
|
"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,
|
|
"sort": 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`._
|