Skip to content

Commit 4b0a0f5

Browse files
committed
Support sorting by child id
1 parent fce0517 commit 4b0a0f5

File tree

2 files changed

+274
-80
lines changed

2 files changed

+274
-80
lines changed

graphql/tests/query.rs

+12-14
Original file line numberDiff line numberDiff line change
@@ -788,15 +788,15 @@ fn can_query_with_sorting_by_derived_child_entity() {
788788
fn can_query_with_sorting_by_child_entity_id() {
789789
const QUERY: &str = "
790790
query {
791-
desc: musicians(first: 100, orderBy: mainBand__id, orderDirection: desc) {
792-
name
793-
mainBand {
791+
desc: bandReviews(first: 100, orderBy: author__id, orderDirection: desc) {
792+
body
793+
author {
794794
name
795795
}
796796
}
797-
asc: musicians(first: 100, orderBy: mainBand__id, orderDirection: asc) {
798-
name
799-
mainBand {
797+
asc: bandReviews(first: 100, orderBy: author__id, orderDirection: asc) {
798+
body
799+
author {
800800
name
801801
}
802802
}
@@ -805,16 +805,14 @@ fn can_query_with_sorting_by_child_entity_id() {
805805
run_query(QUERY, |result, _| {
806806
let exp = object! {
807807
desc: vec![
808-
object! { name: "Valerie", mainBand: r::Value::Null },
809-
object! { name: "Tom", mainBand: object! { name: "The Amateurs"} },
810-
object! { name: "John", mainBand: object! { name: "The Musicians" } },
811-
object! { name: "Lisa", mainBand: object! { name: "The Musicians" } },
808+
object! { body: "Very Bad musicians", author: object! { name: "Anonymous 3" } },
809+
object! { body: "Good amateurs", author: object! { name: "Goodwill" } },
810+
object! { body: "Bad musicians", author: object! { name: "Baden" } },
812811
],
813812
asc: vec![
814-
object! { name: "John", mainBand: object! { name: "The Musicians" } },
815-
object! { name: "Lisa", mainBand: object! { name: "The Musicians" } },
816-
object! { name: "Tom", mainBand: object! { name: "The Amateurs"} },
817-
object! { name: "Valerie", mainBand: r::Value::Null },
813+
object! { body: "Bad musicians", author: object! { name: "Baden" } },
814+
object! { body: "Good amateurs", author: object! { name: "Goodwill" } },
815+
object! { body: "Very Bad musicians", author: object! { name: "Anonymous 3" } },
818816
]
819817
};
820818

0 commit comments

Comments
 (0)