chore: add landing module
This commit is contained in:
@@ -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();
|
||||
}
|
||||
}
|
||||
@@ -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,
|
||||
};
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user