chore: add landing module
This commit is contained in:
@@ -0,0 +1,53 @@
|
||||
import { Body, Controller, Delete, Get, Param, Patch, Post, Query } from "@nestjs/common";
|
||||
import { ApiOperation } from "@nestjs/swagger";
|
||||
|
||||
import { CreateSliderDto } from "./DTO/create-slider.dto";
|
||||
import { UpdateSliderDto } from "./DTO/update-slider.dto";
|
||||
import { SlidersService } from "./providers/sliders.service";
|
||||
import { AdminRoute } from "../../common/decorators/admin.decorator";
|
||||
import { AuthGuards } from "../../common/decorators/auth-guard.decorator";
|
||||
import { PaginationDto } from "../../common/DTO/pagination.dto";
|
||||
import { ParamDto } from "../../common/DTO/param.dto";
|
||||
// import { PermissionsDec } from "../../common/decorators/permission.decorator";
|
||||
|
||||
@Controller("sliders")
|
||||
@AuthGuards()
|
||||
export class SlidersController {
|
||||
constructor(private readonly slidersService: SlidersService) {}
|
||||
|
||||
@ApiOperation({ summary: "create slider (admin route)" })
|
||||
@AdminRoute()
|
||||
// @PermissionsDec(PermissionEnum.SLIDER)
|
||||
@Post()
|
||||
create(@Body() createSliderDto: CreateSliderDto) {
|
||||
return this.slidersService.create(createSliderDto);
|
||||
}
|
||||
|
||||
@ApiOperation({ summary: "Get all sliders" })
|
||||
@AdminRoute()
|
||||
@Get()
|
||||
getSlidersList(@Query() queryDto: PaginationDto) {
|
||||
return this.slidersService.getSlidersList(queryDto);
|
||||
}
|
||||
|
||||
@ApiOperation({ summary: "Get a slider by id" })
|
||||
@AdminRoute()
|
||||
@Get(":id")
|
||||
getSliderById(@Param() paramDto: ParamDto) {
|
||||
return this.slidersService.getSliderById(paramDto.id);
|
||||
}
|
||||
|
||||
@ApiOperation({ summary: "Update a slider" })
|
||||
@AdminRoute()
|
||||
@Patch(":id")
|
||||
update(@Param() paramDto: ParamDto, @Body() updateSliderDto: UpdateSliderDto) {
|
||||
return this.slidersService.update(paramDto.id, updateSliderDto);
|
||||
}
|
||||
|
||||
@ApiOperation({ summary: "Delete a slider" })
|
||||
@AdminRoute()
|
||||
@Delete(":id")
|
||||
remove(@Param() paramDto: ParamDto) {
|
||||
return this.slidersService.remove(paramDto.id);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user