hello, I am trying to figure out the right way to ...
# orm-help
r
hello, I am trying to figure out the right way to express some relationships in my schema as well as the resolvers that map to it. Could use some help and guidance! Relevant schema:
Copy code
type MemberForm {
  id: ID! @unique
  name: String! @unique
  description: String
  formEntries: [MemberFormEntry!]!
}

type MemberFormEntry {
  id: ID! @unique
  form: [MemberForm!]!
  formItem: MemberFormItem!
  required: Boolean @default(value: "false")
  weight: Int
  label: String
  placeholder: String
  hint: String
}

type MemberFormItem {
  id: ID! @unique
  name: String! @unique
  kind: FormItemKind @default(value: "TEXT")
  formEntry: MemberFormEntry
}
relevant api schema:
Copy code
# import {} from './generated/prisma.graphql'
type Query {
  memberForms: [MemberForm!]!
}
relevant resolver:
Copy code
memberForms: (parent, args, ctx, info) => ctx.db.query.memberForms(info)
However, when I run the following query, I don’t get any
formEntries
back:
Copy code
memberForms {
  id
  formEntries {
    id
  }
}
I can see the list of
formEntries
when I use the playground and hit Prisma directly, but I am not able to get the same result when using the resolved API endpoint, so I am guessing that I am missing something in my resolver for the relationship to work properly
n
I think you're missing an argument in the
memberForms
Prisma query
Copy code
memberForms: (parent, args, ctx, info) => ctx.db.query.memberForms({}, info)
r
Can you please explain the empty
{}
arg @nuno . Thanks
Any relevant links to the docs would also be very helpful
n
It's the
args
argument. I'm assuming you're using Prisma Bindings in javascript. If you used typescript, you could easily see the problem in your code.