Skip to content
This repository has been archived by the owner on Mar 31, 2022. It is now read-only.

Support sort by instance name #202

Conversation

zaharchenko-evgeny
Copy link
Contributor

Support multiple sort conditions for query and support sort by entity instance name

Support multiple sort conditions for query
@@ -128,4 +127,20 @@ class SortingTest extends AbstractGraphQLTest {
garNames == ["Big Bob's Beeper Emporium", "The Fudge Place", "Watch Repair", "P.S. 118"]
}

def "cars are sorted by garage"() {
when:
def response = query("datafetcher/sort/cars-with-sort.gql",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also need test with first-level sort sort by _instanceName

def response = query("datafetcher/sort/cars-with-sort.gql",
        asObjectNode('{"orderBy": {"_instanceName": "ASC"}}'))

Map<String, Object> innerOrderBy = new LinkedHashMap<>();
for (String key : valueObj.keySet()) {
if (key.equals(SYS_ATTR_INSTANCE_NAME)) {
for (MetaProperty metaProperty : metadataTools.getInstanceNameRelatedProperties(metaClass)) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

May be it make sense to add comment here, that there is a case when properties may be returned in a different order from the order in which they were used in instance name.

Copy link
Contributor

@vadimbasko vadimbasko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to be checked that first-level sort by _instanceName works. Than PR could be merged.

@zaharchenko-evgeny zaharchenko-evgeny merged commit 23352ad into master Jan 14, 2022
@zaharchenko-evgeny zaharchenko-evgeny deleted the feature/support_multiple_sort_by_and_instance_name_in_filters branch January 14, 2022 07:02
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants