chore: add landing module
This commit is contained in:
@@ -175,8 +175,23 @@ export class BlogsService {
|
||||
//*********************************** */
|
||||
|
||||
async getBlogsPublic(queryDto: BlogSearchQueryDto) {
|
||||
const blogs = await this.blogsRepository.getBlogsForUserSide(queryDto);
|
||||
return { blogs };
|
||||
const [blogs, count] = await this.blogsRepository.getBlogsForUserSide(queryDto);
|
||||
|
||||
//;
|
||||
return {
|
||||
blogs,
|
||||
count,
|
||||
paginate: true,
|
||||
};
|
||||
}
|
||||
//*********************************** */
|
||||
|
||||
async getCombinedBlogs() {
|
||||
const [pinnedBlogs, mostVisitedBlogs] = await Promise.all([
|
||||
this.blogsRepository.getPinnedBlogs(),
|
||||
this.blogsRepository.getMostVisitedBlogs(),
|
||||
]);
|
||||
return { pinnedBlogs, mostVisitedBlogs };
|
||||
}
|
||||
//*********************************** */
|
||||
|
||||
@@ -244,17 +259,20 @@ export class BlogsService {
|
||||
return category;
|
||||
}
|
||||
|
||||
//*********************************** */
|
||||
async incrementViewCount(id: string) {
|
||||
const blog = await this.findBlogById(id);
|
||||
blog.viewCount += 1;
|
||||
await this.blogsRepository.save(blog);
|
||||
return { message: "View count incremented successfully" };
|
||||
}
|
||||
//*********************************** */
|
||||
|
||||
async getMostVisitedBlogs() {
|
||||
const blogs = await this.blogsRepository.getMostVisitedBlogs();
|
||||
return { blogs };
|
||||
}
|
||||
//*********************************** */
|
||||
|
||||
async getPinnedBlogs() {
|
||||
const blogs = await this.blogsRepository.getPinnedBlogs();
|
||||
|
||||
Reference in New Issue
Block a user