How to use a Condition for a nested relation GQL

半世苍凉 提交于 2020-01-26 04:02:25

问题


I would like to be able to filter all of the awards by using a condition on the artist as shown below.The idea here is that I can then filter on multiple facets. By artist name, by event name/date and by categories in one query.

 query {
    allAwards {
      edges {
        node {
          nodeId
            categoryByCategoryId {}
            eventByEventId {}
            artistByArtistId(condition:{firstname:"Juan"}) {}
        }
      }
    }
 }

Is there a way to do a condition/filter on the artistByArtistId/categoryByCategoryId/eventByEventId that will only return awards that match say, the artists name?

Or is the only way to reverse the query as below:

 query {
    allArtists(condition:{firstname:"Juan"}) {
      edges {
        node {
          nodeId
          awardsByArtistId {
            edges {
              node {
                nodeId
              }
            }
          } 
        }
      }
    }
  }

Schema

Awards

Artists

来源:https://stackoverflow.com/questions/59524125/how-to-use-a-condition-for-a-nested-relation-gql

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!