You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
When developing with type-graphql you often notice your class files are growing absolutely enormous.
This alows consumers of your graphql schema to go way beyond REST and instantly see what mutations are available for a given entity.
Describe alternatives you've considered
I have tried to implement something like this within the framework. As follows:
@Resolver(()=>Portfolio)classPortfolioResolver{
@Mutation(()=>PortfolioMutationNamespace)asyncmutatePortfolio(
@Arg(`_id`,()=>ObjectIdScalar)_id: ObjectId,
@Ctx(){ identity }: GraphQLContext,){constportfolio=awaitPortfolioModel.findById(_id);if(portfolio?.owner.sub!==identity.sub){thrownewAuthenticationError(`You do not have permission to update this portfolio`,);}// Return the namespacereturnnewPortfolioMutationNamespace(_id);}}
I just saw a few of the previous issues after I posted this. I did not think about serial vs parallel mutations in this instance. OBviously this will need to be supported in the graphql spec first
Is your feature request related to a problem? Please describe.
When developing with
type-graphql
you often notice your class files are growing absolutely enormous.Describe the solution you'd like
One cool paradigm is the use of mutation namepsaces https://graphql-rules.com/rules/mutation-namespaces.
This alows consumers of your graphql schema to go way beyond REST and instantly see what mutations are available for a given entity.
Describe alternatives you've considered
I have tried to implement something like this within the framework. As follows:
But I get
Cannot read property 'getObjectType' of undefined
and error when building my schema.It seems that a
@Mutation()
needs to return an@ObjectType
and it currently does not support returning another@Resolver
type.If the library supported this use case, it would be awesome!
The text was updated successfully, but these errors were encountered: