-
Notifications
You must be signed in to change notification settings - Fork 43
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
More extensive interface queries filtering #438
Labels
Comments
From the implementation pov Solution 1 seems feasible, probably that's the way to go. |
Superbly laid out @Lezek123 , and great job jumping on this so quick @dzhelezov . This feature does look a bit complex, but I can't think of anything else either. |
dzhelezov
added a commit
to dzhelezov/hydra
that referenced
this issue
Jun 30, 2021
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
dmtrjsg
added
highest-prio-feature
Highest priority new feature
high-prio
and removed
highest-prio-feature
Highest priority new feature
labels
Aug 17, 2022
7 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The problem
Pioneer v2 (https://github.com/Joystream/pioneer) needs to be able to query groups of events (including multiple different types of entities) for the purpose of displaying latest activity and notifications on the platform. (ie. member's latest activity, working group latest activity, member notifications etc.)
Currently for the purpose of grouping together different types of events, the
Event
interface was created:Allowing queries like:
As described in more detail in Joystream/pioneer#882 (comment), there is however a need to filter those events more specifically by relations like
member
,workingGroup
,proposal
orworker
, while only some types of events have those relationships available. This is currently not possible and any attempt to workaround this doesn't seem to work.There are a few additional, important things to consider:
OpeningFilledEvent
could be filtered either bymember
,worker
orworkingGroup
, so all of those filters should be availabe (which excludes the possibility of splittingEvent
interface into more specific interfaces)OpeningFilledEvent
, have one-to-many relationships with entities likemember
andworker
, so it should be possible to use a filter likemembers_some: { id: $memberId }
ormemberIds_includes: $memberId
.Solution 1 - allow filtering by specific type fields
The most futureproof solution would be to allow referencing interface childrens' (implementers') fields inside the interface query.
I would imagine a syntax like:
Translating to a query:
Note that a filter like this would also need to be supported:
Solution 2 - support privitive arrays filtering
Because relationships doesn't yet seem to be supported by interfaces (#359),
I considered adding optional
ID
and[ID]
fields to anEvent
interface just for the purpose of filtering:This would be a bit limiting, but probably enough to support Pioneer v2 at the current stage.
The problem here is that primitive array filtering doesn't seem to be supported either, so I cannot create a query like:
(note: the array field seems to actually be represented as
Text
field in the database)Solution 3 - suppport relationships in interface
Another way to solve this would be to add support for relationships (#359)
and relationship filtering to interfaces. This would allow, for example, "outsourcing" the
EventRelations
to another entity:And then possibly construct a query like:
The text was updated successfully, but these errors were encountered: