Skip to content

Commit

Permalink
Merge pull request #4938 from artsy/damassi/feat/add-size-to-partner
Browse files Browse the repository at this point in the history
feat(me): Add `size` arg to partner field
  • Loading branch information
damassi authored Apr 11, 2023
2 parents b1436ab + ffa58c4 commit 3a87071
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
2 changes: 1 addition & 1 deletion _schemaV2.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -11402,7 +11402,7 @@ type Me implements Node {
paddleNumber: String

# A list of the current user’s managed partners
partners: [Partner]
partners(size: Int): [Partner]

# The user's most current pending identity verification, if it exists
pendingIdentityVerification: IdentityVerification
Expand Down
12 changes: 10 additions & 2 deletions src/schema/v2/me/partners.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,20 @@
import { GraphQLFieldConfig } from "graphql/type"
import { ResolverContext } from "types/graphql"
import { Partners } from "schema/v2/partner/partners"
import { GraphQLInt } from "graphql"

export const ManagedPartners: GraphQLFieldConfig<void, ResolverContext> = {
type: Partners.type,
description: "A list of the current user’s managed partners",
resolve: async (_root, _option, { partnerLoader, mePartnersLoader }) => {
const partners = await mePartnersLoader?.()
args: {
size: {
type: GraphQLInt,
},
},
resolve: async (_root, args, { partnerLoader, mePartnersLoader }) => {
const partners = await mePartnersLoader?.({
size: args.size ?? 10,
})
return Promise.all(
partners.map((partner) => partnerLoader(partner.id))
).catch(() => {})
Expand Down

0 comments on commit 3a87071

Please sign in to comment.