Crate shot with all features fragment #63

Merged
kkathuang merged 2 commits from kat/create-shot-fragment into master 2024-10-01 19:19:41 -06:00
2 changed files with 111 additions and 114 deletions

View File

@ -2380,20 +2380,46 @@ export type GetShotsWithMetadataQuery = {
}; };
}; };
export type ShotWithAllFeaturesFragment = {
__typename?: "ShotGQL";
id: number;
videoId: number;
startFrame: number;
endFrame: number;
falsePositiveScore?: number | null;
createdAt?: any | null;
updatedAt?: any | null;
user?: { __typename?: "UserGQL"; id: number } | null;
video?: {
__typename?: "VideoGQL";
id: number;
stream?: {
__typename?: "UploadStreamGQL";
resolution: {
__typename?: "VideoResolutionGQL";
width?: number | null;
height?: number | null;
};
} | null;
} | null;
cueObjectFeatures?: {
__typename?: "CueObjectFeaturesGQL";
cueObjectDistance?: number | null;
cueObjectAngle?: number | null;
cueBallSpeed?: number | null;
shotDirection?: ShotDirectionEnum | null;
spinType?: SpinTypeEnum | null;
} | null;
pocketingIntentionFeatures?: {
__typename?: "PocketingIntentionFeaturesGQL";
targetPocketDistance?: number | null;
make?: boolean | null;
intendedPocketType?: PocketEnum | null;
} | null;
};
export type GetShotsByIdsQueryVariables = Exact<{ export type GetShotsByIdsQueryVariables = Exact<{
ids: Array<Scalars["Int"]["input"]> | Scalars["Int"]["input"]; ids: Array<Scalars["Int"]["input"]> | Scalars["Int"]["input"];
includeCreatedAt?: Scalars["Boolean"]["input"];
includeUpdatedAt?: Scalars["Boolean"]["input"];
includeCueObjectFeatures?: Scalars["Boolean"]["input"];
includePocketingIntentionFeatures?: Scalars["Boolean"]["input"];
includeCueObjectDistance?: Scalars["Boolean"]["input"];
includeCueObjectAngle?: Scalars["Boolean"]["input"];
includeCueBallSpeed?: Scalars["Boolean"]["input"];
includeSpinType?: Scalars["Boolean"]["input"];
includeShotDirection?: Scalars["Boolean"]["input"];
includeTargetPocketDistance?: Scalars["Boolean"]["input"];
includeMake?: Scalars["Boolean"]["input"];
includeIntendedPocketType?: Scalars["Boolean"]["input"];
}>; }>;
export type GetShotsByIdsQuery = { export type GetShotsByIdsQuery = {
@ -2410,6 +2436,7 @@ export type GetShotsByIdsQuery = {
user?: { __typename?: "UserGQL"; id: number } | null; user?: { __typename?: "UserGQL"; id: number } | null;
video?: { video?: {
__typename?: "VideoGQL"; __typename?: "VideoGQL";
id: number;
stream?: { stream?: {
__typename?: "UploadStreamGQL"; __typename?: "UploadStreamGQL";
resolution: { resolution: {
@ -2979,6 +3006,41 @@ export type GetUploadStreamsWithDetailsQuery = {
}; };
}; };
export const ShotWithAllFeaturesFragmentDoc = gql`
fragment ShotWithAllFeatures on ShotGQL {
id
videoId
startFrame
endFrame
falsePositiveScore
createdAt
updatedAt
user {
id
}
video {
id
stream {
resolution {
width
height
}
}
}
cueObjectFeatures {
cueObjectDistance
cueObjectAngle
cueBallSpeed
shotDirection
spinType
}
pocketingIntentionFeatures {
targetPocketDistance
make
intendedPocketType
}
}
`;
export const GetAggregatedShotMetricsDocument = gql` export const GetAggregatedShotMetricsDocument = gql`
query GetAggregatedShotMetrics($aggregateInput: AggregateInputGQL!) { query GetAggregatedShotMetrics($aggregateInput: AggregateInputGQL!) {
getAggregatedShotMetrics(aggregateInput: $aggregateInput) { getAggregatedShotMetrics(aggregateInput: $aggregateInput) {
@ -3752,55 +3814,12 @@ export type GetShotsWithMetadataQueryResult = Apollo.QueryResult<
GetShotsWithMetadataQueryVariables GetShotsWithMetadataQueryVariables
>; >;
export const GetShotsByIdsDocument = gql` export const GetShotsByIdsDocument = gql`
query GetShotsByIds( query GetShotsByIds($ids: [Int!]!) {
$ids: [Int!]!
$includeCreatedAt: Boolean! = false
$includeUpdatedAt: Boolean! = false
$includeCueObjectFeatures: Boolean! = false
$includePocketingIntentionFeatures: Boolean! = false
$includeCueObjectDistance: Boolean! = false
$includeCueObjectAngle: Boolean! = false
$includeCueBallSpeed: Boolean! = false
$includeSpinType: Boolean! = false
$includeShotDirection: Boolean! = false
$includeTargetPocketDistance: Boolean! = false
$includeMake: Boolean! = false
$includeIntendedPocketType: Boolean! = false
) {
getShotsByIds(ids: $ids) { getShotsByIds(ids: $ids) {
id ...ShotWithAllFeatures
videoId
startFrame
endFrame
user {
id
}
falsePositiveScore
video {
stream {
resolution {
width
height
}
}
}
createdAt @include(if: $includeCreatedAt)
updatedAt @include(if: $includeUpdatedAt)
cueObjectFeatures @include(if: $includeCueObjectFeatures) {
cueObjectDistance @include(if: $includeCueObjectDistance)
cueObjectAngle @include(if: $includeCueObjectAngle)
cueBallSpeed @include(if: $includeCueBallSpeed)
shotDirection @include(if: $includeShotDirection)
spinType @include(if: $includeSpinType)
}
pocketingIntentionFeatures
@include(if: $includePocketingIntentionFeatures) {
targetPocketDistance @include(if: $includeTargetPocketDistance)
make @include(if: $includeMake)
intendedPocketType @include(if: $includeIntendedPocketType)
}
} }
} }
${ShotWithAllFeaturesFragmentDoc}
`; `;
/** /**
@ -3816,18 +3835,6 @@ export const GetShotsByIdsDocument = gql`
* const { data, loading, error } = useGetShotsByIdsQuery({ * const { data, loading, error } = useGetShotsByIdsQuery({
* variables: { * variables: {
* ids: // value for 'ids' * ids: // value for 'ids'
* includeCreatedAt: // value for 'includeCreatedAt'
* includeUpdatedAt: // value for 'includeUpdatedAt'
* includeCueObjectFeatures: // value for 'includeCueObjectFeatures'
* includePocketingIntentionFeatures: // value for 'includePocketingIntentionFeatures'
* includeCueObjectDistance: // value for 'includeCueObjectDistance'
* includeCueObjectAngle: // value for 'includeCueObjectAngle'
* includeCueBallSpeed: // value for 'includeCueBallSpeed'
* includeSpinType: // value for 'includeSpinType'
* includeShotDirection: // value for 'includeShotDirection'
* includeTargetPocketDistance: // value for 'includeTargetPocketDistance'
* includeMake: // value for 'includeMake'
* includeIntendedPocketType: // value for 'includeIntendedPocketType'
* }, * },
* }); * });
*/ */

View File

@ -140,31 +140,19 @@ query GetShotsWithMetadata(
} }
} }
query GetShotsByIds( fragment ShotWithAllFeatures on ShotGQL {
$ids: [Int!]!
$includeCreatedAt: Boolean! = false
$includeUpdatedAt: Boolean! = false
$includeCueObjectFeatures: Boolean! = false
$includePocketingIntentionFeatures: Boolean! = false
$includeCueObjectDistance: Boolean! = false
$includeCueObjectAngle: Boolean! = false
$includeCueBallSpeed: Boolean! = false
$includeSpinType: Boolean! = false
$includeShotDirection: Boolean! = false
$includeTargetPocketDistance: Boolean! = false
$includeMake: Boolean! = false
$includeIntendedPocketType: Boolean! = false
) {
getShotsByIds(ids: $ids) {
id id
videoId videoId
startFrame startFrame
endFrame endFrame
falsePositiveScore
createdAt
updatedAt
user { user {
id id
} }
falsePositiveScore
video { video {
id
stream { stream {
resolution { resolution {
width width
@ -172,20 +160,22 @@ query GetShotsByIds(
} }
} }
} }
createdAt @include(if: $includeCreatedAt) cueObjectFeatures {
updatedAt @include(if: $includeUpdatedAt) cueObjectDistance
cueObjectFeatures @include(if: $includeCueObjectFeatures) { cueObjectAngle
cueObjectDistance @include(if: $includeCueObjectDistance) cueBallSpeed
cueObjectAngle @include(if: $includeCueObjectAngle) shotDirection
cueBallSpeed @include(if: $includeCueBallSpeed) spinType
shotDirection @include(if: $includeShotDirection)
spinType @include(if: $includeSpinType)
} }
pocketingIntentionFeatures pocketingIntentionFeatures {
@include(if: $includePocketingIntentionFeatures) { targetPocketDistance
targetPocketDistance @include(if: $includeTargetPocketDistance) make
make @include(if: $includeMake) intendedPocketType
intendedPocketType @include(if: $includeIntendedPocketType)
} }
} }
query GetShotsByIds($ids: [Int!]!) {
getShotsByIds(ids: $ids) {
...ShotWithAllFeatures
}
} }