Skip to content
This repository has been archived by the owner on Apr 17, 2023. It is now read-only.

Filtering across relationships #1343

Open
lastmjs opened this issue May 29, 2020 · 6 comments
Open

Filtering across relationships #1343

lastmjs opened this issue May 29, 2020 · 6 comments

Comments

@lastmjs
Copy link

lastmjs commented May 29, 2020

Things have been going very well for me today! I've started to incorporate graphback into a large project to get rid of Prisma.

One significant issue I am facing is a limitation with filtering. Prisma had a way to filter across relationships. This is especially useful when filtering across a one to many relationship.

I have a one-to-many relationship from an entity called Companies, to an entity called Invoices. Each company has many invoices. I want to be able to filter all companies based on fields in the invoices. For example, I would write something like this with Prisma:

query($forMonth: String!) {
  companies(
    where: {
      canceled: false
      invoices_some: {
        for_month: $forMonth
      }
    }
  ) {
    id
}

This allows me to get all companies where at least one invoice is in the month I am searching for.

Can graphback support this type of filtering?

Originally posted by @lastmjs in #1260 (comment)

@wtrocki
Copy link
Contributor

wtrocki commented May 31, 2020

We have filtering enabled for relationships.
https://github.com/aerogear/graphback/blob/master/packages/graphback-codegen-schema/tests/__snapshots__/GraphQLSchemaCreatorTest.ts.snap#L21

We do not support aggregations - group by etc.(yet)

@wtrocki
Copy link
Contributor

wtrocki commented May 31, 2020

Actually we do not support bidirectional filtering now. See:
#1338

@lastmjs
Copy link
Author

lastmjs commented Jun 8, 2020

Also, there is no support for filtering across many to many relationships as far as I can tell

@craicoverflow
Copy link

@wtrocki @machi1990 are we looking to get this in before or after 0.14.0?

@lastmjs
Copy link
Author

lastmjs commented Jul 24, 2020

Looks like after. I really hope to get this soon, very foundational requirement IMO

@machi1990
Copy link
Contributor

Thanks for bumping this @lastmjs , added a triage label and we'll prioritise this over the coming weeks.

@craicoverflow craicoverflow removed this from the Graphback 1.0-beta milestone Sep 15, 2020
# for free to subscribe to this conversation on GitHub. Already have an account? #.
Projects
None yet
Development

No branches or pull requests

4 participants