Skip to content

Commit

Permalink
feat(me): Add size arg to partner field
Browse files Browse the repository at this point in the history
  • Loading branch information
damassi committed Apr 11, 2023
1 parent b1436ab commit 7b2114c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 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
14 changes: 11 additions & 3 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> = {
export const ManagedPartners: GraphQLFieldConfig<any, 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 7b2114c

Please sign in to comment.