feat(web): W5-C subscription progress, manual search and episode total
- subscription sheet: 立即搜索, active-search times, 追更进度 (per-season total with source/lock, per-episode state chips, in-flight/deferred counts) and set/lock season episode total - labels for subscription pending and candidate decision deferred Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
1 parent
7aa6cac717
commit
80780add66
4 files changed
+175
-1
No files matched your search
@@ -1,10 +1,12 @@
|
||||
import { keepPreviousData, useInfiniteQuery, useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
|
||||
import {
|
||||
cursorPage,
|
||||
type EpisodeTotalSet,
|
||||
MediaEntity,
|
||||
Subscription,
|
||||
type SubscriptionCreate,
|
||||
type SubscriptionMediaKind,
|
||||
SubscriptionProgress,
|
||||
type SubscriptionStatus,
|
||||
type SubscriptionUpdate,
|
||||
} from "@umt/contracts";
|
||||
@@ -70,3 +72,31 @@ export function useEntityTitle(id: string | null | undefined) {
|
||||
queryFn: ({ signal }) => getParsed(MediaEntity, `/media-entities/${id}`, undefined, signal),
|
||||
});
|
||||
}
|
||||
|
||||
/** 订阅进度:季总集数账本 + 每集状态(已覆盖/在途/缺失/疑似缺集)+ Slot 在途与延后(W5-C) */
|
||||
export function useSubscriptionProgress(id: string | null | undefined, enabled = true) {
|
||||
return useQuery({
|
||||
queryKey: ["subscriptions", "progress", id ?? ""],
|
||||
enabled: !!id && enabled,
|
||||
queryFn: ({ signal }) => getParsed(SubscriptionProgress, `/subscriptions/${id}/progress`, undefined, signal),
|
||||
});
|
||||
}
|
||||
|
||||
/** 手动主动搜索:按标题/别名在已开启站点搜索,结果走同一识别评估链 */
|
||||
export function useSearchSubscription() {
|
||||
return useMutation({
|
||||
mutationFn: (id: string) => api.post<{ runId: string; deduplicated: boolean }>(`/subscriptions/${id}/search`),
|
||||
});
|
||||
}
|
||||
|
||||
/** 手动设置季总集数(不锁定时只升;锁定后元数据刷新不再改写) */
|
||||
export function useSetEpisodeTotal() {
|
||||
const qc = useQueryClient();
|
||||
return useMutation({
|
||||
mutationFn: ({ id, ...body }: EpisodeTotalSet & { id: string }) =>
|
||||
api
|
||||
.post<unknown>(`/subscriptions/${id}/episode-total`, body)
|
||||
.then((d) => parseOrThrow(SubscriptionProgress, d, "/subscriptions/episode-total")),
|
||||
onSuccess: (_d, v) => void qc.invalidateQueries({ queryKey: ["subscriptions", "progress", v.id] }),
|
||||
});
|
||||
}
|
||||
Reference in new issue
Block a user