Open jasonmacdonald opened 2 years ago
There is a way to add any decorator to any generated class https://github.com/unlight/prisma-nestjs-graphql#decorate
As far as I can tell, this only adds it to the ObjectType, not the InputTypes. :(
This test is adding decorator for ProfileUncheckedCreateNestedOneWithoutUserInput
which is @InputType
decorated
Ah, I see, you aren't using an annotation in the Prisma file. I don't really want to have to call out every single input on every model like that if I can avoid it. I was using...
/// @Directive({ arguments: ['@Authz(roles:{create: ["ADMIN"], update:["ADMIN","OWNER"]})']})
model User {
...
}
And this only added the Directive to the ObjectType. :( I was trying to Decorate the Input classes, not the properties.
@unlight any updates? no way to decorate InputType or ObjectType class, like this?
@ObjectType()
@Extensions({ is: true })
export class AggregateGame {
I'm trying to figure out if it's possible to add a decorator to all
@InputType
classes instead of just on the@ObjectType
. The reason being is that I'm trying to add role permission checking, and it would be nice to do that on the InputType, but thus far, I haven't found the right combination to do that. Is it not possible? Can we only validate/decorate fields on@InputTypes
?