Is your feature request related to a problem? Please describe.
I would like to generate resolvers with @Authorized decorators so generated API is protected by unauthorized access.
Describe the solution you'd like
I would like to have annotaions that add @Authorized decorator to resolvers. For example:
/// @TypeGraphQL.Authorized(create:'admin,editor', read:null, update:'admin,editor', delete:'admin')
model Post {
/* ... */
}
Given example should result in:
create resolver accepts admin and editor role
read resolver accepts all users, even unauthorized
update resolve accepts admin and editor role
delete accepts only admin role.
Describe alternatives you've considered
using 3rd party library to add authorization for resolvers as middleware.
adding @Authorized decorator manually to generated resolvers. All of them are lost after regenerating the code, so it's the worst solution.
Is your feature request related to a problem? Please describe. I would like to generate resolvers with
@Authorized
decorators so generated API is protected by unauthorized access.Describe the solution you'd like I would like to have annotaions that add
@Authorized
decorator to resolvers. For example:Given example should result in:
admin
andeditor
roleadmin
andeditor
roleadmin
role.Describe alternatives you've considered
@Authorized
decorator manually to generated resolvers. All of them are lost after regenerating the code, so it's the worst solution.