From 8a393e9a42c83a58049bff2971c9f6a6361768c0 Mon Sep 17 00:00:00 2001 From: dean Date: Tue, 25 Nov 2025 10:39:22 -0800 Subject: [PATCH] feat: Add challenge invitations fields and fix feed hasFollowing query MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Add invitations query fields with invitee data to GetChallenge - Add participantCount field to GetChallenge - Add GetMyChallengeEntries query (was missing) - Add hasFollowing to GetVideoFeed response (fixes feed ordering) - Sync schema with backend challenge types 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- src/index.tsx | 145 ++++++++++++++++++++++++++++++++++ src/operations/challenges.gql | 35 ++++++++ src/operations/feed.gql | 1 + src/schema.gql | 3 + 4 files changed, 184 insertions(+) diff --git a/src/index.tsx b/src/index.tsx index 539171c..94fb98c 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -147,10 +147,12 @@ export type Challenge = { description?: Maybe; endDate: Scalars["DateTime"]["output"]; id: Scalars["ID"]["output"]; + invitations: Array; isPublic: Scalars["Boolean"]["output"]; maxAttempts?: Maybe; minimumShots: Scalars["Int"]["output"]; name: Scalars["String"]["output"]; + participantCount: Scalars["Int"]["output"]; requiredPocketSize?: Maybe; requiredTableSize?: Maybe; ruleSet: RuleSet; @@ -177,6 +179,7 @@ export type ChallengeInvitation = { challenge: Challenge; createdAt: Scalars["DateTime"]["output"]; id: Scalars["ID"]["output"]; + invitee: UserGql; inviter: UserGql; status: Scalars["String"]["output"]; }; @@ -3568,6 +3571,7 @@ export type GetChallengeQuery = { requiredPocketSize?: number | null; isPublic: boolean; maxAttempts?: number | null; + participantCount: number; ruleSet: { __typename?: "RuleSet"; id: string; @@ -3580,6 +3584,24 @@ export type GetChallengeQuery = { username: string; profileImageUri?: string | null; }; + invitations: Array<{ + __typename?: "ChallengeInvitation"; + id: string; + status: string; + createdAt: any; + invitee: { + __typename?: "UserGQL"; + id: number; + username: string; + profileImageUri?: string | null; + }; + inviter: { + __typename?: "UserGQL"; + id: number; + username: string; + profileImageUri?: string | null; + }; + }>; } | null; }; @@ -3659,6 +3681,26 @@ export type GetMyChallengeInvitationsQuery = { }>; }; +export type GetMyChallengeEntriesQueryVariables = Exact<{ + [key: string]: never; +}>; + +export type GetMyChallengeEntriesQuery = { + __typename?: "Query"; + myChallengeEntries: Array<{ + __typename?: "ChallengeEntry"; + id: string; + status: string; + shotsCount?: number | null; + makesCount?: number | null; + makeRate?: number | null; + qualified?: boolean | null; + createdAt: any; + challenge: { __typename?: "Challenge"; id: string; name: string }; + video?: { __typename?: "VideoGQL"; id: number } | null; + }>; +}; + export type CreateRuleSetMutationVariables = Exact<{ name: Scalars["String"]["input"]; description?: InputMaybe; @@ -4106,6 +4148,7 @@ export type GetVideoFeedQuery = { __typename?: "Query"; getFeedVideos: { __typename?: "VideoHistoryGQL"; + hasFollowing: boolean; videos: Array<{ __typename?: "VideoGQL"; id: number; @@ -6829,6 +6872,7 @@ export const GetChallengeDocument = gql` requiredPocketSize isPublic maxAttempts + participantCount ruleSet { id name @@ -6839,6 +6883,21 @@ export const GetChallengeDocument = gql` username profileImageUri } + invitations { + id + status + createdAt + invitee { + id + username + profileImageUri + } + inviter { + id + username + profileImageUri + } + } } } `; @@ -7160,6 +7219,91 @@ export type GetMyChallengeInvitationsQueryResult = Apollo.QueryResult< GetMyChallengeInvitationsQuery, GetMyChallengeInvitationsQueryVariables >; +export const GetMyChallengeEntriesDocument = gql` + query GetMyChallengeEntries { + myChallengeEntries { + id + status + shotsCount + makesCount + makeRate + qualified + createdAt + challenge { + id + name + } + video { + id + } + } + } +`; + +/** + * __useGetMyChallengeEntriesQuery__ + * + * To run a query within a React component, call `useGetMyChallengeEntriesQuery` and pass it any options that fit your needs. + * When your component renders, `useGetMyChallengeEntriesQuery` returns an object from Apollo Client that contains loading, error, and data properties + * you can use to render your UI. + * + * @param baseOptions options that will be passed into the query, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options; + * + * @example + * const { data, loading, error } = useGetMyChallengeEntriesQuery({ + * variables: { + * }, + * }); + */ +export function useGetMyChallengeEntriesQuery( + baseOptions?: Apollo.QueryHookOptions< + GetMyChallengeEntriesQuery, + GetMyChallengeEntriesQueryVariables + >, +) { + const options = { ...defaultOptions, ...baseOptions }; + return Apollo.useQuery< + GetMyChallengeEntriesQuery, + GetMyChallengeEntriesQueryVariables + >(GetMyChallengeEntriesDocument, options); +} +export function useGetMyChallengeEntriesLazyQuery( + baseOptions?: Apollo.LazyQueryHookOptions< + GetMyChallengeEntriesQuery, + GetMyChallengeEntriesQueryVariables + >, +) { + const options = { ...defaultOptions, ...baseOptions }; + return Apollo.useLazyQuery< + GetMyChallengeEntriesQuery, + GetMyChallengeEntriesQueryVariables + >(GetMyChallengeEntriesDocument, options); +} +export function useGetMyChallengeEntriesSuspenseQuery( + baseOptions?: Apollo.SuspenseQueryHookOptions< + GetMyChallengeEntriesQuery, + GetMyChallengeEntriesQueryVariables + >, +) { + const options = { ...defaultOptions, ...baseOptions }; + return Apollo.useSuspenseQuery< + GetMyChallengeEntriesQuery, + GetMyChallengeEntriesQueryVariables + >(GetMyChallengeEntriesDocument, options); +} +export type GetMyChallengeEntriesQueryHookResult = ReturnType< + typeof useGetMyChallengeEntriesQuery +>; +export type GetMyChallengeEntriesLazyQueryHookResult = ReturnType< + typeof useGetMyChallengeEntriesLazyQuery +>; +export type GetMyChallengeEntriesSuspenseQueryHookResult = ReturnType< + typeof useGetMyChallengeEntriesSuspenseQuery +>; +export type GetMyChallengeEntriesQueryResult = Apollo.QueryResult< + GetMyChallengeEntriesQuery, + GetMyChallengeEntriesQueryVariables +>; export const CreateRuleSetDocument = gql` mutation CreateRuleSet($name: String!, $description: String) { createRuleSet(name: $name, description: $description) { @@ -8085,6 +8229,7 @@ export const GetVideoFeedDocument = gql` hasNextPage endCursor } + hasFollowing } } ${VideoCardFieldsFragmentDoc} diff --git a/src/operations/challenges.gql b/src/operations/challenges.gql index fa3a916..8d129f2 100644 --- a/src/operations/challenges.gql +++ b/src/operations/challenges.gql @@ -39,6 +39,7 @@ query GetChallenge($id: ID!) { requiredPocketSize isPublic maxAttempts + participantCount ruleSet { id name @@ -49,6 +50,21 @@ query GetChallenge($id: ID!) { username profileImageUri } + invitations { + id + status + createdAt + invitee { + id + username + profileImageUri + } + inviter { + id + username + profileImageUri + } + } } } @@ -106,6 +122,25 @@ query GetMyChallengeInvitations { } } +query GetMyChallengeEntries { + myChallengeEntries { + id + status + shotsCount + makesCount + makeRate + qualified + createdAt + challenge { + id + name + } + video { + id + } + } +} + mutation CreateRuleSet($name: String!, $description: String) { createRuleSet(name: $name, description: $description) { id diff --git a/src/operations/feed.gql b/src/operations/feed.gql index 39baaa8..06dc64d 100644 --- a/src/operations/feed.gql +++ b/src/operations/feed.gql @@ -116,5 +116,6 @@ query GetVideoFeed( hasNextPage endCursor } + hasFollowing } } diff --git a/src/schema.gql b/src/schema.gql index b7bc395..749ca2c 100644 --- a/src/schema.gql +++ b/src/schema.gql @@ -319,6 +319,8 @@ type Challenge { updatedAt: DateTime! ruleSet: RuleSet! createdBy: UserGQL! + invitations: [ChallengeInvitation!]! + participantCount: Int! } type RuleSet { @@ -652,6 +654,7 @@ type ChallengeInvitation { createdAt: DateTime! challenge: Challenge! inviter: UserGQL! + invitee: UserGQL! } type DeployedConfigGQL {