u
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user