update: add blog category to the blog in landing
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user