Skip to content

Commit

Permalink
use non-nullable types
Browse files Browse the repository at this point in the history
  • Loading branch information
egdbear committed Mar 15, 2024
1 parent 251072e commit 7bb319d
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 13 deletions.
4 changes: 2 additions & 2 deletions _schemaV2.graphql
Expand Up @@ -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 {
Expand Down
12 changes: 5 additions & 7 deletions src/lib/stitching/exchange/v2/stitching.ts
Expand Up @@ -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,
}
Expand All @@ -391,9 +391,7 @@ export const exchangeStitchingEnvironment = ({
error
)

return {
totalPurchases: nonBnmoPurchases,
}
return { totalPurchases: null }
}
},
},
Expand Down
8 changes: 4 additions & 4 deletions src/schema/v2/conversation/collectorResume.ts
Expand Up @@ -38,14 +38,14 @@ const CollectorPurchasesType = new GraphQLObjectType<any, ResolverContext>({
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,
},
},
})

0 comments on commit 7bb319d

Please sign in to comment.