This commit is contained in:
seb
2026-09-27 21:01:20 +02:00
parent bab15b0978
commit 68b793c9ba
17 changed files with 1695 additions and 23 deletions

View File

@@ -0,0 +1,49 @@
# `PUT /article/{sku}/track_stock`
Protected. Requires a valid session cookie (`credentials: 'include'`).
Set article track_stock flag by SKU
Enables or disables inventory stock tracking for this article.
## Path parameters
| Param | Required | Type | Description |
|-------|----------|------|-------------|
| `sku` | yes | string | Article SKU |
## Body (JSON)
```json
{
"track_stock": true
}
```
## Signals
On success, emits SSE signal: `article-<sku>` (see [`GET /events`](../events.md)).
## Response `200`
Updated article detail
```json
{
"article": {}
}
```
## Errors
| Status | Description |
|--------|-------------|
| 400 | Invalid track_stock — `{"error":"…"}` |
| 401 | Unauthorized — `{"error":"…"}` |
| 403 | Not authorized — `{"error":"…"}` |
| 404 | Article not found — `{"error":"…"}` |
---
_Generated from `@openapi` JSDoc. Do not edit by hand — run `npm run docs:api`._

View File

@@ -29,7 +29,8 @@ Created
"id": 1,
"parentId": 1,
"name": "…",
"sku": "…"
"sku": "…",
"track_stock": true
}
}
```

View File

@@ -0,0 +1,50 @@
# `PUT /warehouse/{id}`
Protected. Requires a valid session cookie (`credentials: 'include'`).
Update warehouse
Updates specified fields of an existing warehouse for the selected company.
## Path parameters
| Param | Required | Type | Description |
|-------|----------|------|-------------|
| `id` | yes | integer | Warehouse ID |
## Body (JSON)
```json
{
"name": "…",
"sort": 1
}
```
## Response `200`
Updated warehouse
```json
{
"warehouse": {
"id": 1,
"name": "…",
"sort": 1
}
}
```
## Errors
| Status | Description |
|--------|-------------|
| 400 | Invalid input — `{"error":"…"}` |
| 401 | Unauthorized — `{"error":"…"}` |
| 403 | Not authorized — `{"error":"…"}` |
| 404 | Warehouse not found — `{"error":"…"}` |
| 409 | Warehouse name conflict — `{"error":"…"}` |
---
_Generated from `@openapi` JSDoc. Do not edit by hand — run `npm run docs:api`._

View File

@@ -0,0 +1,45 @@
# `POST /warehouse`
Protected. Requires a valid session cookie (`credentials: 'include'`).
Create warehouse
Creates a new warehouse for the selected company.
Sort order will be automatically appended if omitted.
## Body (JSON)
```json
{
"name": "…",
"sort": 1
}
```
## Response `201`
Created warehouse
```json
{
"warehouse": {
"id": 1,
"name": "…",
"sort": 1
}
}
```
## Errors
| Status | Description |
|--------|-------------|
| 400 | Invalid input or missing fields — `{"error":"…"}` |
| 401 | Unauthorized — `{"error":"…"}` |
| 403 | Not authorized — `{"error":"…"}` |
| 409 | Warehouse already exists — `{"error":"…"}` |
---
_Generated from `@openapi` JSDoc. Do not edit by hand — run `npm run docs:api`._

View File

@@ -0,0 +1,33 @@
# `DELETE /warehouse/{id}`
Protected. Requires a valid session cookie (`credentials: 'include'`).
Delete warehouse
Deletes a warehouse if not in use in the ledger.
## Path parameters
| Param | Required | Type | Description |
|-------|----------|------|-------------|
| `id` | yes | integer | Warehouse ID |
## Response `204`
Warehouse deleted
_No content_
## Errors
| Status | Description |
|--------|-------------|
| 400 | Invalid ID or no company selected — `{"error":"…"}` |
| 401 | Unauthorized — `{"error":"…"}` |
| 403 | Not authorized — `{"error":"…"}` |
| 404 | Warehouse not found — `{"error":"…"}` |
| 409 | Warehouse in use in ledger — `{"error":"…"}` |
---
_Generated from `@openapi` JSDoc. Do not edit by hand — run `npm run docs:api`._

View File

@@ -0,0 +1,40 @@
# `GET /warehouse/{id}`
Protected. Requires a valid session cookie (`credentials: 'include'`).
Get warehouse by ID
Retrieves a single warehouse for the authenticated user's selected company.
## Path parameters
| Param | Required | Type | Description |
|-------|----------|------|-------------|
| `id` | yes | integer | Warehouse ID |
## Response `200`
Warehouse details
```json
{
"warehouse": {
"id": 1,
"name": "…",
"sort": 1
}
}
```
## Errors
| Status | Description |
|--------|-------------|
| 400 | Invalid ID or no company selected — `{"error":"…"}` |
| 401 | Unauthorized — `{"error":"…"}` |
| 403 | Not authorized — `{"error":"…"}` |
| 404 | Warehouse not found — `{"error":"…"}` |
---
_Generated from `@openapi` JSDoc. Do not edit by hand — run `npm run docs:api`._

View File

@@ -0,0 +1,35 @@
# `GET /warehouse`
Protected. Requires a valid session cookie (`credentials: 'include'`).
List warehouses
Lists warehouses for the selected company, ordered by sort and name.
## Response `200`
List of warehouses
```json
{
"warehouses": [
{
"id": 1,
"name": "…",
"sort": 1
}
]
}
```
## Errors
| Status | Description |
|--------|-------------|
| 400 | No company selected — `{"error":"…"}` |
| 401 | Unauthorized — `{"error":"…"}` |
| 403 | Not authorized — `{"error":"…"}` |
---
_Generated from `@openapi` JSDoc. Do not edit by hand — run `npm run docs:api`._

View File

@@ -0,0 +1,43 @@
# `PUT /warehouse/order`
Protected. Requires a valid session cookie (`credentials: 'include'`).
Reorder warehouses
Reorders warehouses for the selected company.
`warehouseIds` must include all existing warehouse IDs exactly once.
## Body (JSON)
```json
{
"warehouseIds": [
1
]
}
```
## Response `200`
Applied warehouse order
```json
{
"warehouseIds": [
1
]
}
```
## Errors
| Status | Description |
|--------|-------------|
| 400 | Invalid warehouse order or no company selected — `{"error":"…"}` |
| 401 | Unauthorized — `{"error":"…"}` |
| 403 | Not authorized — `{"error":"…"}` |
---
_Generated from `@openapi` JSDoc. Do not edit by hand — run `npm run docs:api`._

View File

@@ -0,0 +1,50 @@
# `PATCH /warehouse/{id}`
Protected. Requires a valid session cookie (`credentials: 'include'`).
Update warehouse (partial)
Updates specified fields of an existing warehouse for the selected company.
## Path parameters
| Param | Required | Type | Description |
|-------|----------|------|-------------|
| `id` | yes | integer | Warehouse ID |
## Body (JSON)
```json
{
"name": "…",
"sort": 1
}
```
## Response `200`
Updated warehouse
```json
{
"warehouse": {
"id": 1,
"name": "…",
"sort": 1
}
}
```
## Errors
| Status | Description |
|--------|-------------|
| 400 | Invalid input — `{"error":"…"}` |
| 401 | Unauthorized — `{"error":"…"}` |
| 403 | Not authorized — `{"error":"…"}` |
| 404 | Warehouse not found — `{"error":"…"}` |
| 409 | Warehouse name conflict — `{"error":"…"}` |
---
_Generated from `@openapi` JSDoc. Do not edit by hand — run `npm run docs:api`._