u
This commit is contained in:
@@ -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 father 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). Each article includes `childCount` (the number of its child articles).
|
||||
* security:
|
||||
* - cookieAuth: []
|
||||
* x-markdown: category/articles.md
|
||||
@@ -396,11 +396,11 @@ export function register(app, basePath = '') {
|
||||
try {
|
||||
const allArticles = await db.getCategoryArticles(req.user.id, parsed.id);
|
||||
const articles = allArticles
|
||||
.filter((a) => a.fatherArticleId == null)
|
||||
.filter((a) => a.parentArticleId == null)
|
||||
.map((a) => ({
|
||||
...a,
|
||||
childCount: Number(a.childCount ?? 0),
|
||||
isFather: Boolean(a.isFather ?? a.is_father),
|
||||
isParent: Boolean(a.isParent ?? a.is_parent),
|
||||
}));
|
||||
res.status(200).json({ articles });
|
||||
} catch (error) {
|
||||
|
||||
Reference in New Issue
Block a user