OK so I have the following types, with the "Spot" type coming from prisma.
type Query {
SpotDetails(id: ID!, lat: String, long: String, regLocation: String): SpotDetails!
Spots: [Spot!]!
}
type SpotDetails {
info: Spot!
regulations: [SpotRegulation]
}
type SpotRegulation {
regulationNumber: String
generalRegText: String
waters: String
seasons: String
bags: String
notes: String
}
How do I create the resolver where I can query Prisma for a spot by id
and then combine it with the other fields from the SpotRegulation
type? Basically I want to be able to query SpotDetails
.
Right now for the resolver I have the following, but I do not think it is working because the info provided to the Prisma query is the SpotDetails
info and not the Spot
info that it is expecting.
SpotDetails(parent, args, ctx, info) {
let { id } = args;
let details = new Object();
details['info'] = ctx.db.query.spot({ where: { id } }, info);
},
Here is the query I'm using on graphQL playground to test this
query {
SpotDetails(id:"cjkbwq1nm00310a958udjcr20"){
regulations{
notes
}
}
}