Query with input arg schema definition

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
            }
          }
        }
      }
    }
  1. Does this mean my query must have a resolver and hence I have to define a resolver/function in Fauna?
  2. 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 …

1 Like

To make sure we easily find unsolved posts, could you mark your own answer as solved? If you can’t feel free to mark this one or add a ‘solved reply’ yourself and mark that one.

1 Like