From b2a7add3ecff7442ed3d625d6e8ab05a0e93536d Mon Sep 17 00:00:00 2001 From: Rongjian Zhang Date: Sun, 5 Apr 2020 22:02:38 +0800 Subject: [PATCH] improvement(gh): stargazers order by time desc --- lib/graphql/gh.dart | 14 +++++++++++++- lib/graphql/gh_users.graphql | 6 +++++- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/lib/graphql/gh.dart b/lib/graphql/gh.dart index a7a3c7d..450a13a 100644 --- a/lib/graphql/gh.dart +++ b/lib/graphql/gh.dart @@ -2309,7 +2309,19 @@ class GhUsersQuery extends GraphQLQuery { value: IntValueNode(value: '30')), ArgumentNode( name: NameNode(value: 'after'), - value: VariableNode(name: NameNode(value: 'after'))) + value: VariableNode(name: NameNode(value: 'after'))), + ArgumentNode( + name: NameNode(value: 'orderBy'), + value: ObjectValueNode(fields: [ + ObjectFieldNode( + name: NameNode(value: 'field'), + value: EnumValueNode( + name: NameNode(value: 'STARRED_AT'))), + ObjectFieldNode( + name: NameNode(value: 'direction'), + value: EnumValueNode( + name: NameNode(value: 'DESC'))) + ])) ], directives: [ DirectiveNode( diff --git a/lib/graphql/gh_users.graphql b/lib/graphql/gh_users.graphql index 5e2dd60..27fa256 100644 --- a/lib/graphql/gh_users.graphql +++ b/lib/graphql/gh_users.graphql @@ -79,7 +79,11 @@ query GhUsers( createdAt } } - stargazers(first: 30, after: $after) @include(if: $isStar) { + stargazers( + first: 30 + after: $after + orderBy: { field: STARRED_AT, direction: DESC } + ) @include(if: $isStar) { pageInfo { hasNextPage endCursor