From 67758d5ec2737ec2a39e49324a11d2eb29feb136 Mon Sep 17 00:00:00 2001 From: seb Date: Fri, 25 Sep 2026 12:30:54 +0200 Subject: [PATCH] u --- src/api/routes/article.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/api/routes/article.js b/src/api/routes/article.js index dfe04cf..8900406 100644 --- a/src/api/routes/article.js +++ b/src/api/routes/article.js @@ -62,6 +62,7 @@ function articleErrorStatus(error) { if (error.message === 'Brand not found') return 404; if (error.message === 'Invalid weight') return 400; if (error.message === 'Invalid categoryIds') return 400; + if (error.message?.includes('already exists') || error.code === 'SQLITE_CONSTRAINT_UNIQUE') return 409; return 500; } @@ -132,6 +133,12 @@ export function register(app, basePath = '') { * application/json: * schema: * $ref: '#/components/schemas/Error' + * 409: + * description: SKU already exists + * content: + * application/json: + * schema: + * $ref: '#/components/schemas/Error' */ app.post(`${basePath}/article`, async (req, res) => { const parent = parsePositiveInt(req.body?.parentId, 'parentId');