diff --git a/_schemaV2.graphql b/_schemaV2.graphql index fc0961ac64..f64d49974e 100644 --- a/_schemaV2.graphql +++ b/_schemaV2.graphql @@ -15267,10 +15267,10 @@ type PublishViewingRoomPayload { type purchases { # Total number of auction winning bids - totalAuctionCount: Int + totalAuctionCount: Int! # Total number of private sales - totalPrivateSaleCount: Int + totalPrivateSaleCount: Int! } type Query { diff --git a/src/lib/stitching/exchange/v2/stitching.ts b/src/lib/stitching/exchange/v2/stitching.ts index 107bc88f30..2d7a72898d 100644 --- a/src/lib/stitching/exchange/v2/stitching.ts +++ b/src/lib/stitching/exchange/v2/stitching.ts @@ -364,11 +364,11 @@ export const exchangeStitchingEnvironment = ({ } `, resolve: async (parent, _args, context, info) => { - const nonBnmoPurchases = - (parent?.purchases?.totalAuctionCount ?? 0) + - (parent?.purchases?.totalPrivateSaleCount ?? 0) - try { + const nonBnmoPurchases = + (parent?.purchases?.totalAuctionCount ?? 0) + + (parent?.purchases?.totalPrivateSaleCount ?? 0) + const exchangeArgs = { buyerId: parent.userId, } @@ -391,9 +391,7 @@ export const exchangeStitchingEnvironment = ({ error ) - return { - totalPurchases: nonBnmoPurchases, - } + return { totalPurchases: null } } }, }, diff --git a/src/schema/v2/conversation/collectorResume.ts b/src/schema/v2/conversation/collectorResume.ts index 5388f94b19..97fc398d29 100644 --- a/src/schema/v2/conversation/collectorResume.ts +++ b/src/schema/v2/conversation/collectorResume.ts @@ -38,14 +38,14 @@ const CollectorPurchasesType = new GraphQLObjectType({ name: "purchases", fields: { totalAuctionCount: { - type: GraphQLInt, + type: GraphQLNonNull(GraphQLInt), description: "Total number of auction winning bids", - resolve: ({ auction }) => auction, + resolve: ({ auction }) => auction || 0, }, totalPrivateSaleCount: { - type: GraphQLInt, + type: GraphQLNonNull(GraphQLInt), description: "Total number of private sales", - resolve: (data) => data["private sale"], + resolve: (data) => data["private sale"] || 0, }, }, })