import { Controller , Get , Query , Post , Put , Delete , Param , Body } from "@nestjs/common" ; import { Tags } from "nest-swagger" ; import { PhotoService } from "./photo.service" ; import { CreatePhotoDto , PhotoRes , EditPhotoDto } from "./../dto" ; import { NullableParseIntPipe , ResultList , KeyValue } from "nestx-common" ; import { Photo } from "../interfaces" ; @ Tags ( "cms" ) @ Controller ( "photo" ) export class PhotoController { constructor ( private readonly service ) { } @ Get ( "search" ) async search ( @ Query ( "keyword" ) keyword ? , @ Query ( "value" ) value ? ) { return this . service . search ( keyword , value ) ; } @ Post ( ) async create ( @ Body ( ) entry ) { return this . service . create ( entry ) ; } @ Put ( ) async update ( @ Body ( ) entry ) { return this . service . update ( entry ) ; } @ Get ( "query" ) async query ( @ Query ( "keyword" ) keyword ? , @ Query ( "page" , new NullableParseIntPipe ( ) ) page = 1 , @ Query ( "size" , new NullableParseIntPipe ( ) ) size = 10 , @ Query ( "sort" ) sort ? ) { return this . service . querySearch ( keyword , page , size , sort ) ; } @ Delete ( ":id" ) async remove ( @ Param ( "id" ) id ) { return this . service . remove ( id ) ; } @ Get ( ":id" ) async findOne ( @ Param ( "id" ) id ) { return this . service . findById ( id ) ; } }