This commit is contained in:
seb
2026-09-30 09:47:59 +02:00
parent 1de802fbaa
commit 82cc138ba6
15 changed files with 624 additions and 11 deletions

View File

@@ -1997,7 +1997,7 @@ export function register(app, basePath = '') {
* /article/{sku}/articlelist:
* put:
* summary: Set Stückliste (bundle items) for an article
* description: Configures the article as a Stückliste covering a list of count * article. An article that is a father or has options cannot be a Stückliste. Pass an empty array to remove the Stückliste.
* description: Configures the article as a Stückliste covering a list of count * article. A father article cannot be a Stückliste. Can be combined with options. Pass an empty array to remove the Stückliste.
* tags:
* - Article
* security:
@@ -2135,7 +2135,7 @@ export function register(app, basePath = '') {
* /article/{sku}/optionslist:
* put:
* summary: Set options list for an article
* description: Configures options for an article. Some options can be mandated (come with the article in any case). An article that is a father or a Stückliste cannot have options. Pass an empty array to remove options.
* description: Configures options for an article. Some options can be mandated (come with the article in any case). A father article cannot have options. Can be combined with a Stückliste. Pass an empty array to remove options.
* tags:
* - Article
* security:

View File

@@ -292,7 +292,7 @@ export function register(app, basePath = '') {
* get:
* tags: [Category]
* summary: Articles in category
* description: Returns articles in a category the user is authorized for.
* description: Returns articles in a category the user is authorized for (omits child articles of a father article). Each article includes `childCount` (the number of its child articles).
* security:
* - cookieAuth: []
* x-markdown: category/articles.md
@@ -315,6 +315,46 @@ export function register(app, basePath = '') {
* type: array
* items:
* type: object
* properties:
* id:
* type: integer
* sku:
* type: string
* name:
* type: string
* slug:
* type: string
* net:
* type: number
* nullable: true
* taxRate:
* type: number
* nullable: true
* track_stock:
* type: boolean
* optionsCount:
* type: integer
* articleListCount:
* type: integer
* childCount:
* type: integer
* description: Number of child articles belonging to this article
* fullHash:
* type: string
* nullable: true
* thumbW:
* type: integer
* nullable: true
* thumbH:
* type: integer
* nullable: true
* thumbHash:
* type: string
* nullable: true
* brand:
* type: object
* nullable: true
* additionalProperties: true
* additionalProperties: true
* 400:
* description: Invalid id
@@ -342,7 +382,13 @@ export function register(app, basePath = '') {
}
try {
const articles = await db.getCategoryArticles(req.user.id, parsed.id);
const allArticles = await db.getCategoryArticles(req.user.id, parsed.id);
const articles = allArticles
.filter((a) => a.fatherArticleId == null)
.map((a) => ({
...a,
childCount: Number(a.childCount ?? 0),
}));
res.status(200).json({ articles });
} catch (error) {
const status = categoryErrorStatus(error);