feat(ticket): add issues map to ticket assignment page
This commit is contained in:
@@ -13,6 +13,7 @@ import { detectionService, ticketService, videoService } from '@/services/api';
|
||||
import type {
|
||||
AssignTicketPayload,
|
||||
CloseTicketPayload,
|
||||
DetectionCoordinatesParams,
|
||||
DiscardDetectionPayload,
|
||||
RequestTicketExtensionPayload,
|
||||
ReviewDetectionRepairProofPayload,
|
||||
@@ -122,6 +123,42 @@ export function useTicketDetectionsQuery(
|
||||
});
|
||||
}
|
||||
|
||||
export function useDetectionCoordinatesQuery(
|
||||
videoId: string | undefined,
|
||||
params: DetectionCoordinatesParams,
|
||||
) {
|
||||
const queryParams = useMemo<DetectionCoordinatesParams>(
|
||||
() => ({
|
||||
limit: params.limit ?? 50,
|
||||
class_name: params.class_name,
|
||||
search: params.search,
|
||||
}),
|
||||
[params.class_name, params.limit, params.search],
|
||||
);
|
||||
|
||||
return useInfiniteQuery({
|
||||
queryKey: ticketKeys.detectionCoordinates(videoId ?? '', queryParams),
|
||||
queryFn: ({ pageParam }) =>
|
||||
detectionService.getCoordinates(videoId as string, {
|
||||
...queryParams,
|
||||
skip: pageParam,
|
||||
}),
|
||||
initialPageParam: 0,
|
||||
getNextPageParam: (lastPage, allPages) => {
|
||||
if (lastPage.items.length === 0) return undefined;
|
||||
|
||||
const loadedCount = allPages.reduce(
|
||||
(total, page) => total + page.items.length,
|
||||
0,
|
||||
);
|
||||
|
||||
return loadedCount < lastPage.total ? loadedCount : undefined;
|
||||
},
|
||||
enabled: Boolean(videoId),
|
||||
staleTime: 60 * 1000,
|
||||
});
|
||||
}
|
||||
|
||||
export function useTicketClassDetectionsQuery(
|
||||
videoId: string | undefined,
|
||||
params: VideoDetectionsParams,
|
||||
|
||||
Reference in New Issue
Block a user