Allow deferred types and silent authMode per Authorized decorator
angelhodar opened this issue · comments
Angel commented
Is your feature request related to a problem? Please describe.
I am having problems with circular dependency when using a user role enum on Authorized in props (no problem in resolvers). Also I dont want to throw errors when access is denied to a single prop, just return null. But if the decorator is used in a resolver, it is fine to return the errors. The current solution is global by defining the authMode: "null"
in the buildSchema
.
Describe the solution you'd like
I would like something like this:
@Authorized(() => [UserType.STAFF, UserType.MANAGER], { silent: true })
@Field({ nullable: true })
someProp: boolean;
Michał Lytek commented
Declare the enum type in separate file, aside from other object types.