Closed ConorCorp closed 3 months ago
Hey @ConorCorp
You cannot move the hook to VersionController
but you can decorate the ApproverController
class with it. In this way, it will apply for all methods of the sub-controller:
export class VersionController {
subControllers = [controller('/:versionId/approver', ApproverController)];
// ...other routes using /:versionId
}
@ValidatePathParam('versionId', { type: 'string', format: 'uuid' })
export class ApproverController {
@Get()
async getDocumentVersionApprovers(ctx: Context) {}
}
Ahhh that's lovely, thanks Loic. Keep up the good work!
Hey gang, Is there a way for me to ValidatePathParam in the VersionController? or just class wide in the ApproverController?
Basically, it would make a lot of sense if the versionId could be validated in the VersionController, and not in subcontrollers.