Closed backops-threed closed 3 years ago
Thanks to @AhmedElywa for helping me out on Slack.
Solution
When the prisma model is inside another node on GraphQL, we can use valueOf
instead of value
.
Ref: https://paljs.com/plugins/select#valueof
So, on my case, the solution was:
const select = new PrismaSelect(info).valueOf('edges', 'FeedPost');
Versions:
File
schema.prisma
:File
schema.graphql
:My PrismaSelect code:
What's right: For this graphql query:
const select
will be:So, cover, since on
prisma.schema
isJson
returns ascover: true
, and afterapollo-server
will deal with the fields insidecover
.The problem: In my specific case, I need to return pagination data with a different query. So my query for that will be this, with the
FeedPost
fields inside anedge
node:With this query, my
const select
will return this:Since on Prisma
cover
is a Json and now I'm trying to select fields inside it, Prisma tries to usecover
as a relation and that gives me a error: