Skip to content

Commit

Permalink
Merge pull request artsy#2657 from damassi/add-sort
Browse files Browse the repository at this point in the history
[MyCollection] Add sorting to connection
  • Loading branch information
damassi committed Sep 2, 2020
2 parents 8d570c6 + 0471aad commit c88a896
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
8 changes: 7 additions & 1 deletion _schemaV2.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -6755,6 +6755,7 @@ type Me implements Node {
before: String
first: Int
last: Int
sort: ArtworkSorts
): MyCollectionConnection
name: String
orders(
Expand Down Expand Up @@ -7114,6 +7115,10 @@ type Mutation {
): UpdateViewingRoomSubsectionsPayload
}

type MyCollectionArtworkMutationDeleteSuccess {
success: Boolean
}

type MyCollectionArtworkMutationFailure {
mutationError: GravityMutationError
}
Expand All @@ -7124,7 +7129,8 @@ type MyCollectionArtworkMutationSuccess {
}

union MyCollectionArtworkMutationType =
MyCollectionArtworkMutationFailure
MyCollectionArtworkMutationDeleteSuccess
| MyCollectionArtworkMutationFailure
| MyCollectionArtworkMutationSuccess

# A connection to a list of items.
Expand Down
5 changes: 4 additions & 1 deletion src/schema/v2/me/myCollection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import {
GraphQLUnionType,
} from "graphql"
import { GravityMutationErrorType } from "lib/gravityErrorHandler"
import ArtworkSorts from "../sorts/artwork_sorts"

const MyCollectionConnection = connectionWithCursorInfo({
name: "MyCollection",
Expand Down Expand Up @@ -46,7 +47,9 @@ export const {

export const MyCollection: GraphQLFieldConfig<any, ResolverContext> = {
type: MyCollectionConnection.connectionType,
args: pageable({}),
args: pageable({
sort: ArtworkSorts,
}),
resolve: ({ id: userId }, options, { myCollectionArtworksLoader }) => {
if (!myCollectionArtworksLoader) {
return null
Expand Down

0 comments on commit c88a896

Please sign in to comment.