Lotafak
02/25/2019, 12:22 PMjavascript-client
and previously was using graphql-binding
.
So, previously I was using this to grab data with all the relationships underneath
await ctx.db.query.accounts({
where: { user: { id }, role },
orderBy: 'createdAt_ASC',
last: 1,
}, `{
contact { phone, phone2, skype, address }
}`)
datamodel
type User {
id: ID! @unique
createdAt: DateTime!
updatedAt: DateTime!
accounts: [Account!]! @relation(name: "UsersAccount")
}
type Account {
id: ID! @unique
createdAt: DateTime!
user: User! @relation(name: "UsersAccount")
role: Role!
contact: Contact @relation(name: "AccountsContact")
}
type Contact {
id: ID! @unique
updatedAt: DateTime!
account: Account! @relation(name: "AccountsContact")
phone: String!
phone2: String
skype: String
address: String!
}
now, going from ctx.db.query.accounts
to ctx.db.accounts
results in empty relations data.
How should I call it so it returns the relations data properly for me?Harshit
02/25/2019, 5:51 PMHarshit
02/25/2019, 5:52 PMHarshit
02/25/2019, 5:52 PMLotafak
02/25/2019, 10:35 PMHarshit
02/26/2019, 5:10 AMHarshit
02/26/2019, 5:10 AM