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

@@ -41,7 +41,11 @@ Generated from `@openapi` annotations in [`src/api/routes/`](../../src/api/route
| [`routes/article/_sku/attributevalue.put.md`](routes/article/_sku/attributevalue.put.md) | `PUT /article/{sku}/attributevalue` |
| [`routes/article/set-brand.md`](routes/article/set-brand.md) | `PUT /article/{sku}/brand` |
| [`routes/article/set-categories.md`](routes/article/set-categories.md) | `PUT /article/{sku}/categories` |
| [`routes/article/_sku/children.get.md`](routes/article/_sku/children.get.md) | `GET /article/{sku}/children` |
| [`routes/article/_sku/children.post.md`](routes/article/_sku/children.post.md) | `POST /article/{sku}/children` |
| [`routes/article/_sku/children/_childSku.md`](routes/article/_sku/children/_childSku.md) | `DELETE /article/{sku}/children/{childSku}` |
| [`routes/article/set-eans.md`](routes/article/set-eans.md) | `PUT /article/{sku}/eans` |
| [`routes/article/_sku/father.md`](routes/article/_sku/father.md) | `POST /article/{sku}/father` |
| [`routes/article/history.md`](routes/article/history.md) | `GET /article/{sku}/history` |
| [`routes/article/add-image.md`](routes/article/add-image.md) | `POST /article/{sku}/image` |
| [`routes/article/delete-image.md`](routes/article/delete-image.md) | `DELETE /article/{sku}/image/{fullHash}` |

View File

@@ -12676,6 +12676,277 @@
}
}
},
"/article/{sku}/father": {
"post": {
"summary": "Toggle father mode for an article",
"description": "Enables or disables father article status. Enabling requires specifying an attributeNameId; disabling requires the article to have zero children.",
"tags": [
"Article"
],
"security": [
{
"cookieAuth": []
}
],
"parameters": [
{
"in": "path",
"name": "sku",
"required": true,
"schema": {
"type": "string"
},
"description": "Article SKU"
}
],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"type": "object",
"required": [
"isFather"
],
"properties": {
"isFather": {
"type": "boolean",
"description": "True to make article a father, false to revert to regular article"
},
"attributeNameId": {
"type": "integer",
"description": "Required when isFather is true. The attributename id for variants."
}
}
}
}
}
},
"responses": {
"200": {
"description": "Updated article",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"article": {
"$ref": "#/components/schemas/Article"
}
}
}
}
}
},
"400": {
"description": "Invalid input or article still has children"
},
"404": {
"description": "Article or attribute name not found"
}
}
}
},
"/article/{sku}/children": {
"get": {
"summary": "List child articles of a father article",
"description": "Returns variants/children linked to this father article.",
"tags": [
"Article"
],
"security": [
{
"cookieAuth": []
}
],
"parameters": [
{
"in": "path",
"name": "sku",
"required": true,
"schema": {
"type": "string"
},
"description": "Father article SKU"
}
],
"responses": {
"200": {
"description": "List of children",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"children": {
"type": "array",
"items": {
"type": "object",
"properties": {
"id": {
"type": "integer"
},
"sku": {
"type": "string"
},
"name": {
"type": "string"
},
"fathersort": {
"type": "integer"
},
"attributeValueId": {
"type": "integer"
},
"attributeValue": {
"type": "string"
}
}
}
}
}
}
}
}
},
"404": {
"description": "Article not found"
}
}
},
"post": {
"summary": "Add a child article to a father article",
"description": "Automatically generates SKU as fatherSku-attributeValueId and assigns the variant attribute.",
"tags": [
"Article"
],
"security": [
{
"cookieAuth": []
}
],
"parameters": [
{
"in": "path",
"name": "sku",
"required": true,
"schema": {
"type": "string"
},
"description": "Father article SKU"
}
],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"attributeValueId": {
"type": "integer",
"description": "ID of existing attribute value for the father's attribute"
},
"value": {
"type": "string",
"description": "String value to find or create under the father's attribute"
},
"name": {
"type": "string",
"description": "Optional custom variant name"
}
}
}
}
}
},
"responses": {
"201": {
"description": "Created child article",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"article": {
"$ref": "#/components/schemas/Article"
}
}
}
}
}
},
"400": {
"description": "Father not configured as father or missing value"
},
"409": {
"description": "Child SKU already exists"
}
}
}
},
"/article/{sku}/children/{childSku}": {
"delete": {
"summary": "Remove a child article from a father article",
"description": "Unlinks the child from the father (or deletes if deleteArticle query/body is true).",
"tags": [
"Article"
],
"security": [
{
"cookieAuth": []
}
],
"parameters": [
{
"in": "path",
"name": "sku",
"required": true,
"schema": {
"type": "string"
},
"description": "Father article SKU"
},
{
"in": "path",
"name": "childSku",
"required": true,
"schema": {
"type": "string"
},
"description": "Child article SKU"
},
{
"in": "query",
"name": "deleteArticle",
"schema": {
"type": "boolean"
},
"description": "If true, permanently deletes the child article instead of just unlinking"
}
],
"responses": {
"200": {
"description": "Child removed",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"success": {
"type": "boolean"
},
"deleted": {
"type": "boolean"
}
}
}
}
}
}
}
}
},
"/auth/selected-company": {
"put": {
"tags": [

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`._