Create shot fragment
Some checks failed
Tests / Tests (pull_request) Failing after 4s

This commit is contained in:
Kat Huang 2024-09-30 17:08:11 -06:00
parent ce54bef0b4
commit 1a4b676635
2 changed files with 139 additions and 69 deletions

View File

@ -2380,6 +2380,44 @@ export type GetShotsWithMetadataQuery = {
}; };
}; };
export type ShotFragmentFragment = {
__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"]; includeCreatedAt?: Scalars["Boolean"]["input"];
@ -2399,7 +2437,7 @@ export type GetShotsByIdsQueryVariables = Exact<{
export type GetShotsByIdsQuery = { export type GetShotsByIdsQuery = {
__typename?: "Query"; __typename?: "Query";
getShotsByIds: Array<{ getShotsByIds: Array<{
__typename?: "ShotGQL"; __typename: "ShotGQL";
id: number; id: number;
videoId: number; videoId: number;
startFrame: number; startFrame: number;
@ -2407,20 +2445,21 @@ export type GetShotsByIdsQuery = {
falsePositiveScore?: number | null; falsePositiveScore?: number | null;
createdAt?: any | null; createdAt?: any | null;
updatedAt?: any | null; updatedAt?: any | null;
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: {
__typename?: "VideoResolutionGQL"; __typename: "VideoResolutionGQL";
width?: number | null; width?: number | null;
height?: number | null; height?: number | null;
}; };
} | null; } | null;
} | null; } | null;
cueObjectFeatures?: { cueObjectFeatures?: {
__typename?: "CueObjectFeaturesGQL"; __typename: "CueObjectFeaturesGQL";
cueObjectDistance?: number | null; cueObjectDistance?: number | null;
cueObjectAngle?: number | null; cueObjectAngle?: number | null;
cueBallSpeed?: number | null; cueBallSpeed?: number | null;
@ -2428,7 +2467,7 @@ export type GetShotsByIdsQuery = {
spinType?: SpinTypeEnum | null; spinType?: SpinTypeEnum | null;
} | null; } | null;
pocketingIntentionFeatures?: { pocketingIntentionFeatures?: {
__typename?: "PocketingIntentionFeaturesGQL"; __typename: "PocketingIntentionFeaturesGQL";
targetPocketDistance?: number | null; targetPocketDistance?: number | null;
make?: boolean | null; make?: boolean | null;
intendedPocketType?: PocketEnum | null; intendedPocketType?: PocketEnum | null;
@ -2979,6 +3018,48 @@ export type GetUploadStreamsWithDetailsQuery = {
}; };
}; };
export const ShotFragmentFragmentDoc = gql`
fragment ShotFragment on ShotGQL {
__typename
id
videoId
startFrame
endFrame
falsePositiveScore
createdAt
updatedAt
user {
__typename
id
}
video {
__typename
id
stream {
__typename
resolution {
__typename
width
height
}
}
}
cueObjectFeatures {
__typename
cueObjectDistance
cueObjectAngle
cueBallSpeed
shotDirection
spinType
}
pocketingIntentionFeatures {
__typename
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) {
@ -3768,39 +3849,10 @@ export const GetShotsByIdsDocument = gql`
$includeIntendedPocketType: Boolean! = false $includeIntendedPocketType: Boolean! = false
) { ) {
getShotsByIds(ids: $ids) { getShotsByIds(ids: $ids) {
id ...ShotFragment
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)
}
} }
} }
${ShotFragmentFragmentDoc}
`; `;
/** /**

View File

@ -139,6 +139,51 @@ query GetShotsWithMetadata(
} }
} }
} }
# shot.gql
fragment ShotFragment on ShotGQL {
__typename
id
videoId
startFrame
endFrame
falsePositiveScore
createdAt
updatedAt
user {
__typename
id
# Add other necessary fields from UserGql if needed
}
video {
__typename
id
# Add other necessary fields from VideoGql if needed
stream {
__typename
resolution {
__typename
width
height
}
}
}
cueObjectFeatures {
__typename
cueObjectDistance
cueObjectAngle
cueBallSpeed
shotDirection
spinType
}
pocketingIntentionFeatures {
__typename
targetPocketDistance
make
intendedPocketType
}
# Add other nested fields as required
}
query GetShotsByIds( query GetShotsByIds(
$ids: [Int!]! $ids: [Int!]!
@ -156,36 +201,9 @@ query GetShotsByIds(
$includeIntendedPocketType: Boolean! = false $includeIntendedPocketType: Boolean! = false
) { ) {
getShotsByIds(ids: $ids) { getShotsByIds(ids: $ids) {
id ...ShotFragment
videoId # Since the fragment already includes all necessary fields,
startFrame # you can remove the conditional fields from the query itself.
endFrame # Alternatively, if you still need conditional fields, handle them within the fragment.
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)
}
} }
} }