Joseph Carrington
10/08/2018, 6:50 PMQuery: {
async cart(obj, args, context, info) {
const { user_id } = await getUserFromAuthorizationHeader(
context.authorization
);
const cart = await prisma.portalCart({owner: user_id});
return cart;
}
}
}
Cart: {
async items(obj, args, context, info) {
const items = await prisma.portalCart({ owner: obj.owner }).items();
return items;
}
}
is that await prisma.portalCart({ owner: obj.owner }).items() using a cached version of portalCart, or is it having to fetch it again? If so, Is there a way to get both the cart AND it’s items? What I am trying to avoid is having to do two different queries for prisma.cart() if I can avoid it.hinsxd
10/08/2018, 8:09 PMCart: type should be placed outside/along with Query.
What client are you using? For example in Apollo Client, what is your fetchPolicy?
Unfortunately you have to implement resolver and use prisma for every non-scalar fields, AFAIK.Joseph Carrington
10/08/2018, 8:20 PMcache-first