import { Type } from 'class-transformer' ; import { GetManyDefaultResponse } from '../interfaces' ; import { ApiProperty } from './swagger.helper' ; export class SerializeHelper { static createGetManyDto ( dto , resourceName ) { class GetManyResponseDto implements GetManyDefaultResponse < any > { @ ApiProperty ( { type : dto , isArray : true } ) @ Type ( ( ) => dto ) data : any [ ] ; @ ApiProperty ( { type : 'number' } ) count : number ; @ ApiProperty ( { type : 'number' } ) total : number ; @ ApiProperty ( { type : 'number' } ) page : number ; @ ApiProperty ( { type : 'number' } ) pageCount : number ; } Object . defineProperty ( GetManyResponseDto , 'name' , { writable : false , value : `GetMany${ resourceName }ResponseDto` , } ) ; return GetManyResponseDto ; } static createGetOneResponseDto ( resourceName ) { class GetOneResponseDto { } Object . defineProperty ( GetOneResponseDto , 'name' , { writable : false , value : `${ resourceName }ResponseDto` , } ) ; return GetOneResponseDto ; } }