I try to use plainToInstance function from class transformer but when i try to map field from repose to my DTO it can mapping but it incorrect in my DTO i have some field i want to response but when mapped finish it return all field
async createContainer(@Query('name') name:string): Promise<CreateContainerDto> {
console.log(name);
try{
const res = await this.imageService.createContainer(name)
const dto = plainToInstance(CreateContainerDto,res)
console.log(res);
console.log(dto);
return dto
}
This is my service try to mapping response to DTO
import { IsDate, IsString } from "class-validator"
export class CreateContainerDto{
@IsString()
etag: string
@IsString()
requestId: string
@IsDate()
date: Date
}
I want response some field to user