/
collectorResume.ts
51 lines (49 loc) · 1.51 KB
/
collectorResume.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
import {
GraphQLObjectType,
GraphQLString,
GraphQLNonNull,
GraphQLBoolean,
GraphQLInt,
} from "graphql"
import { CollectorProfileType } from "schema/v2/CollectorProfile/collectorProfile"
import { ResolverContext } from "types/graphql"
export const CollectorResume = new GraphQLObjectType<any, ResolverContext>({
name: "CollectorResume",
fields: () => ({
collectorProfile: {
type: GraphQLNonNull(CollectorProfileType),
resolve: ({ collectorProfile }) => collectorProfile,
},
isCollectorFollowingPartner: {
type: GraphQLNonNull(GraphQLBoolean),
description: "The Collector follows the Gallery profile",
resolve: ({ isCollectorFollowingPartner }) => isCollectorFollowingPartner,
},
userId: {
type: GraphQLNonNull(GraphQLString),
description:
"Collector's ID used to stitch buyerActivity with the Exchange schema",
resolve: ({ userId }) => userId,
},
purchases: {
type: CollectorPurchasesType,
description: "non-bnmo Collector's purchase history",
resolve: ({ purchases }) => purchases,
},
}),
})
const CollectorPurchasesType = new GraphQLObjectType<any, ResolverContext>({
name: "purchases",
fields: {
totalAuctionCount: {
type: GraphQLInt,
description: "Total number of auction winning bids",
resolve: ({ auction }) => auction,
},
totalPrivateSaleCount: {
type: GraphQLInt,
description: "Total number of private sales",
resolve: (data) => data["private sale"],
},
},
})