Add EditShot operation #149

Merged
loewy merged 1 commits from loewy/add-edit-shot-operation into master 2024-12-09 14:33:48 -07:00
2 changed files with 135 additions and 0 deletions

View File

@ -3512,6 +3512,74 @@ export type ShotWithAllFeaturesFragment = {
}>; }>;
}; };
export type EditShotMutationVariables = Exact<{
shotId: Scalars["Int"]["input"];
fieldsToEdit: EditableShotFieldInputGql;
}>;
export type EditShotMutation = {
__typename?: "Mutation";
editShot: {
__typename?: "EditShotReturn";
error?: {
__typename?: "DoesNotOwnShotErr";
shotId: number;
msg?: string | null;
} | null;
shot?: {
__typename?: "ShotGQL";
id: number;
videoId: number;
startFrame: number;
endFrame: number;
startTime: number;
endTime: number;
falsePositiveScore?: number | null;
createdAt?: any | null;
updatedAt?: any | null;
user?: { __typename?: "UserGQL"; id: number } | null;
cueObjectFeatures?: {
__typename?: "CueObjectFeaturesGQL";
cueObjectDistance?: number | null;
cueObjectAngle?: number | null;
cueBallSpeed?: number | null;
shotDirection?: ShotDirectionEnum | null;
spinType?: SpinTypeEnum | null;
} | null;
pocketingIntentionFeatures?: {
__typename?: "PocketingIntentionFeaturesGQL";
make?: boolean | null;
targetPocketDistance?: number | null;
targetPocketAngle?: number | null;
targetPocketAngleDirection?: ShotDirectionEnum | null;
marginOfErrorInDegrees?: number | null;
intendedPocketType?: PocketEnum | null;
difficulty?: number | null;
} | null;
pocketingIntentionInfo?: {
__typename?: "PocketingIntentionInfoGQL";
ballId: number;
pocketId: PocketIdentifier;
pathMetadataIndex: number;
} | null;
serializedShotPaths?: {
__typename?: "SerializedShotPathsGQL";
b64EncodedBuffer?: string | null;
} | null;
annotations: Array<{
__typename?: "ShotAnnotationGQL";
shotId: number;
notes: string;
type: {
__typename?: "ShotAnnotationTypeGQL";
id: number;
name: string;
};
}>;
} | null;
};
};
export type GetProfileImageUploadLinkMutationVariables = Exact<{ export type GetProfileImageUploadLinkMutationVariables = Exact<{
fileExt?: InputMaybe<Scalars["String"]["input"]>; fileExt?: InputMaybe<Scalars["String"]["input"]>;
}>; }>;
@ -5807,6 +5875,61 @@ export type GetShotsByIdsQueryResult = Apollo.QueryResult<
GetShotsByIdsQuery, GetShotsByIdsQuery,
GetShotsByIdsQueryVariables GetShotsByIdsQueryVariables
>; >;
export const EditShotDocument = gql`
mutation EditShot($shotId: Int!, $fieldsToEdit: EditableShotFieldInputGQL!) {
editShot(shotId: $shotId, fieldsToEdit: $fieldsToEdit) {
error {
shotId
msg
}
shot {
...ShotWithAllFeatures
}
}
}
${ShotWithAllFeaturesFragmentDoc}
`;
export type EditShotMutationFn = Apollo.MutationFunction<
EditShotMutation,
EditShotMutationVariables
>;
/**
* __useEditShotMutation__
*
* To run a mutation, you first call `useEditShotMutation` within a React component and pass it any options that fit your needs.
* When your component renders, `useEditShotMutation` 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 [editShotMutation, { data, loading, error }] = useEditShotMutation({
* variables: {
* shotId: // value for 'shotId'
* fieldsToEdit: // value for 'fieldsToEdit'
* },
* });
*/
export function useEditShotMutation(
baseOptions?: Apollo.MutationHookOptions<
EditShotMutation,
EditShotMutationVariables
>,
) {
const options = { ...defaultOptions, ...baseOptions };
return Apollo.useMutation<EditShotMutation, EditShotMutationVariables>(
EditShotDocument,
options,
);
}
export type EditShotMutationHookResult = ReturnType<typeof useEditShotMutation>;
export type EditShotMutationResult = Apollo.MutationResult<EditShotMutation>;
export type EditShotMutationOptions = Apollo.BaseMutationOptions<
EditShotMutation,
EditShotMutationVariables
>;
export const GetProfileImageUploadLinkDocument = gql` export const GetProfileImageUploadLinkDocument = gql`
mutation getProfileImageUploadLink($fileExt: String = ".png") { mutation getProfileImageUploadLink($fileExt: String = ".png") {
getProfileImageUploadLink(fileExt: $fileExt) { getProfileImageUploadLink(fileExt: $fileExt) {

View File

@ -178,3 +178,15 @@ fragment ShotWithAllFeatures on ShotGQL {
notes notes
} }
} }
mutation EditShot($shotId: Int!, $fieldsToEdit: EditableShotFieldInputGQL!) {
editShot(shotId: $shotId, fieldsToEdit: $fieldsToEdit) {
error {
shotId
msg
}
shot {
...ShotWithAllFeatures
}
}
}