This commit is contained in:
seb
2026-09-29 18:26:40 +02:00
parent 9beab57ab4
commit 63af77eab3
8 changed files with 732 additions and 0 deletions

View File

@@ -0,0 +1,42 @@
# `GET /article/{sku}/children`
Protected. Requires a valid session cookie (`credentials: 'include'`).
List child articles of a father article
Returns variants/children linked to this father article.
## Path parameters
| Param | Required | Type | Description |
|-------|----------|------|-------------|
| `sku` | yes | string | Father article SKU |
## Response `200`
List of children
```json
{
"children": [
{
"id": 1,
"sku": "…",
"name": "…",
"fathersort": 1,
"attributeValueId": 1,
"attributeValue": "…"
}
]
}
```
## Errors
| Status | Description |
|--------|-------------|
| 404 | Article not found |
---
_Generated from `@openapi` JSDoc. Do not edit by hand — run `npm run docs:api`._

View File

@@ -0,0 +1,44 @@
# `POST /article/{sku}/children`
Protected. Requires a valid session cookie (`credentials: 'include'`).
Add a child article to a father article
Automatically generates SKU as fatherSku-attributeValueId and assigns the variant attribute.
## Path parameters
| Param | Required | Type | Description |
|-------|----------|------|-------------|
| `sku` | yes | string | Father article SKU |
## Body (JSON)
```json
{
"attributeValueId": 1,
"value": "…",
"name": "…"
}
```
## Response `201`
Created child article
```json
{
"article": {}
}
```
## Errors
| Status | Description |
|--------|-------------|
| 400 | Father not configured as father or missing value |
| 409 | Child SKU already exists |
---
_Generated from `@openapi` JSDoc. Do not edit by hand — run `npm run docs:api`._

View File

@@ -0,0 +1,35 @@
# `DELETE /article/{sku}/children/{childSku}`
Protected. Requires a valid session cookie (`credentials: 'include'`).
Remove a child article from a father article
Unlinks the child from the father (or deletes if deleteArticle query/body is true).
## Path parameters
| Param | Required | Type | Description |
|-------|----------|------|-------------|
| `sku` | yes | string | Father article SKU |
| `childSku` | yes | string | Child article SKU |
## Query parameters
| Param | Required | Type | Description |
|-------|----------|------|-------------|
| `deleteArticle` | no | boolean | If true, permanently deletes the child article instead of just unlinking |
## Response `200`
Child removed
```json
{
"success": true,
"deleted": true
}
```
---
_Generated from `@openapi` JSDoc. Do not edit by hand — run `npm run docs:api`._

View File

@@ -0,0 +1,43 @@
# `POST /article/{sku}/father`
Protected. Requires a valid session cookie (`credentials: 'include'`).
Toggle father mode for an article
Enables or disables father article status. Enabling requires specifying an attributeNameId; disabling requires the article to have zero children.
## Path parameters
| Param | Required | Type | Description |
|-------|----------|------|-------------|
| `sku` | yes | string | Article SKU |
## Body (JSON)
```json
{
"isFather": true,
"attributeNameId": 1
}
```
## Response `200`
Updated article
```json
{
"article": {}
}
```
## Errors
| Status | Description |
|--------|-------------|
| 400 | Invalid input or article still has children |
| 404 | Article or attribute name not found |
---
_Generated from `@openapi` JSDoc. Do not edit by hand — run `npm run docs:api`._