This commit is contained in:
seb
2026-10-07 11:41:15 +02:00
parent 2e8c36fa01
commit cbd7920eb6
3 changed files with 6 additions and 5 deletions

View File

@@ -304,7 +304,7 @@ export function register(app, basePath = '') {
* get:
* tags: [Category]
* summary: Articles in category
* description: Returns articles in a category the user is authorized for (omits child articles of a parent article). Each article includes `childCount` (the number of its child articles).
* description: Returns articles in a category the user is authorized for (omits child articles of a parent article), sorted alphabetically by name. Each article includes `childCount` (the number of its child articles).
* security:
* - cookieAuth: []
* x-markdown: category/articles.md
@@ -401,7 +401,8 @@ export function register(app, basePath = '') {
...a,
childCount: Number(a.childCount ?? 0),
isParent: Boolean(a.isParent ?? a.is_parent),
}));
}))
.sort((a, b) => (a.name ?? '').localeCompare(b.name ?? '') || a.id - b.id);
res.status(200).json({ articles });
} catch (error) {
const status = categoryErrorStatus(error);