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

Olympia query node - relations filtering #2606

Conversation

ondratra
Copy link
Contributor

@ondratra ondratra commented Sep 2, 2021

DO NOT MERGE YET

This PR brings to query node a new feature - filtering by properties of related entities. It includes work from Joystream/hydra#453 & Joystream/warthog#3 into Olympia.

Some queries that work now:

videos(where: {channel: {title_eq: 'MyChannel'}}) {id} // N:1 relation
channels(where: {videos_some: {title_eq: 'MyVideo'}}) {id} // 1:N relation - at least one related object fulfils the condition
channels(where: {videos_none: {title_eq: 'MyVideo'}}) {id} // 1:N relation - none of related objects fulfil the condition
channels(where: {videos_every: {duration_eq: 60}}) {id} // 1:N relation - all related objects fulfil the condition (+ there exists at least one such related object)
storageBags(where: {storedBy_some: {id_eq: 1}}, orderBy: [createdAt_DESC]) {id, storedBy {id}} // N:M relation
events(where: {type_eq: AppliedOnOpeningEvent, inBlock_eq: 1, id_eq: 1}) {inBlock, type} // interface 

Before merging this PR, we need to make sure PRs mentioned above are merged first, Hydra version is bumped, and Hydra dependency version is bumped in this PR as well.

@ondratra ondratra requested a review from Lezek123 September 2, 2021 00:42
@@ -5,7 +5,7 @@
"author": "",
"license": "ISC",
"dependencies": {
"@dzlzv/hydra-cli": "3.1.0-alpha.0",
"@dzlzv/hydra-typegen": "3.1.0-alpha.0"
"@joystream/hydra-cli": "https://github.com/ondratra/hydra/releases/download/relation-selection-and-filtering/joystream-hydra-cli-v3.1.0-alpha.9_relationSelectionAndFiltering.tgz",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a temporary dependency target. I am using my repo before the feature will get merged into Hydra.

@@ -24,6 +24,7 @@
"pioneer/packages/*",
"utils/api-scripts",
"query-node",
"query-node/codegen",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one was purposefully excluded as a workspace, since the dependencies of hydra-cli / hydra-typegen may conflict with the monorepo dependencies (for example, this causes an issue on #2547 branch, where @polkadot/api was updated to 5.3.1 for the monorepo)

@Lezek123
Copy link
Contributor

Superseded by #2822

@Lezek123 Lezek123 closed this Jan 12, 2022
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

Successfully merging this pull request may close these issues.

2 participants