I am trying to create a DTO file to transform the values and save a Document.
export class CreateProductDto {
readonly pricing: {
readonly list: number;
}
}
async create(@Body() createProductDto: CreateProductDto) {
console.log(createProductDto);
console.log(createProductDto.pricing.list);
}
import * as mongoose from 'mongoose';
export const ProductSchema = new mongoose.Schema({
pricing: {
list: {
type: Number,
},
},
});
But the value of princing.list is undefined.
What is the correct way to do this in NestJS?