I’ve been working in NestJs. I try to add in the object of @Query(), all the fields that were not entered in the query:
Dto:
{
a: number = null
b: number = null
c: number = null
}
Ex request:
POST url?a=5
I get:
query = {a:5}
I need:
query = {a: 5, b: null, c: null}
>Solution :
You need to enable the transformation on ValidationPipe like so: new ValidationPipe({ transform: true })
The default is false for performance reasons (I guess), which makes that query not an instance of your DTO