Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(me): exposes followed profiles count #5611

Merged
merged 1 commit into from Mar 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions _schemaV2.graphql
Expand Up @@ -12601,6 +12601,9 @@ type Me implements Node {

type MeCounts {
followedArtists: Int!

# Returns the total count of followed profiles. There is currently no way to filter this count by `owner_type`.
followedProfiles: Int!
savedArtworks: Int!
savedSearches: Int!
}
Expand Down
21 changes: 21 additions & 0 deletions src/schema/v2/me/index.ts
Expand Up @@ -250,6 +250,27 @@ export const meType = new GraphQLObjectType<any, ResolverContext>({
}
},
},
followedProfiles: {
type: new GraphQLNonNull(GraphQLInt),
description:
"Returns the total count of followed profiles. There is currently no way to filter this count by `owner_type`.",
resolve: async (_me, { followedPartnersLoader }) => {
if (!followedPartnersLoader) return 0

try {
const { headers } = await followedPartnersLoader({
page: 1,
size: 1,
total_count: true,
})

return headers["x-total-count"] ?? 0
} catch (error) {
console.error(error)
return 0
}
},
},
savedArtworks: {
type: new GraphQLNonNull(GraphQLInt),
resolve: async (_me, _args, { collectionArtworksLoader }) => {
Expand Down