import { Controller , Post , Logger , Get , Body , Param , Put , UseInterceptors , CacheInterceptor } from '@nestjs/common' ; import { CreateMediaDto } from './dto/create-media.dto' ; import { MediasService } from './medias.service' ; import { UpdateMediaDto } from './dto/update-media.dto' ; import { IsMongoId } from 'class-validator' ; class FindMongoId { @ IsMongoId ( ) id : string ; } @ Controller ( 'medias' ) export class MediasController { constructor ( private readonly mediasService ) { } @ Post ( '/' ) create ( @ Body ( ) createMediaDto ) { return this . mediasService . create ( createMediaDto ) ; } @ Put ( '/:id' ) update ( @ Param ( ) params , @ Body ( ) updateMediaDto ) { return this . mediasService . update ( params . id , updateMediaDto ) ; } @ Get ( '/:id' ) getById ( @ Param ( ) params ) { return this . mediasService . getById ( params . id ) ; } @ Get ( '/' ) get ( ) { return this . mediasService . get ( ) ; } }