diff --git a/src/modules/article/article.controller.ts b/src/modules/article/article.controller.ts index 8b04dca..b860e5a 100644 --- a/src/modules/article/article.controller.ts +++ b/src/modules/article/article.controller.ts @@ -56,9 +56,15 @@ export class ArticleController extends Controller { }); for (const [index, tagId] of body.tag_ids.entries()) { - const tag = await orm.em.findOne(Tag, { - id: tagId, - }); + const tag = await orm.em.findOne( + Tag, + { + id: tagId, + }, + { + populate: ["*"], + }, + ); if (!tag) { return res.status(404).json({ data: null, @@ -101,6 +107,7 @@ export class ArticleController extends Controller { limit: query.per_page, offset: (query.page - 1) * query.per_page, orderBy: { createdAt: "DESC" }, + populate: ["*"], }); return res.status(200).json({ @@ -122,7 +129,13 @@ export class ArticleController extends Controller { } const params = parseParamsResult.data; - const article = await orm.em.findOne(Article, { slug: params.slug }); + const article = await orm.em.findOne( + Article, + { slug: params.slug }, + { + populate: ["*"], + }, + ); if (!article) { return res.status(404).json({ data: null, @@ -159,7 +172,13 @@ export class ArticleController extends Controller { } const body = parseBodyResult.data; - const article = await orm.em.findOne(Article, { slug: params.slug }); + const article = await orm.em.findOne( + Article, + { slug: params.slug }, + { + populate: ["*"], + }, + ); if (!article) { return res.status(404).json({ data: null,