I want to have something like
@ProtectResource()
handler(@Resource() resource: ResourceInterface) {
...
}
Where @Resource should have access to Reflector and RemoteService (provided with the same module as @Resource) in order to load all required data:
export const Resource = createParamDecorator(
async (data: unknown, ctx: ExecutionContext) => {
// TODO inject Reflector
const params = reflector.get('protect-uri', ctx.getHandler());
// TODO inject RemoteService
return remoteService.load(params.id);
},
);
Unfortunately, I wasn't able to find how I could inject Reflector and RemoteService in createParamDecorator neither in docs nor here.