almost-full-stack / graphcraft

Rapildy build and extend GraphQL API based on Sequelize models. This library helps you focus on business logic while taking care of GraphQL schema automatically.
https://almost-full-stack.github.io/graphcraft/
MIT License
51 stars 19 forks source link

Expose graphql-sequelize hooks to modify findOptions #59

Open jjcollinge opened 2 years ago

jjcollinge commented 2 years ago

Currently I'm trying to use a graphcraft model hook to apply an additional operation to the WHERE clause of a fetch. However, because the additional operation needs to be expressed as a Sequelize Literal query it gets mangled in the argsToFindOptions function of graphql-sequelize which stops it working. Would you be open to me adding a way to provide hooks that are directly added as graphql-sequelize hooks rather than invoked beforehand so that I can modify the findOptions directly.

alirizwan commented 2 years ago

Of course, please go ahead and raise a PR, will review it as soon as it's in.