any idea how to solve it in a more efficient way so im not doing unecessary database queries?
Victor Björklund
01/17/2021, 2:06 PM
How i ended up solving it. By looking at wether or not the organization field is queried. If it is then I use “include” in prisma otherwise not.
Victor Björklund
01/17/2021, 2:08 PM
And then in the resolver for organization in user i check wether organization is included or not in the user object. If it is I return that otherwise I make a new call with prisma to find organizations.
Victor Björklund
01/17/2021, 2:09 PM
This solution “works” but it is not very nice or easy solution. Im sure there must be a smarter way to do this without overfetching.