type-graphql-series icon indicating copy to clipboard operation
type-graphql-series copied to clipboard

Dynamic resolvers with Decorators in Entity

Open paean99 opened this issue 6 years ago • 0 comments

I had time to brood about the previously mentioned idea in the PR #6 and i ended trying a possible solution. Although i think that it would be preferable to be implemented by type-graphql itself.

Like in the others PR i sent, i just had time to put the query working and didn't worried with mutation and its parameters. And like before i will feign to not have seen the innumerable ts-ignore spread all over the place...

The way it work is similar to the prototype code given in #6 Import the general functions for the resolvers and add them as a parameter to @autoQueries in entity. See the example in src\entity\Tomato.ts

Seem to works as it is, but mutations need more work. And also, it may break if used with more than one entity :(

Just a proof of concept or something in those lines.

p.s. Sorry. just saw that i should have cleaned the git history Ok Done the squash

paean99 avatar Jan 24 '19 21:01 paean99