@@ -62,48 +62,64 @@ pub(crate) fn build_query<'a>(
6262 ( Some ( ( attr, value_type, None ) ) , OrderDirection :: Descending ) => {
6363 EntityOrder :: Descending ( attr, value_type)
6464 }
65- ( Some ( ( attr, _, Some ( child) ) ) , OrderDirection :: Ascending ) => match child {
66- OrderByChild :: Object ( child) => EntityOrder :: ChildAscending ( EntityOrderByChild :: Object (
67- EntityOrderByChildInfo {
68- sort_by_attribute : attr,
69- join_attribute : child. join_attribute ,
70- derived : child. derived ,
71- } ,
72- child. entity_type ,
73- ) ) ,
74- OrderByChild :: Interface ( child) => {
75- EntityOrder :: ChildAscending ( EntityOrderByChild :: Interface (
76- EntityOrderByChildInfo {
77- sort_by_attribute : attr,
78- join_attribute : child. join_attribute ,
79- derived : child. derived ,
80- } ,
81- child. entity_types ,
82- ) )
65+ ( Some ( ( attr, _, Some ( child) ) ) , OrderDirection :: Ascending ) => {
66+ if ENV_VARS . graphql . disable_child_sorting {
67+ return Err ( QueryExecutionError :: NotSupported (
68+ "Sorting by child attributes is not supported" . to_string ( ) ,
69+ ) ) ;
8370 }
84- } ,
85- ( Some ( ( attr, _, Some ( child) ) ) , OrderDirection :: Descending ) => match child {
86- OrderByChild :: Object ( child) => {
87- EntityOrder :: ChildDescending ( EntityOrderByChild :: Object (
88- EntityOrderByChildInfo {
89- sort_by_attribute : attr,
90- join_attribute : child. join_attribute ,
91- derived : child. derived ,
92- } ,
93- child. entity_type ,
94- ) )
71+ match child {
72+ OrderByChild :: Object ( child) => {
73+ EntityOrder :: ChildAscending ( EntityOrderByChild :: Object (
74+ EntityOrderByChildInfo {
75+ sort_by_attribute : attr,
76+ join_attribute : child. join_attribute ,
77+ derived : child. derived ,
78+ } ,
79+ child. entity_type ,
80+ ) )
81+ }
82+ OrderByChild :: Interface ( child) => {
83+ EntityOrder :: ChildAscending ( EntityOrderByChild :: Interface (
84+ EntityOrderByChildInfo {
85+ sort_by_attribute : attr,
86+ join_attribute : child. join_attribute ,
87+ derived : child. derived ,
88+ } ,
89+ child. entity_types ,
90+ ) )
91+ }
92+ }
93+ }
94+ ( Some ( ( attr, _, Some ( child) ) ) , OrderDirection :: Descending ) => {
95+ if ENV_VARS . graphql . disable_child_sorting {
96+ return Err ( QueryExecutionError :: NotSupported (
97+ "Sorting by child attributes is not supported" . to_string ( ) ,
98+ ) ) ;
9599 }
96- OrderByChild :: Interface ( child) => {
97- EntityOrder :: ChildDescending ( EntityOrderByChild :: Interface (
98- EntityOrderByChildInfo {
99- sort_by_attribute : attr,
100- join_attribute : child. join_attribute ,
101- derived : child. derived ,
102- } ,
103- child. entity_types ,
104- ) )
100+ match child {
101+ OrderByChild :: Object ( child) => {
102+ EntityOrder :: ChildDescending ( EntityOrderByChild :: Object (
103+ EntityOrderByChildInfo {
104+ sort_by_attribute : attr,
105+ join_attribute : child. join_attribute ,
106+ derived : child. derived ,
107+ } ,
108+ child. entity_type ,
109+ ) )
110+ }
111+ OrderByChild :: Interface ( child) => {
112+ EntityOrder :: ChildDescending ( EntityOrderByChild :: Interface (
113+ EntityOrderByChildInfo {
114+ sort_by_attribute : attr,
115+ join_attribute : child. join_attribute ,
116+ derived : child. derived ,
117+ } ,
118+ child. entity_types ,
119+ ) )
120+ }
105121 }
106- } ,
122+ }
107123 ( None , _) => EntityOrder :: Default ,
108124 } ;
109125 query = query. order ( order) ;
0 commit comments