prisma-nestjs-graphql icon indicating copy to clipboard operation
prisma-nestjs-graphql copied to clipboard

[Question] Support for @Extensions?

Open ghost opened this issue 3 years ago • 3 comments
trafficstars

Hello, I am wondering if this could be supported.

https://docs.nestjs.com/graphql/extensions

ghost avatar May 24 '22 18:05 ghost

I think it has too dynamic nature.

@Field({ middleware: [checkRoleMiddleware] })
@Extensions({ role: Role.ADMIN })
password: string;

We need to import Role, checkRoleMiddleware...

I would make model as abstract (see https://github.com/unlight/prisma-nestjs-graphql#objecttype), then add own decorators, see https://docs.nestjs.com/graphql/resolvers#generics

unlight avatar May 25 '22 08:05 unlight

@unlight How I can mark Input classes as abstract? I'm looking for a solution to restrict create/connectOrCreate/delete/disconnect/upsert operations depending on user access and his roles

asanovr avatar Aug 01 '22 10:08 asanovr

@asanovr Check https://github.com/unlight/prisma-nestjs-graphql#objecttype

unlight avatar Aug 01 '22 18:08 unlight