You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Drivine @transactional() decorator breaks Nest ValidationPipe if used with @UsePies()
import{Controller,Post,Body,ValidationPipe,UsePipes}from'@nestjs/common';import{Transactional}from'@liberation-data/drivine';import{SpotSaveRequestDto,SpotSaveDto}from'@slackmap/api/spot/dto';import{SpotRepository}from'@slackmap/api/spot/data';
@Controller()exportclassSpotSaveController{constructor(privatespotRepository: SpotRepository){}
@Post('spot/save')
@Transactional()// <<< if you comment this out, validation will work
@UsePipes(newValidationPipe())asyncprocess(@Body()data: SpotSaveRequestDto): Promise<SpotSaveDto>{constspot=awaitthis.spotRepository.create(data.spot)return{spot}}}
It will work if you use it on the method param like:
@NilsMoller If you have time and able to submit some usage patterns you have with GraphQL, I would like to provide some guidance for that in the docs.
Meanwhile, for the txn decorator. One solution would be to more tightly integrate with Nest. Originally I created this decorator to not use anything from Nest, so it would be easy to port Drivine to use with eg AWS Lambda. But didn't get time to take that forward. Eg Nest's way would use reflect-metadata, and their interceptor hooks.
Or another solution is just trace why order is important, and workaround what's happening.
Drivine @transactional() decorator breaks Nest ValidationPipe if used with @UsePies()
It will work if you use it on the method param like:
The text was updated successfully, but these errors were encountered: