#Use global ValidationPipe on custom pipeline
17 messages · Page 1 of 1 (latest)
What is IdentifyCustomer and Customer is the same as CustomerDto ?
I tried to look here in the documentation if I could find something, I can't tell you. But the way you're doing it seems very strange to me, but it has nothing to do with what you asked for.
I think it's better to wait for a member of the core team to come and help you.
The order of execution should follow this: https://docs.nestjs.com/faq/request-lifecycle
Nest is a framework for building efficient, scalable Node.js server-side applications. It uses progressive JavaScript, is built with TypeScript and combines elements of OOP (Object Oriented Programming), FP (Functional Programming), and FRP (Functional Reactive Programming).
I wonder why you are trying to create a customPipe if you can simply pass the DTO as typing to the body.
That's why I didn't question it, maybe you were trying to do something different on your own... Sometimes I do that but I think this solution you created isn't very useful.
@Post('/customerIdentify')
async login(
@Body() intendedApp: CustomerDto, {}
}
Like this
I see... I don't know a good way to do it
You can do this after the validation
IntendedApp will be exactly CustomerDto
So you pass it to the service and there you turn into Customer
Can not be that way ?
This way, dto will 100% validate and you will transform it after..
.
try something like this
@UsePipes(new ValidationPipe({ transform: true }))
@UsePipes(SanitizeNamePipe)
@UsePipes(ValidateAgePipe)
async createUser(@Body() createUserDto: CreateUserDto) {