From 7889476bc9816819085fec7c4405c1ebdfc76ebb Mon Sep 17 00:00:00 2001 From: Mike Kalange Date: Fri, 22 Mar 2024 12:45:58 -0600 Subject: [PATCH] Remove deprecated statistics interface; add getLoggedInUser op. --- src/index.tsx | 105 +++++++++++++++++++++++++++++++++++----- src/operations/user.gql | 11 +++++ src/schema.gql | 15 ------ 3 files changed, 103 insertions(+), 28 deletions(-) diff --git a/src/index.tsx b/src/index.tsx index 9bbb22b..a38bc51 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -30,8 +30,6 @@ export type Scalars = { Float: { input: number; output: number }; /** Date with time (isoformat) */ DateTime: { input: any; output: any }; - /** Decimal (fixed-point) */ - Decimal: { input: any; output: any }; }; export type AggregateInputGql = { @@ -397,21 +395,10 @@ export type UserGql = { firebaseUid: Scalars["String"]["output"]; id: Scalars["Int"]["output"]; profileImageUri?: Maybe; - statistics: UserStatisticsGql; updatedAt?: Maybe; username: Scalars["String"]["output"]; }; -export type UserStatisticsGql = { - __typename?: "UserStatisticsGQL"; - averageTimeBetweenShots: Scalars["Decimal"]["output"]; - makePercentage: Scalars["Decimal"]["output"]; - medianRun?: Maybe; - timeSpentPlaying: Scalars["Decimal"]["output"]; - totalShots: Scalars["Int"]["output"]; - totalShotsMade: Scalars["Int"]["output"]; -}; - export type ValueFilterBool = { equals?: InputMaybe; }; @@ -632,6 +619,21 @@ export type EditProfileImageUriMutation = { }; }; +export type GetLoggedInUserQueryVariables = Exact<{ [key: string]: never }>; + +export type GetLoggedInUserQuery = { + __typename?: "Query"; + getLoggedInUser?: { + __typename?: "UserGQL"; + id: number; + firebaseUid: string; + username: string; + profileImageUri?: string | null; + createdAt?: any | null; + updatedAt?: any | null; + } | null; +}; + export type GetStreamMonitoringDetailsQueryVariables = Exact<{ videoId: Scalars["Int"]["input"]; }>; @@ -1272,6 +1274,83 @@ export type EditProfileImageUriMutationOptions = Apollo.BaseMutationOptions< EditProfileImageUriMutation, EditProfileImageUriMutationVariables >; +export const GetLoggedInUserDocument = gql` + query getLoggedInUser { + getLoggedInUser { + id + firebaseUid + username + profileImageUri + createdAt + updatedAt + } + } +`; + +/** + * __useGetLoggedInUserQuery__ + * + * To run a query within a React component, call `useGetLoggedInUserQuery` and pass it any options that fit your needs. + * When your component renders, `useGetLoggedInUserQuery` 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 } = useGetLoggedInUserQuery({ + * variables: { + * }, + * }); + */ +export function useGetLoggedInUserQuery( + baseOptions?: Apollo.QueryHookOptions< + GetLoggedInUserQuery, + GetLoggedInUserQueryVariables + >, +) { + const options = { ...defaultOptions, ...baseOptions }; + return Apollo.useQuery( + GetLoggedInUserDocument, + options, + ); +} +export function useGetLoggedInUserLazyQuery( + baseOptions?: Apollo.LazyQueryHookOptions< + GetLoggedInUserQuery, + GetLoggedInUserQueryVariables + >, +) { + const options = { ...defaultOptions, ...baseOptions }; + return Apollo.useLazyQuery< + GetLoggedInUserQuery, + GetLoggedInUserQueryVariables + >(GetLoggedInUserDocument, options); +} +export function useGetLoggedInUserSuspenseQuery( + baseOptions?: Apollo.SuspenseQueryHookOptions< + GetLoggedInUserQuery, + GetLoggedInUserQueryVariables + >, +) { + const options = { ...defaultOptions, ...baseOptions }; + return Apollo.useSuspenseQuery< + GetLoggedInUserQuery, + GetLoggedInUserQueryVariables + >(GetLoggedInUserDocument, options); +} +export type GetLoggedInUserQueryHookResult = ReturnType< + typeof useGetLoggedInUserQuery +>; +export type GetLoggedInUserLazyQueryHookResult = ReturnType< + typeof useGetLoggedInUserLazyQuery +>; +export type GetLoggedInUserSuspenseQueryHookResult = ReturnType< + typeof useGetLoggedInUserSuspenseQuery +>; +export type GetLoggedInUserQueryResult = Apollo.QueryResult< + GetLoggedInUserQuery, + GetLoggedInUserQueryVariables +>; export const GetStreamMonitoringDetailsDocument = gql` query GetStreamMonitoringDetails($videoId: Int!) { getVideo(videoId: $videoId) { diff --git a/src/operations/user.gql b/src/operations/user.gql index 1fb2b08..8703384 100644 --- a/src/operations/user.gql +++ b/src/operations/user.gql @@ -18,3 +18,14 @@ mutation editProfileImageUri($profileImageUri: String!) { updatedAt } } + +query getLoggedInUser { + getLoggedInUser { + id + firebaseUid + username + profileImageUri + createdAt + updatedAt + } +} diff --git a/src/schema.gql b/src/schema.gql index db4f3be..41cf56d 100644 --- a/src/schema.gql +++ b/src/schema.gql @@ -127,7 +127,6 @@ type UserGQL { profileImageUri: String createdAt: DateTime updatedAt: DateTime - statistics: UserStatisticsGQL! } """ @@ -135,20 +134,6 @@ Date with time (isoformat) """ scalar DateTime -type UserStatisticsGQL { - totalShots: Int! - totalShotsMade: Int! - makePercentage: Decimal! - averageTimeBetweenShots: Decimal! - timeSpentPlaying: Decimal! - medianRun: Decimal -} - -""" -Decimal (fixed-point) -""" -scalar Decimal - type DeployedConfigGQL { allowNewUsers: Boolean! }