Add get longest runs operation

This commit is contained in:
Ivan Malison 2024-12-23 13:55:14 -07:00
parent 8bc67f75b0
commit 881350619a
2 changed files with 119 additions and 0 deletions

View File

@ -3115,6 +3115,29 @@ export type GetMakesLeaderboardQuery = {
}; };
}; };
export type GetRunsLeaderboardQueryVariables = Exact<{
interval?: InputMaybe<TimeInterval>;
when?: InputMaybe<Scalars["DateTime"]["input"]>;
}>;
export type GetRunsLeaderboardQuery = {
__typename?: "Query";
getLongestRunsLeaderboard: {
__typename?: "RunLeaderboardGQL";
entries: Array<{
__typename?: "RunGQL";
id: number;
runLength: number;
user: {
__typename?: "UserGQL";
id: number;
username: string;
profileImageUri?: string | null;
};
}>;
};
};
export type GetVideoMakePercentageIntervalsQueryVariables = Exact<{ export type GetVideoMakePercentageIntervalsQueryVariables = Exact<{
videoId: Scalars["ID"]["input"]; videoId: Scalars["ID"]["input"];
intervalDuration: Scalars["Int"]["input"]; intervalDuration: Scalars["Int"]["input"];
@ -5235,6 +5258,88 @@ export type GetMakesLeaderboardQueryResult = Apollo.QueryResult<
GetMakesLeaderboardQuery, GetMakesLeaderboardQuery,
GetMakesLeaderboardQueryVariables GetMakesLeaderboardQueryVariables
>; >;
export const GetRunsLeaderboardDocument = gql`
query GetRunsLeaderboard($interval: TimeInterval, $when: DateTime) {
getLongestRunsLeaderboard(interval: $interval, when: $when) {
entries {
id
runLength
user {
id
username
profileImageUri
}
}
}
}
`;
/**
* __useGetRunsLeaderboardQuery__
*
* To run a query within a React component, call `useGetRunsLeaderboardQuery` and pass it any options that fit your needs.
* When your component renders, `useGetRunsLeaderboardQuery` 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 } = useGetRunsLeaderboardQuery({
* variables: {
* interval: // value for 'interval'
* when: // value for 'when'
* },
* });
*/
export function useGetRunsLeaderboardQuery(
baseOptions?: Apollo.QueryHookOptions<
GetRunsLeaderboardQuery,
GetRunsLeaderboardQueryVariables
>,
) {
const options = { ...defaultOptions, ...baseOptions };
return Apollo.useQuery<
GetRunsLeaderboardQuery,
GetRunsLeaderboardQueryVariables
>(GetRunsLeaderboardDocument, options);
}
export function useGetRunsLeaderboardLazyQuery(
baseOptions?: Apollo.LazyQueryHookOptions<
GetRunsLeaderboardQuery,
GetRunsLeaderboardQueryVariables
>,
) {
const options = { ...defaultOptions, ...baseOptions };
return Apollo.useLazyQuery<
GetRunsLeaderboardQuery,
GetRunsLeaderboardQueryVariables
>(GetRunsLeaderboardDocument, options);
}
export function useGetRunsLeaderboardSuspenseQuery(
baseOptions?: Apollo.SuspenseQueryHookOptions<
GetRunsLeaderboardQuery,
GetRunsLeaderboardQueryVariables
>,
) {
const options = { ...defaultOptions, ...baseOptions };
return Apollo.useSuspenseQuery<
GetRunsLeaderboardQuery,
GetRunsLeaderboardQueryVariables
>(GetRunsLeaderboardDocument, options);
}
export type GetRunsLeaderboardQueryHookResult = ReturnType<
typeof useGetRunsLeaderboardQuery
>;
export type GetRunsLeaderboardLazyQueryHookResult = ReturnType<
typeof useGetRunsLeaderboardLazyQuery
>;
export type GetRunsLeaderboardSuspenseQueryHookResult = ReturnType<
typeof useGetRunsLeaderboardSuspenseQuery
>;
export type GetRunsLeaderboardQueryResult = Apollo.QueryResult<
GetRunsLeaderboardQuery,
GetRunsLeaderboardQueryVariables
>;
export const GetVideoMakePercentageIntervalsDocument = gql` export const GetVideoMakePercentageIntervalsDocument = gql`
query GetVideoMakePercentageIntervals( query GetVideoMakePercentageIntervals(
$videoId: ID! $videoId: ID!

View File

@ -12,3 +12,17 @@ query GetMakesLeaderboard($interval: TimeInterval, $when: DateTime) {
} }
} }
} }
query GetRunsLeaderboard($interval: TimeInterval, $when: DateTime) {
getLongestRunsLeaderboard(interval: $interval, when: $when) {
entries {
id
runLength
user {
id
username
profileImageUri
}
}
}
}