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
+15
View File
@@ -0,0 +1,15 @@
import { Controller, Get } from "@nestjs/common";
import { ApiOperation } from "@nestjs/swagger";
import { LandingService } from "./providers/landing.service";
@Controller("landing")
export class LandingController {
constructor(private readonly landingService: LandingService) {}
@ApiOperation({ summary: "Get all landing page data" })
@Get()
async getLandingData() {
return this.landingService.getLandingData();
}
}
+15
View File
@@ -0,0 +1,15 @@
import { Module } from "@nestjs/common";
import { LandingController } from "./landing.controller";
import { LandingService } from "./providers/landing.service";
import { BlogsModule } from "../blogs/blogs.module";
import { DanakServicesModule } from "../danak-services/danak-services.module";
import { SlidersModule } from "../sliders/sliders.module";
@Module({
imports: [SlidersModule, BlogsModule, DanakServicesModule],
controllers: [LandingController],
providers: [LandingService],
exports: [LandingService],
})
export class LandingModule {}
@@ -0,0 +1,27 @@
import { Injectable } from "@nestjs/common";
import { BlogsService } from "../../blogs/providers/blogs.service";
import { DanakServicesService } from "../../danak-services/providers/danak-services.service";
import { SlidersService } from "../../sliders/providers/sliders.service";
@Injectable()
export class LandingService {
constructor(
private readonly slidersService: SlidersService,
private readonly blogsService: BlogsService,
private readonly danakServices: DanakServicesService,
) {}
async getLandingData() {
const [sliders, pinnedBlogs, danakSuggestServices] = await Promise.all([
this.slidersService.getSlidersListForLanding(),
this.blogsService.getPinnedBlogs(),
this.danakServices.getDanakSuggestServices(),
]);
return {
sliders,
pinnedBlogs: pinnedBlogs.blogs,
danakSuggestServices: danakSuggestServices.danakServices,
};
}
}