Replies: 1 comment 2 replies
-
If I understand correctly, in this case you would define Person as a union type that could be either a Contact or Employee. Then you can define a data fetcher that returns this union type based on the filter
Then your data fetcher can be:
Hope this helps. |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Let me try to explain my question:
I have a table at the backend DB that stores 2 types of "entities" - eg "Person" which stores both "Contact" and "Employee" identified by a field "personType".
Can I define types "Contact" which fetches Person with filter (personType="contact") and "Employee" which fetches Person with filter (personType="employee")? Whats the best way to do this? One option I thought was to define separate fetchers for each type (Person, Contact and Employee) that applies respective filters. But this would duplicate the fetcher code for each type. Hence wanted to see if there is a better way to achieve this.
Beta Was this translation helpful? Give feedback.
All reactions