feat: Add challenge dismissal GQL operations
All checks were successful
Tests / Tests (pull_request) Successful in 10s

- Add DismissChallenge/UndismissChallenge mutations
- Add IsChallengeDismissed query
- Add GetMyDismissedChallenges query
- Update schema with dismissal fields

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
dean
2025-11-25 14:03:53 -08:00
parent 88650706e0
commit 55bbf723ba
3 changed files with 1344 additions and 952 deletions

View File

@@ -162,6 +162,7 @@ export type Challenge = {
export type ChallengeEntry = {
__typename?: "ChallengeEntry";
attemptCount?: Maybe<Scalars["Int"]["output"]>;
challenge: Challenge;
createdAt: Scalars["DateTime"]["output"];
id: Scalars["ID"]["output"];
@@ -2336,6 +2337,7 @@ export type Mutation = {
deleteTags: Scalars["Boolean"]["output"];
deleteUser: Scalars["Boolean"]["output"];
deleteVideo: Scalars["Boolean"]["output"];
dismissChallenge: Scalars["Boolean"]["output"];
editComment: Scalars["Boolean"]["output"];
editProfileImageUri: UserGql;
editShot: EditShotReturn;
@@ -2360,6 +2362,7 @@ export type Mutation = {
setSegmentDuration: Scalars["Boolean"]["output"];
startChallenge: ChallengeEntry;
submitChallengeEntry: ChallengeEntry;
undismissChallenge: Scalars["Boolean"]["output"];
unfollowUser: UserGql;
updateShotAnnotations: UpdateShotAnnotationReturn;
};
@@ -2432,6 +2435,10 @@ export type MutationDeleteVideoArgs = {
videoId: Scalars["Int"]["input"];
};
export type MutationDismissChallengeArgs = {
challengeId: Scalars["ID"]["input"];
};
export type MutationEditCommentArgs = {
commentId: Scalars["Int"]["input"];
newMessage: Scalars["String"]["input"];
@@ -2535,6 +2542,10 @@ export type MutationSubmitChallengeEntryArgs = {
videoId: Scalars["ID"]["input"];
};
export type MutationUndismissChallengeArgs = {
challengeId: Scalars["ID"]["input"];
};
export type MutationUnfollowUserArgs = {
followedUserId: Scalars["Int"]["input"];
};
@@ -2697,8 +2708,10 @@ export type Query = {
getVideo: VideoGql;
getVideoMakePercentageIntervals: Array<MakePercentageIntervalGql>;
getVideos: Array<VideoGql>;
isChallengeDismissed: Scalars["Boolean"]["output"];
myChallengeEntries: Array<ChallengeEntry>;
myChallengeInvitations: Array<ChallengeInvitation>;
myDismissedChallenges: Array<Challenge>;
notifications: NotificationConnection;
ruleSets: Array<RuleSet>;
unreadNotificationCount: Scalars["Int"]["output"];
@@ -2714,6 +2727,10 @@ export type QueryChallengeLeaderboardArgs = {
limit?: Scalars["Int"]["input"];
};
export type QueryChallengesArgs = {
includeDismissed?: Scalars["Boolean"]["input"];
};
export type QueryDoesUsernameExistArgs = {
candidateUsername: Scalars["String"]["input"];
};
@@ -2850,6 +2867,10 @@ export type QueryGetVideosArgs = {
videoIds: Array<Scalars["Int"]["input"]>;
};
export type QueryIsChallengeDismissedArgs = {
challengeId: Scalars["ID"]["input"];
};
export type QueryNotificationsArgs = {
filters?: InputMaybe<NotificationFilters>;
limit?: Scalars["Int"]["input"];
@@ -3551,6 +3572,41 @@ export type GetChallengesQuery = {
}>;
};
export type GetMyDismissedChallengesQueryVariables = Exact<{
[key: string]: never;
}>;
export type GetMyDismissedChallengesQuery = {
__typename?: "Query";
myDismissedChallenges: Array<{
__typename?: "Challenge";
id: string;
name: string;
description?: string | null;
minimumShots: number;
startDate: any;
endDate: any;
createdAt: any;
updatedAt: any;
requiredTableSize?: number | null;
requiredPocketSize?: number | null;
isPublic: boolean;
maxAttempts?: number | null;
ruleSet: {
__typename?: "RuleSet";
id: string;
name: string;
description?: string | null;
};
createdBy: {
__typename?: "UserGQL";
id: number;
username: string;
profileImageUri?: string | null;
};
}>;
};
export type GetChallengeQueryVariables = Exact<{
id: Scalars["ID"]["input"];
}>;
@@ -3633,6 +3689,7 @@ export type GetChallengeLeaderboardQuery = {
makeRate?: number | null;
qualified?: boolean | null;
createdAt: any;
attemptCount?: number | null;
user: {
__typename?: "UserGQL";
id: number;
@@ -3824,6 +3881,33 @@ export type RecalculateChallengeEntryMutation = {
};
};
export type IsChallengeDismissedQueryVariables = Exact<{
challengeId: Scalars["ID"]["input"];
}>;
export type IsChallengeDismissedQuery = {
__typename?: "Query";
isChallengeDismissed: boolean;
};
export type DismissChallengeMutationVariables = Exact<{
challengeId: Scalars["ID"]["input"];
}>;
export type DismissChallengeMutation = {
__typename?: "Mutation";
dismissChallenge: boolean;
};
export type UndismissChallengeMutationVariables = Exact<{
challengeId: Scalars["ID"]["input"];
}>;
export type UndismissChallengeMutation = {
__typename?: "Mutation";
undismissChallenge: boolean;
};
export type CommentOnVideoMutationVariables = Exact<{
videoId: Scalars["Int"]["input"];
message: Scalars["String"]["input"];
@@ -6788,6 +6872,99 @@ export type GetChallengesQueryResult = Apollo.QueryResult<
GetChallengesQuery,
GetChallengesQueryVariables
>;
export const GetMyDismissedChallengesDocument = gql`
query GetMyDismissedChallenges {
myDismissedChallenges {
id
name
description
minimumShots
startDate
endDate
createdAt
updatedAt
requiredTableSize
requiredPocketSize
isPublic
maxAttempts
ruleSet {
id
name
description
}
createdBy {
id
username
profileImageUri
}
}
}
`;
/**
* __useGetMyDismissedChallengesQuery__
*
* To run a query within a React component, call `useGetMyDismissedChallengesQuery` and pass it any options that fit your needs.
* When your component renders, `useGetMyDismissedChallengesQuery` 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 } = useGetMyDismissedChallengesQuery({
* variables: {
* },
* });
*/
export function useGetMyDismissedChallengesQuery(
baseOptions?: Apollo.QueryHookOptions<
GetMyDismissedChallengesQuery,
GetMyDismissedChallengesQueryVariables
>,
) {
const options = { ...defaultOptions, ...baseOptions };
return Apollo.useQuery<
GetMyDismissedChallengesQuery,
GetMyDismissedChallengesQueryVariables
>(GetMyDismissedChallengesDocument, options);
}
export function useGetMyDismissedChallengesLazyQuery(
baseOptions?: Apollo.LazyQueryHookOptions<
GetMyDismissedChallengesQuery,
GetMyDismissedChallengesQueryVariables
>,
) {
const options = { ...defaultOptions, ...baseOptions };
return Apollo.useLazyQuery<
GetMyDismissedChallengesQuery,
GetMyDismissedChallengesQueryVariables
>(GetMyDismissedChallengesDocument, options);
}
export function useGetMyDismissedChallengesSuspenseQuery(
baseOptions?: Apollo.SuspenseQueryHookOptions<
GetMyDismissedChallengesQuery,
GetMyDismissedChallengesQueryVariables
>,
) {
const options = { ...defaultOptions, ...baseOptions };
return Apollo.useSuspenseQuery<
GetMyDismissedChallengesQuery,
GetMyDismissedChallengesQueryVariables
>(GetMyDismissedChallengesDocument, options);
}
export type GetMyDismissedChallengesQueryHookResult = ReturnType<
typeof useGetMyDismissedChallengesQuery
>;
export type GetMyDismissedChallengesLazyQueryHookResult = ReturnType<
typeof useGetMyDismissedChallengesLazyQuery
>;
export type GetMyDismissedChallengesSuspenseQueryHookResult = ReturnType<
typeof useGetMyDismissedChallengesSuspenseQuery
>;
export type GetMyDismissedChallengesQueryResult = Apollo.QueryResult<
GetMyDismissedChallengesQuery,
GetMyDismissedChallengesQueryVariables
>;
export const GetChallengeDocument = gql`
query GetChallenge($id: ID!) {
challenge(id: $id) {
@@ -6980,6 +7157,7 @@ export const GetChallengeLeaderboardDocument = gql`
makeRate
qualified
createdAt
attemptCount
user {
id
username
@@ -7658,6 +7836,173 @@ export type RecalculateChallengeEntryMutationOptions =
RecalculateChallengeEntryMutation,
RecalculateChallengeEntryMutationVariables
>;
export const IsChallengeDismissedDocument = gql`
query IsChallengeDismissed($challengeId: ID!) {
isChallengeDismissed(challengeId: $challengeId)
}
`;
/**
* __useIsChallengeDismissedQuery__
*
* To run a query within a React component, call `useIsChallengeDismissedQuery` and pass it any options that fit your needs.
* When your component renders, `useIsChallengeDismissedQuery` 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 } = useIsChallengeDismissedQuery({
* variables: {
* challengeId: // value for 'challengeId'
* },
* });
*/
export function useIsChallengeDismissedQuery(
baseOptions: Apollo.QueryHookOptions<
IsChallengeDismissedQuery,
IsChallengeDismissedQueryVariables
>,
) {
const options = { ...defaultOptions, ...baseOptions };
return Apollo.useQuery<
IsChallengeDismissedQuery,
IsChallengeDismissedQueryVariables
>(IsChallengeDismissedDocument, options);
}
export function useIsChallengeDismissedLazyQuery(
baseOptions?: Apollo.LazyQueryHookOptions<
IsChallengeDismissedQuery,
IsChallengeDismissedQueryVariables
>,
) {
const options = { ...defaultOptions, ...baseOptions };
return Apollo.useLazyQuery<
IsChallengeDismissedQuery,
IsChallengeDismissedQueryVariables
>(IsChallengeDismissedDocument, options);
}
export function useIsChallengeDismissedSuspenseQuery(
baseOptions?: Apollo.SuspenseQueryHookOptions<
IsChallengeDismissedQuery,
IsChallengeDismissedQueryVariables
>,
) {
const options = { ...defaultOptions, ...baseOptions };
return Apollo.useSuspenseQuery<
IsChallengeDismissedQuery,
IsChallengeDismissedQueryVariables
>(IsChallengeDismissedDocument, options);
}
export type IsChallengeDismissedQueryHookResult = ReturnType<
typeof useIsChallengeDismissedQuery
>;
export type IsChallengeDismissedLazyQueryHookResult = ReturnType<
typeof useIsChallengeDismissedLazyQuery
>;
export type IsChallengeDismissedSuspenseQueryHookResult = ReturnType<
typeof useIsChallengeDismissedSuspenseQuery
>;
export type IsChallengeDismissedQueryResult = Apollo.QueryResult<
IsChallengeDismissedQuery,
IsChallengeDismissedQueryVariables
>;
export const DismissChallengeDocument = gql`
mutation DismissChallenge($challengeId: ID!) {
dismissChallenge(challengeId: $challengeId)
}
`;
export type DismissChallengeMutationFn = Apollo.MutationFunction<
DismissChallengeMutation,
DismissChallengeMutationVariables
>;
/**
* __useDismissChallengeMutation__
*
* To run a mutation, you first call `useDismissChallengeMutation` within a React component and pass it any options that fit your needs.
* When your component renders, `useDismissChallengeMutation` returns a tuple that includes:
* - A mutate function that you can call at any time to execute the mutation
* - An object with fields that represent the current status of the mutation's execution
*
* @param baseOptions options that will be passed into the mutation, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options-2;
*
* @example
* const [dismissChallengeMutation, { data, loading, error }] = useDismissChallengeMutation({
* variables: {
* challengeId: // value for 'challengeId'
* },
* });
*/
export function useDismissChallengeMutation(
baseOptions?: Apollo.MutationHookOptions<
DismissChallengeMutation,
DismissChallengeMutationVariables
>,
) {
const options = { ...defaultOptions, ...baseOptions };
return Apollo.useMutation<
DismissChallengeMutation,
DismissChallengeMutationVariables
>(DismissChallengeDocument, options);
}
export type DismissChallengeMutationHookResult = ReturnType<
typeof useDismissChallengeMutation
>;
export type DismissChallengeMutationResult =
Apollo.MutationResult<DismissChallengeMutation>;
export type DismissChallengeMutationOptions = Apollo.BaseMutationOptions<
DismissChallengeMutation,
DismissChallengeMutationVariables
>;
export const UndismissChallengeDocument = gql`
mutation UndismissChallenge($challengeId: ID!) {
undismissChallenge(challengeId: $challengeId)
}
`;
export type UndismissChallengeMutationFn = Apollo.MutationFunction<
UndismissChallengeMutation,
UndismissChallengeMutationVariables
>;
/**
* __useUndismissChallengeMutation__
*
* To run a mutation, you first call `useUndismissChallengeMutation` within a React component and pass it any options that fit your needs.
* When your component renders, `useUndismissChallengeMutation` returns a tuple that includes:
* - A mutate function that you can call at any time to execute the mutation
* - An object with fields that represent the current status of the mutation's execution
*
* @param baseOptions options that will be passed into the mutation, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options-2;
*
* @example
* const [undismissChallengeMutation, { data, loading, error }] = useUndismissChallengeMutation({
* variables: {
* challengeId: // value for 'challengeId'
* },
* });
*/
export function useUndismissChallengeMutation(
baseOptions?: Apollo.MutationHookOptions<
UndismissChallengeMutation,
UndismissChallengeMutationVariables
>,
) {
const options = { ...defaultOptions, ...baseOptions };
return Apollo.useMutation<
UndismissChallengeMutation,
UndismissChallengeMutationVariables
>(UndismissChallengeDocument, options);
}
export type UndismissChallengeMutationHookResult = ReturnType<
typeof useUndismissChallengeMutation
>;
export type UndismissChallengeMutationResult =
Apollo.MutationResult<UndismissChallengeMutation>;
export type UndismissChallengeMutationOptions = Apollo.BaseMutationOptions<
UndismissChallengeMutation,
UndismissChallengeMutationVariables
>;
export const CommentOnVideoDocument = gql`
mutation CommentOnVideo(
$videoId: Int!

View File

@@ -25,6 +25,33 @@ query GetChallenges {
}
}
query GetMyDismissedChallenges {
myDismissedChallenges {
id
name
description
minimumShots
startDate
endDate
createdAt
updatedAt
requiredTableSize
requiredPocketSize
isPublic
maxAttempts
ruleSet {
id
name
description
}
createdBy {
id
username
profileImageUri
}
}
}
query GetChallenge($id: ID!) {
challenge(id: $id) {
id
@@ -85,6 +112,7 @@ query GetChallengeLeaderboard($challengeId: ID!, $limit: Int) {
makeRate
qualified
createdAt
attemptCount
user {
id
username
@@ -240,3 +268,15 @@ mutation RecalculateChallengeEntry($entryId: ID!) {
makesCount
}
}
query IsChallengeDismissed($challengeId: ID!) {
isChallengeDismissed(challengeId: $challengeId)
}
mutation DismissChallenge($challengeId: ID!) {
dismissChallenge(challengeId: $challengeId)
}
mutation UndismissChallenge($challengeId: ID!) {
undismissChallenge(challengeId: $challengeId)
}

File diff suppressed because it is too large Load Diff