Ver código fonte

use arrays for orderBy (#1037)

* Change videos query orderBy argument to array

* further fixes

Co-authored-by: Klaudiusz Dembler <dev@kdembler.com>
Rafał Pawłow 3 anos atrás
pai
commit
17d47618fb

+ 3 - 3
src/api/queries/__generated__/baseTypes.generated.ts

@@ -318,7 +318,7 @@ export type QueryChannelsConnectionArgs = {
   first?: Maybe<Scalars['Int']>
   after?: Maybe<Scalars['String']>
   where?: Maybe<ChannelWhereInput>
-  orderBy?: Maybe<ChannelOrderByInput>
+  orderBy?: Maybe<Array<ChannelOrderByInput>>
 }
 
 export type QueryMembershipByUniqueInputArgs = {
@@ -348,14 +348,14 @@ export type QueryVideosArgs = {
   offset?: Maybe<Scalars['Int']>
   limit?: Maybe<Scalars['Int']>
   where?: Maybe<VideoWhereInput>
-  orderBy?: Maybe<VideoOrderByInput>
+  orderBy?: Maybe<Array<VideoOrderByInput>>
 }
 
 export type QueryVideosConnectionArgs = {
   first?: Maybe<Scalars['Int']>
   after?: Maybe<Scalars['String']>
   where?: Maybe<VideoWhereInput>
-  orderBy?: Maybe<VideoOrderByInput>
+  orderBy?: Maybe<Array<VideoOrderByInput>>
 }
 
 export type QueryWorkerByUniqueInputArgs = {

+ 1 - 1
src/api/queries/__generated__/channels.generated.tsx

@@ -293,7 +293,7 @@ export type GetChannelsLazyQueryHookResult = ReturnType<typeof useGetChannelsLaz
 export type GetChannelsQueryResult = Apollo.QueryResult<GetChannelsQuery, GetChannelsQueryVariables>
 export const GetChannelsConnectionDocument = gql`
   query GetChannelsConnection($first: Int, $after: String, $where: ChannelWhereInput) {
-    channelsConnection(first: $first, after: $after, where: $where, orderBy: createdAt_DESC) {
+    channelsConnection(first: $first, after: $after, where: $where, orderBy: [createdAt_DESC]) {
       edges {
         cursor
         node {

+ 6 - 6
src/api/queries/__generated__/videos.generated.tsx

@@ -61,7 +61,7 @@ export type GetVideoQuery = {
 export type GetVideosConnectionQueryVariables = Types.Exact<{
   first?: Types.Maybe<Types.Scalars['Int']>
   after?: Types.Maybe<Types.Scalars['String']>
-  orderBy?: Types.Maybe<Types.VideoOrderByInput>
+  orderBy?: Types.VideoOrderByInput
   where?: Types.Maybe<Types.VideoWhereInput>
 }>
 
@@ -79,7 +79,7 @@ export type GetVideosQueryVariables = Types.Exact<{
   offset?: Types.Maybe<Types.Scalars['Int']>
   limit?: Types.Maybe<Types.Scalars['Int']>
   where?: Types.Maybe<Types.VideoWhereInput>
-  orderBy?: Types.Maybe<Types.VideoOrderByInput>
+  orderBy?: Types.VideoOrderByInput
 }>
 
 export type GetVideosQuery = {
@@ -213,10 +213,10 @@ export const GetVideosConnectionDocument = gql`
   query GetVideosConnection(
     $first: Int
     $after: String
-    $orderBy: VideoOrderByInput = createdAt_DESC
+    $orderBy: VideoOrderByInput! = createdAt_DESC
     $where: VideoWhereInput
   ) {
-    videosConnection(first: $first, after: $after, where: $where, orderBy: $orderBy) {
+    videosConnection(first: $first, after: $after, where: $where, orderBy: [$orderBy]) {
       edges {
         cursor
         node {
@@ -275,8 +275,8 @@ export type GetVideosConnectionQueryResult = Apollo.QueryResult<
   GetVideosConnectionQueryVariables
 >
 export const GetVideosDocument = gql`
-  query GetVideos($offset: Int, $limit: Int, $where: VideoWhereInput, $orderBy: VideoOrderByInput = createdAt_DESC) {
-    videos(offset: $offset, limit: $limit, where: $where, orderBy: $orderBy) {
+  query GetVideos($offset: Int, $limit: Int, $where: VideoWhereInput, $orderBy: VideoOrderByInput! = createdAt_DESC) {
+    videos(offset: $offset, limit: $limit, where: $where, orderBy: [$orderBy]) {
       ...VideoFields
     }
   }

+ 1 - 1
src/api/queries/channels.graphql

@@ -52,7 +52,7 @@ query GetChannels($where: ChannelWhereInput) {
 }
 
 query GetChannelsConnection($first: Int, $after: String, $where: ChannelWhereInput) {
-  channelsConnection(first: $first, after: $after, where: $where, orderBy: createdAt_DESC) {
+  channelsConnection(first: $first, after: $after, where: $where, orderBy: [createdAt_DESC]) {
     edges {
       cursor
       node {

+ 4 - 4
src/api/queries/videos.graphql

@@ -60,10 +60,10 @@ query GetVideo($where: VideoWhereUniqueInput!) {
 query GetVideosConnection(
   $first: Int
   $after: String
-  $orderBy: VideoOrderByInput = createdAt_DESC
+  $orderBy: VideoOrderByInput! = createdAt_DESC
   $where: VideoWhereInput
 ) {
-  videosConnection(first: $first, after: $after, where: $where, orderBy: $orderBy) {
+  videosConnection(first: $first, after: $after, where: $where, orderBy: [$orderBy]) {
     edges {
       cursor
       node {
@@ -78,8 +78,8 @@ query GetVideosConnection(
   }
 }
 
-query GetVideos($offset: Int, $limit: Int, $where: VideoWhereInput, $orderBy: VideoOrderByInput = createdAt_DESC) {
-  videos(offset: $offset, limit: $limit, where: $where, orderBy: $orderBy) {
+query GetVideos($offset: Int, $limit: Int, $where: VideoWhereInput, $orderBy: VideoOrderByInput! = createdAt_DESC) {
+  videos(offset: $offset, limit: $limit, where: $where, orderBy: [$orderBy]) {
     ...VideoFields
   }
 }

+ 3 - 3
src/api/schemas/extendedQueryNode.graphql

@@ -273,17 +273,17 @@ type Query {
     first: Int
     after: String
     where: ChannelWhereInput
-    orderBy: ChannelOrderByInput
+    orderBy: [ChannelOrderByInput!]
   ): ChannelConnection!
 
   # Lookup video by its ID
   videoByUniqueInput(where: VideoWhereUniqueInput!): Video
 
   # Lookup videos by where params
-  videos(offset: Int, limit: Int, where: VideoWhereInput, orderBy: VideoOrderByInput): [Video!]
+  videos(offset: Int, limit: Int, where: VideoWhereInput, orderBy: [VideoOrderByInput!]): [Video!]
 
   # List all videos by given constraints
-  videosConnection(first: Int, after: String, where: VideoWhereInput, orderBy: VideoOrderByInput): VideoConnection!
+  videosConnection(first: Int, after: String, where: VideoWhereInput, orderBy: [VideoOrderByInput!]): VideoConnection!
 
   # List all categories
   videoCategories: [VideoCategory!]!