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

Add filters on related queries #2

Closed
Tracked by #34
karatakis opened this issue Jun 16, 2022 · 1 comment · Fixed by #84
Closed
Tracked by #34

Add filters on related queries #2

karatakis opened this issue Jun 16, 2022 · 1 comment · Fixed by #84

Comments

@karatakis
Copy link
Collaborator

Motivation

Imagine you have the following schema

struct MovieCategory {
  id: String,
  title: String,
  movies: Vec<Movie>
}

struct Movie {
  id: String,
  category_id: String,
  duration: u64,
  rating i64
}

I want to find the categories where (category.title === 'Romance' || category.title === 'Comedy') and get movies where (category.movies.duration >120).

Proposed Solutions

Add filters on related queries.

Additional Information

none

@karatakis karatakis added this to the Advanced features milestone Jun 16, 2022
@billy1624
Copy link
Member

Hey @karatakis, I'm think how the generated async-graphql::Object will look like if it has related entities.

Generated by https://github.com/karatakis/rust-graphql-generator

#[derive(Debug)]
struct Albums(generated::orm::albums::Model);
#[async_graphql::Object]
impl Albums {
    ...
}

We might want to change it to:

#[derive(Debug)]
struct Albums {
    album: generated::orm::albums::Model,
    artist: Option<generated::orm::artists::Model>,
    track: Option<generated::orm::tracks::Model>,
};
#[async_graphql::Object]
impl Albums {
    ...
}

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

Successfully merging a pull request may close this issue.

2 participants