This commit is contained in:
seb
2026-10-07 22:39:27 +02:00
parent 1a236b568a
commit 446f465a48
2 changed files with 8 additions and 7 deletions

View File

@@ -5,8 +5,8 @@ Protected. Requires a valid session cookie (`credentials: 'include'`).
Replace article categories by SKU
Replace-all the article's category list. Each category must belong to
the article's company; ids must be unique. Empty array removes the
article from all categories. Returns the same shape as GET by SKU.
the article's company; ids must be unique. The article must belong to
at least one category (empty array is rejected). Returns the same shape as GET by SKU.
## Path parameters
@@ -115,7 +115,7 @@ Updated article detail
| Status | Description |
|--------|-------------|
| 400 | Invalid categoryIds — `{"error":"…"}` |
| 400 | Invalid categoryIds or empty array — `{"error":"…"}` |
| 401 | Unauthorized — `{"error":"…"}` |
| 403 | Not authorized — `{"error":"…"}` |
| 404 | Article not found — `{"error":"…"}` |

View File

@@ -77,7 +77,7 @@ function articleErrorStatus(error) {
if (error.message === 'Invalid attributeValueId') return 400;
if (error.message === 'Invalid weight') return 400;
if (error.message === 'Invalid track_stock') return 400;
if (error.message === 'Invalid categoryIds') return 400;
if (error.message === 'Invalid categoryIds' || error.message === 'Article must have at least one category') return 400;
if (error.message === 'Attribute name not found') return 404;
if (error.message === 'attributeNameId is required to become a parent article') return 400;
if (error.message?.includes('already used by an ancestor parent')) return 400;
@@ -1470,8 +1470,8 @@ export function register(app, basePath = '') {
* summary: Replace article categories by SKU
* description: |
* Replace-all the article's category list. Each category must belong to
* the article's company; ids must be unique. Empty array removes the
* article from all categories. Returns the same shape as GET by SKU.
* the article's company; ids must be unique. The article must belong to
* at least one category (empty array is rejected). Returns the same shape as GET by SKU.
* security:
* - cookieAuth: []
* x-signals: [article-<sku>]
@@ -1492,6 +1492,7 @@ export function register(app, basePath = '') {
* properties:
* categoryIds:
* type: array
* minItems: 1
* items:
* type: integer
* example:
@@ -1507,7 +1508,7 @@ export function register(app, basePath = '') {
* article:
* $ref: '#/components/schemas/ArticleDetail'
* 400:
* description: Invalid categoryIds
* description: Invalid categoryIds or empty array
* content:
* application/json:
* schema: