Pieter
05/13/2018, 8:40 PMowner: User!
relationship. When I create the user I automatically create a PhoneBook for it. I then want to add a entry into the PhoneBook, but I need to link the entry. When calling ctx.db.mutation.creatEntry()
I need to have the phoneBookId to connect it. The only thing I have is the JWT, which gives me the UserId, but what do I do with it? I can't call ctx.db.query.user
as it doesn't return the phonebook entity with it. When I try to add a 2nd param and call ctx.db.query.user({where: {id}, '{ phonebook { id }}'})
it throws an error.matic
05/13/2018, 8:49 PMctx.db.mutation.createUser({
data: {
phoneBook: {
create: {
name: "Cool pb",
entries: {
create: [{
name: "entry"
}]
}
}
}
}
})
matic
05/13/2018, 8:50 PMPieter
05/13/2018, 9:00 PMPieter
05/13/2018, 9:00 PMPieter
05/13/2018, 9:01 PMPieter
05/13/2018, 9:02 PM"errors": [
{
"message": "You provided an invalid argument for the where selector on PhoneBook.",
ctx.db.query.phoneBook({where: {owner: {id}}})
Pieter
05/13/2018, 9:07 PMPieter
05/13/2018, 9:07 PM