SELF-SOLVED: This query is unnecessary because the existence of the User type in the schema means that a query ‘findUserByID’ will automatically be created by Faunadb. Simply replace userRankingsByUserId with findUserByID and then define the query (below) in the code.
I want to create query in my schema that corresponds to the following:
query UserRankingsByUserId {
userRankingsByUserId(id: "290125535875432961") {
username
ownerOf {
data {
_id
rankingname
}
}
memberOf {
data {
ladder {
_id
rankingname
}
}
}
}
}
- Does this mean my query must have a resolver and hence I have to define a resolver/function in Fauna?
- Or is there a way to define the query in the schema without a resolver and just construct the query in my client app code?
If 2, then how should I define the query since
type Query {
userRankingsByUserId (id: String!): User
Gives me:
Schema does not pass validation. Violations:
Object 'User' does not have a field named 'id'. (line 35, column 25):
userRankingsByUserId (id: String!): User
when I attempt to update the schema?
thanks …