chore: add landing module

This commit is contained in:
mahyargdz
2025-04-13 11:57:03 +03:30
parent 78f481871c
commit 6f55f7a1d6
14 changed files with 210 additions and 81 deletions
+20 -2
View File
@@ -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();