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

feat(hydra-cli): add subclass filtering support for interfaces #442

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

dzhelezov
Copy link
Contributor

affects: @joystream/hydra-cli, @joystream/hydra-e2e-tests

this lays out a ground work for #438 Solution 1. This commit adds support for primitive fields on
subclasses and adds an e2e-test for it.

In particular, it already supports queries of the form

query getLatestMembershipEvents($memberId) {
  events(
    where: {
        type_in: [MembershipBoughtEvent, MemberProfileUpdatedEvent, MemberAccountsUpdatedEvent],
        membershipBoughtEvent: { newMemberId: $memberId },
        memberProfileUpdatedEvent: { memberId: $memberId },
        memberAccountsUpdatedEvent: { memberId: $memberId }
    },
    limit: 5,
    orderBy: [inBlock_DESC, indexInBlock_DESC]
  ) {
    ... on MembershipBoughtEvent {
      ...MembershipBoughtEventFields
    }
    ... on MemberProfileUpdatedEvent {
      ...MemberProfileUpdatedEventFields
    }
    ... on MemberAccountsUpdatedEvent {
      ...MemberAccountsUpdatedEventFields
    }
  }
}

but does not allow

where: {
    type_in: [
        OpeningFilledEvent,
        # ...
    ],
    openingFilledEvent: {
        hiredWorkers_some: { id: $workerId }
        # ...
    }
}

The latter require a better support for joins which is now a bit hacky and implemented in hydra-cli/src/templates/entities/service.ts.mst Indeed this part should be moved to the warthog library (together with all the tweaks introduced in hydra-cli/src/templates/graphql-server/src/WarthogBaseService.ts.mst

affects: @joystream/hydra-cli, @joystream/hydra-e2e-tests

this lays out a ground work for Joystream#438 Solution 1. This commit adds support for primitive fields on
subclasses and adds an e2e-test
Copy link
Contributor

@metmirr metmirr left a comment

Choose a reason for hiding this comment

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

Nice work!

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

Successfully merging this pull request may close these issues.

3 participants