MichalLytek / typegraphql-prisma

Prisma generator to emit TypeGraphQL types and CRUD resolvers from your Prisma schema
https://prisma.typegraphql.com
MIT License
891 stars 113 forks source link

Authorization annotations #458

Open bkostrowiecki opened 4 months ago

bkostrowiecki commented 4 months ago

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:

Describe alternatives you've considered