Apply a where filter to the related model
Hello
I am doing some test queries using your plugin over a loopback application.
I want to apply a where filter to the related model .
Does the "where" parameter of type JSON works with related model properties ?
In the below example: the second "where" filter (where: {name: "SMH"} ) on the related model is not working ..
query ListEntities($where: JSON!) { allEntityRoles(where: $where, first: 10) { totalCount EntityRoles { id entity(where: {name: "SMH"}) { edges { node { id entCode name } } }
}
} }
variable: { "where": { "CompanyId": "aa5d2125-bcfc-4808-ae55-5aec699f3509", "EntityRoleTypeId": "f3e03826-28cb-4d72-ad71-7b5e174dbfb9"
} }
check out this test https://github.com/Tallyb/loopback-graphql/blob/3401c7599439e9437c686135abbe25cc5a35cff7/test/query.spec.ts#L37 It should work.
it works only for the parent model, not by the nested/related models properties
might be related to this loopback open issue? https://github.com/strongloop/loopback/issues/517
i installed postgraphql wich talks to postgres db directly not through the loopback models and i was able to run a query filtering by properties on the related/nested models.