Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Apply a where filter to the related model #83

Open
anibalaguirreconsultora opened this issue Aug 18, 2017 · 2 comments
Open

Apply a where filter to the related model #83

anibalaguirreconsultora opened this issue Aug 18, 2017 · 2 comments

Comments

@anibalaguirreconsultora

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"

}
}

@Tallyb
Copy link
Owner

Tallyb commented Aug 18, 2017

check out this test

describe('Multiple entities', () => {

It should work.

@anibalaguirreconsultora
Copy link
Author

it works only for the parent model, not by the nested/related models properties

might be related to this loopback open issue?
strongloop/loopback#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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants