Skip to content

Commit

Permalink
Support sorting by child id
Browse files Browse the repository at this point in the history
  • Loading branch information
kamilkisiela committed Jan 12, 2023
1 parent fce0517 commit 4b0a0f5
Show file tree
Hide file tree
Showing 2 changed files with 274 additions and 80 deletions.
26 changes: 12 additions & 14 deletions graphql/tests/query.rs
Original file line number Diff line number Diff line change
Expand Up @@ -788,15 +788,15 @@ fn can_query_with_sorting_by_derived_child_entity() {
fn can_query_with_sorting_by_child_entity_id() {
const QUERY: &str = "
query {
desc: musicians(first: 100, orderBy: mainBand__id, orderDirection: desc) {
name
mainBand {
desc: bandReviews(first: 100, orderBy: author__id, orderDirection: desc) {
body
author {
name
}
}
asc: musicians(first: 100, orderBy: mainBand__id, orderDirection: asc) {
name
mainBand {
asc: bandReviews(first: 100, orderBy: author__id, orderDirection: asc) {
body
author {
name
}
}
Expand All @@ -805,16 +805,14 @@ fn can_query_with_sorting_by_child_entity_id() {
run_query(QUERY, |result, _| {
let exp = object! {
desc: vec![
object! { name: "Valerie", mainBand: r::Value::Null },
object! { name: "Tom", mainBand: object! { name: "The Amateurs"} },
object! { name: "John", mainBand: object! { name: "The Musicians" } },
object! { name: "Lisa", mainBand: object! { name: "The Musicians" } },
object! { body: "Very Bad musicians", author: object! { name: "Anonymous 3" } },
object! { body: "Good amateurs", author: object! { name: "Goodwill" } },
object! { body: "Bad musicians", author: object! { name: "Baden" } },
],
asc: vec![
object! { name: "John", mainBand: object! { name: "The Musicians" } },
object! { name: "Lisa", mainBand: object! { name: "The Musicians" } },
object! { name: "Tom", mainBand: object! { name: "The Amateurs"} },
object! { name: "Valerie", mainBand: r::Value::Null },
object! { body: "Bad musicians", author: object! { name: "Baden" } },
object! { body: "Good amateurs", author: object! { name: "Goodwill" } },
object! { body: "Very Bad musicians", author: object! { name: "Anonymous 3" } },
]
};

Expand Down
Loading

0 comments on commit 4b0a0f5

Please sign in to comment.