GetUser operation + fragment #151

Merged
loewy merged 1 commits from loewy/get-user-operation-and-fragment into master 2024-12-19 12:47:21 -07:00
2 changed files with 145 additions and 32 deletions
Showing only changes of commit a883bc3e2f - Show all commits

View File

@ -3646,9 +3646,13 @@ export type EditProfileImageUriMutation = {
id: number;
firebaseUid?: string | null;
username: string;
isAdmin?: boolean | null;
profileImageUri?: string | null;
fargoRating?: number | null;
activeVideoId?: number | null;
createdAt?: any | null;
updatedAt?: any | null;
videosPrivateByDefault?: boolean | null;
};
};
@ -3671,6 +3675,27 @@ export type GetLoggedInUserQuery = {
} | null;
};
export type GetUserQueryVariables = Exact<{
userId: Scalars["Int"]["input"];
}>;
export type GetUserQuery = {
__typename?: "Query";
getUser?: {
__typename?: "UserGQL";
id: number;
firebaseUid?: string | null;
username: string;
isAdmin?: boolean | null;
profileImageUri?: string | null;
fargoRating?: number | null;
activeVideoId?: number | null;
createdAt?: any | null;
updatedAt?: any | null;
videosPrivateByDefault?: boolean | null;
} | null;
};
export type GetUserPlayTimeQueryVariables = Exact<{
userId: Scalars["Int"]["input"];
filters?: InputMaybe<VideoFilterInput>;
@ -3815,6 +3840,20 @@ export type EditUserMutation = {
};
};
export type UserFragmentFragment = {
__typename?: "UserGQL";
id: number;
firebaseUid?: string | null;
username: string;
isAdmin?: boolean | null;
profileImageUri?: string | null;
fargoRating?: number | null;
activeVideoId?: number | null;
createdAt?: any | null;
updatedAt?: any | null;
videosPrivateByDefault?: boolean | null;
};
export type GetStreamMonitoringDetailsQueryVariables = Exact<{
videoId: Scalars["Int"]["input"];
debuggingJson?: InputMaybe<Scalars["JSON"]["input"]>;
@ -4585,6 +4624,20 @@ export const ShotWithAllFeaturesFragmentDoc = gql`
}
}
`;
export const UserFragmentFragmentDoc = gql`
fragment UserFragment on UserGQL {
id
firebaseUid
username
isAdmin
profileImageUri
fargoRating
activeVideoId
createdAt
updatedAt
videosPrivateByDefault
}
`;
export const VideoStreamMetadataFragmentDoc = gql`
fragment VideoStreamMetadata on VideoGQL {
id
@ -6032,14 +6085,10 @@ export type GetProfileImageUploadLinkMutationOptions =
export const EditProfileImageUriDocument = gql`
mutation editProfileImageUri($profileImageUri: String!) {
editProfileImageUri(profileImageUri: $profileImageUri) {
id
firebaseUid
username
profileImageUri
createdAt
updatedAt
...UserFragment
}
}
${UserFragmentFragmentDoc}
`;
export type EditProfileImageUriMutationFn = Apollo.MutationFunction<
EditProfileImageUriMutation,
@ -6087,18 +6136,10 @@ export type EditProfileImageUriMutationOptions = Apollo.BaseMutationOptions<
export const GetLoggedInUserDocument = gql`
query getLoggedInUser {
getLoggedInUser {
id
firebaseUid
username
isAdmin
profileImageUri
fargoRating
activeVideoId
createdAt
updatedAt
videosPrivateByDefault
...UserFragment
}
}
${UserFragmentFragmentDoc}
`;
/**
@ -6165,6 +6206,73 @@ export type GetLoggedInUserQueryResult = Apollo.QueryResult<
GetLoggedInUserQuery,
GetLoggedInUserQueryVariables
>;
export const GetUserDocument = gql`
query GetUser($userId: Int!) {
getUser(userId: $userId) {
...UserFragment
}
}
${UserFragmentFragmentDoc}
`;
/**
* __useGetUserQuery__
*
* To run a query within a React component, call `useGetUserQuery` and pass it any options that fit your needs.
* When your component renders, `useGetUserQuery` 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 } = useGetUserQuery({
* variables: {
* userId: // value for 'userId'
* },
* });
*/
export function useGetUserQuery(
baseOptions: Apollo.QueryHookOptions<GetUserQuery, GetUserQueryVariables>,
) {
const options = { ...defaultOptions, ...baseOptions };
return Apollo.useQuery<GetUserQuery, GetUserQueryVariables>(
GetUserDocument,
options,
);
}
export function useGetUserLazyQuery(
baseOptions?: Apollo.LazyQueryHookOptions<
GetUserQuery,
GetUserQueryVariables
>,
) {
const options = { ...defaultOptions, ...baseOptions };
return Apollo.useLazyQuery<GetUserQuery, GetUserQueryVariables>(
GetUserDocument,
options,
);
}
export function useGetUserSuspenseQuery(
baseOptions?: Apollo.SuspenseQueryHookOptions<
GetUserQuery,
GetUserQueryVariables
>,
) {
const options = { ...defaultOptions, ...baseOptions };
return Apollo.useSuspenseQuery<GetUserQuery, GetUserQueryVariables>(
GetUserDocument,
options,
);
}
export type GetUserQueryHookResult = ReturnType<typeof useGetUserQuery>;
export type GetUserLazyQueryHookResult = ReturnType<typeof useGetUserLazyQuery>;
export type GetUserSuspenseQueryHookResult = ReturnType<
typeof useGetUserSuspenseQuery
>;
export type GetUserQueryResult = Apollo.QueryResult<
GetUserQuery,
GetUserQueryVariables
>;
export const GetUserPlayTimeDocument = gql`
query GetUserPlayTime($userId: Int!, $filters: VideoFilterInput) {
getPlayTime(userId: $userId, filters: $filters) {

View File

@ -21,27 +21,19 @@ mutation getProfileImageUploadLink($fileExt: String = ".png") {
mutation editProfileImageUri($profileImageUri: String!) {
editProfileImageUri(profileImageUri: $profileImageUri) {
id
firebaseUid
username
profileImageUri
createdAt
updatedAt
...UserFragment
}
}
query getLoggedInUser {
getLoggedInUser {
id
firebaseUid
username
isAdmin
profileImageUri
fargoRating
activeVideoId
createdAt
updatedAt
videosPrivateByDefault
...UserFragment
}
}
query GetUser($userId: Int!) {
getUser(userId: $userId) {
...UserFragment
}
}
@ -157,3 +149,16 @@ mutation editUser(
videosPrivateByDefault
}
}
fragment UserFragment on UserGQL {
id
firebaseUid
username
isAdmin
profileImageUri
fargoRating
activeVideoId
createdAt
updatedAt
videosPrivateByDefault
}