Please donât worry about questions, itâs quite possible I could overlook something simple (my db experience is patchy).
I believe the links are there because the GQL fetches the data using Basic authentication. So it should, therefore, just be a token authentication issue, or does that miss the point(?).
Your custom role had a couple of Index references that mine didnât so I added them:
name: "logged-in",
privileges: [
{
resource: Collection("User"),
actions: {
read: true
}
},
{
resource: Collection("Ranking"),
actions: {
read: true
}
},
{
resource: Collection("Player"),
actions: {
read: true
}
},
{
resource: Index('ownerranking_by_user'),
actions: {
read: true
}
},
{
resource: Index('playerinranking_by_user'),
actions: {
read: true
}
}
,
{
resource: Index('unique_User_username'),
actions: {
read: true
}
}
,
{
resource: Index("playerchallenger_by_player"),
actions: {
read: true
}
},
{
resource: Index("player_ladder_by_ranking"),
actions: {
read: true
}
},
{
resource: Index("ladder_in_player_by_ranking"),
actions: {
read: true
}
}
],
membership: [
{ resource: Collection("User") }
]
As well as ensuring that any other fauna generated indexes e.g. player_ladder_by_ranking (that you mentioned) and another possible one âladder_in_player_by_rankingâ were also included.
However, no change to the data returned in PG:
{
"data": {
"findUserByID": {
"_id": "294007769929875981",
"username": "Test1",
"description": "t1",
"ownerOf": {
"data": []
},
"memberOf": {
"data": []
}
}
}
}
I tried with and without:
{
resource: Index('unique_User_username'),
actions: {
read: true
}
}
since I had previously included it, but you had not.
I have also cut out, what I believe to be, for now, unnecessary query definitions in my schema which is now:
type User {
active: Boolean!
username: String! @unique
description: String
email: String @unique
mobile: String @unique
ownerOf: [Ranking!]! @relation(name:"ownerranking")
memberOf: [Player!]! @relation(name: "playerinranking")
}
type Player {
active: Boolean!
rank: Int!
ladder: Ranking! @relation # add the relation Directive
playerInfo: User! @relation(name: "playerinranking")
challenger: Player @relation (name: "playerchallenger")
}
type Ranking {
active: Boolean!
rankingname: String!
rankingdesc: String
player: [Player] @relation # add the relation
owner: User! @relation(name:"ownerranking")
}
type Mutation {
createNewRanking(active: Boolean!, rankingname : String!, rankingdesc : String, rankingownerid : String!): Ranking! @resolver(name: "create_new_ranking")
createNewUser(active: Boolean!, username : String!, password : String!, description: String, email: String, mobile: String): loginResult! @resolver(name: "create_new_user")
loginUser(username: String!, password: String!): loginResult! @resolver(name: "login_user")
updateResult(challengeresult: ChallengeResult! playerrank: Int! opponentrank: Int!): Result! @resolver(name: "update_result")
}
enum ChallengeResult {
Won
Lost
Abandoned
}
type loginResult @embedded
{
token : String
logginUser : User
}
type Result @embedded {
challengeresult: ChallengeResult!
playerrank: Int!
opponentrank: Int!
message: String!
}
If you can think of anything else I might have missed (?), please let me know. In the meantime, I have narrowed down the query to just:
findUserByID(id: "294007769929875981") {
_id
username
description
ownerOf {
data {
_id
rankingname
rankingdesc
}
}
}
}
as I expect resolving that alone will help answer the memberOf issue as well.
Thanks again âŚ