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: support relation filter #33

Open
magrinj opened this issue Nov 13, 2023 · 7 comments
Open

Feat: support relation filter #33

magrinj opened this issue Nov 13, 2023 · 7 comments
Assignees
Labels
prio: med scope: backend Issues that are affecting the backend side only size: long

Comments

@magrinj
Copy link
Member

magrinj commented Nov 13, 2023

Scope & Context

Relation between customs and standards objects has been added recently twentyhq/twenty#2398

Current behavior

We can't make a query filtering on nested relations

Expected behavior

We should be able to make query filtering on nested relations, by example query like that:

query Documents {
  documents(filter: { suppliers: { name: { like: '%title%' } } }) {
    edges {
      node {
        id
        title
        suppliers {
          id
          name
        }
      }
    }
  }
}

Technical inputs

• This ability should be added in the filter factories.
• query-builder should handle them properly based on how pg_graphql is supposed to receive them.

Designs

CleanShot.2024-09-12.at.11.39.09.mp4

CleanShot 2024-09-12 at 11 40 20

@magrinj magrinj added the scope: backend Issues that are affecting the backend side only label Nov 13, 2023
@charlesBochet charlesBochet changed the title feat: support nested relation filter feat: support relation filter Nov 13, 2023
@magrinj magrinj changed the title feat: support relation filter [Timebox] feat: support relation filter Nov 14, 2023
@magrinj
Copy link
Member Author

magrinj commented Nov 14, 2023

Not supported for now, but should be added:
supabase/pg_graphql#88

@magrinj
Copy link
Member Author

magrinj commented Nov 14, 2023

Just exposing foreign key in twentyhq/twenty#2505 for now, and make multiple requests

@FelixMalfait
Copy link
Member

FelixMalfait commented Sep 11, 2024

Should be possible now that we've moved the findMany endpoint outside of pg_graphql

Related: #98

@FelixMalfait FelixMalfait changed the title [Timebox] feat: support relation filter Feat: support relation filter Sep 11, 2024
@Bonapara
Copy link
Member

@FelixMalfait added the designs to the description

@Bonapara
Copy link
Member

Behavior updated with multi-select instead of select

CleanShot.2024-10-18.at.18.33.37.mp4

@FelixMalfait
Copy link
Member

@Bonapara actually The feature was about even more advanced filter (person.company.name does not contain X or company.person.address is Y). It's true that for one-to-many relationships we only display it one side of the relation, but I would say this is a specific sub-case for the ID field (from an eng perspective) - and because ID are not user-friendly there's a special UI layer for IDs that retrieve the name/pictures. Let's discuss orally if it's not clear!

@Bonapara
Copy link
Member

But is filtering on person.company.id a V1 of person.company.any_field?

V2 I had in mind (Doable as V1?)

CleanShot.2024-10-21.at.10.33.39.mp4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
prio: med scope: backend Issues that are affecting the backend side only size: long
Projects
Status: No status
Development

No branches or pull requests

4 participants