kratam
08/30/2018, 8:57 AMprisma-bindingnilan
08/30/2018, 10:59 AMkratam
08/30/2018, 12:49 PMdatamodel.graphqltype Item {
  id: ID! @unique
  foo: String!
}schema.graphqltype Query {
  search(something: String!): [Item!]!
}
type Item {
  id: ID!
  foo: String!
  bar: String #  <-- only in schema
}Item.jsexport const Item = {
  bar: async () => {
    return await someThingAsync()
  }
}Query.jsexport const Query = {
  search: async (parent, args, ctx, info) => {
    const items = await ctx.db.query.items({}, info)
    // this won't work, bar resolver will run in the future
    return items.filter(item => item.bar === args.something)
  }
}nilan
08/30/2018, 12:59 PMkratam
08/30/2018, 2:33 PMkratam
08/30/2018, 2:42 PMfilter// info is the same so no extra fields are requested from the db
const resolvedItemsWithBar = await Query.firstSearch(info: info)
return resolvedItemsWithBar.filter(item => item.bar === args.something)info