This commit is contained in:
seb
2026-10-20 23:21:48 +02:00
parent 5a5981dc07
commit b7058df5d2
16 changed files with 345 additions and 1063 deletions

View File

@@ -64,8 +64,8 @@ export function register(app, basePath = '') {
* schema:
* type: object
* properties:
* article:
* $ref: '#/components/schemas/ArticleSummary'
* sku:
* type: string
* 400:
* description: Validation error
* content:
@@ -133,11 +133,7 @@ export function register(app, basePath = '') {
seo: req.body?.seo !== undefined ? req.body.seo : undefined,
});
emitArticlesSignal(req);
const article = {
...created,
categoryId: created.parentId,
};
res.status(201).json({ article });
res.status(201).json({ sku: created.sku });
} catch (error) {
const status = articleErrorStatus(error);
if (status === 500) console.error('Create article failed:', error);
@@ -501,15 +497,8 @@ export function register(app, basePath = '') {
* unitamount: 0.24
* unitSi: l
* responses:
* 200:
* description: Updated article detail
* content:
* application/json:
* schema:
* type: object
* properties:
* article:
* $ref: '#/components/schemas/ArticleDetail'
* 204:
* description: Updated
* 400:
* description: Validation error (Name required / Invalid unitamount)
* content:
@@ -753,10 +742,10 @@ export function register(app, basePath = '') {
try {
const decodedSku = decodeURIComponent(sku);
const article = await db.updateBySku(req.user.id, decodedSku, patch);
await db.updateBySku(req.user.id, decodedSku, patch);
emitArticlesSignal(req);
emitArticleSignal(req, decodedSku);
res.status(200).json({ article });
res.status(204).end();
} catch (error) {
const status = articleErrorStatus(error);
if (status === 500) console.error('Update article by sku failed:', error);