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 article categories by SKU
Replace-all the article's category list. Each category must belong to Replace-all the article's category list. Each category must belong to
the article's company; ids must be unique. Empty array removes the the article's company; ids must be unique. The article must belong to
article from all categories. Returns the same shape as GET by SKU. at least one category (empty array is rejected). Returns the same shape as GET by SKU.
## Path parameters ## Path parameters
@@ -115,7 +115,7 @@ Updated article detail
| Status | Description | | Status | Description |
|--------|-------------| |--------|-------------|
| 400 | Invalid categoryIds — `{"error":"…"}` | | 400 | Invalid categoryIds or empty array — `{"error":"…"}` |
| 401 | Unauthorized — `{"error":"…"}` | | 401 | Unauthorized — `{"error":"…"}` |
| 403 | Not authorized — `{"error":"…"}` | | 403 | Not authorized — `{"error":"…"}` |
| 404 | Article not found — `{"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 attributeValueId') return 400;
if (error.message === 'Invalid weight') return 400; if (error.message === 'Invalid weight') return 400;
if (error.message === 'Invalid track_stock') 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 === 'Attribute name not found') return 404;
if (error.message === 'attributeNameId is required to become a parent article') return 400; 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; 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 * summary: Replace article categories by SKU
* description: | * description: |
* Replace-all the article's category list. Each category must belong to * Replace-all the article's category list. Each category must belong to
* the article's company; ids must be unique. Empty array removes the * the article's company; ids must be unique. The article must belong to
* article from all categories. Returns the same shape as GET by SKU. * at least one category (empty array is rejected). Returns the same shape as GET by SKU.
* security: * security:
* - cookieAuth: [] * - cookieAuth: []
* x-signals: [article-<sku>] * x-signals: [article-<sku>]
@@ -1492,6 +1492,7 @@ export function register(app, basePath = '') {
* properties: * properties:
* categoryIds: * categoryIds:
* type: array * type: array
* minItems: 1
* items: * items:
* type: integer * type: integer
* example: * example:
@@ -1507,7 +1508,7 @@ export function register(app, basePath = '') {
* article: * article:
* $ref: '#/components/schemas/ArticleDetail' * $ref: '#/components/schemas/ArticleDetail'
* 400: * 400:
* description: Invalid categoryIds * description: Invalid categoryIds or empty array
* content: * content:
* application/json: * application/json:
* schema: * schema: