update: add blog category to the blog in landing

This commit is contained in:
mahyargdz
2025-04-23 10:36:29 +03:30
parent 385181b30f
commit 4d01c87eb2
@@ -189,6 +189,8 @@ export class BlogsRepository extends Repository<Blog> {
async getPinnedBlogs(limit: number = 4) {
return this.createQueryBuilder("blog")
.leftJoinAndSelect("blog.category", "category")
.addSelect(["category.id", "category.title", "category.iconUrl"])
.where("blog.deletedAt IS NULL")
.andWhere("blog.isActive = :isActive", { isActive: true })
.andWhere("blog.isPinned = :isPinned", { isPinned: true })
@@ -202,6 +204,9 @@ export class BlogsRepository extends Repository<Blog> {
"blog.slug",
"blog.createdAt",
"blog.viewCount",
"category.id",
"category.title",
"category.iconUrl",
])
.orderBy("blog.createdAt", "DESC")
.take(limit)