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

Filtering by relationship values #699

Closed
willviles opened this issue May 14, 2017 · 0 comments
Closed

Filtering by relationship values #699

willviles opened this issue May 14, 2017 · 0 comments

Comments

@willviles
Copy link
Contributor

At present, support for filtering by relationship values is very limited.

It is possible to filter a belongsTo relationship by singular id value using a bit of a hack. For example, a user belongs to a permission group. We want to find all users with permission level 4:

http://localhost:4000/users?filter[permissionId]=4

Relationship ids

The query above should be represented by the relationship key without having to specify it as permissionId:

http://localhost:4000/users?filter[permission]=4

Multiple values should be able to be passed. For example, to get users with permissions of either 2 or 4:

http://localhost:4000/users?filter[permission]=2,4

Also hasMany relationships should accept single values or arrays of ids. For example, get all articles that are tagged with tag ID 8 or 10:

http://localhost:4000/articles?filter[tags]=8,10

Advanced filtering

Advanced filtering could allow for relationship values to be filtered. For example, selecting articles by tag name 'foo':

http://localhost:4000/articles?filter[tags][name]=foo

Also, taking #617 into consideration and allowing for filtering with > and < operators. For example, get all users with a permission id of greater than 2:

http://localhost:4000/users?filter[permission]=>2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants