feat(web): subscription calendar view, reset action and quality preset fields
Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
1 parent
70d56645fe
commit
05350460f0
7 files changed
+638
-166
No files matched your search
@@ -7,6 +7,7 @@ import {
|
||||
Subscription,
|
||||
type SubscriptionBatch,
|
||||
SubscriptionBatchResult,
|
||||
SubscriptionCalendar,
|
||||
SubscriptionCoverage,
|
||||
type SubscriptionCreate,
|
||||
type SubscriptionGroup,
|
||||
@@ -14,6 +15,7 @@ import {
|
||||
type SubscriptionOrigin,
|
||||
SubscriptionOverviewPage,
|
||||
SubscriptionProgress,
|
||||
SubscriptionResetResult,
|
||||
type SubscriptionSort,
|
||||
type SubscriptionStatus,
|
||||
type SubscriptionUpdate,
|
||||
@@ -30,6 +32,8 @@ export const subscriptionKeys = {
|
||||
overview: (f: OverviewFilters) => ["subscriptions", "overview", f] as const,
|
||||
detail: (id: string) => ["subscriptions", "detail", id] as const,
|
||||
coverage: (id: string) => ["subscriptions", "coverage", id] as const,
|
||||
calendar: (from: string, to: string, kind?: SubscriptionMediaKind) =>
|
||||
["subscriptions", "calendar", from, to, kind ?? ""] as const,
|
||||
};
|
||||
|
||||
export type SubscriptionFilters = {
|
||||
@@ -254,6 +258,28 @@ export function useSetSlotOrder() {
|
||||
});
|
||||
}
|
||||
|
||||
/** 重置进度:取消未提交/下载已不在的计划,清延后,重评;仍在下载的保留,不删资产 */
|
||||
export function useResetSubscription() {
|
||||
const done = useInvalidateSubs();
|
||||
return useMutation({
|
||||
mutationFn: (id: string) =>
|
||||
api
|
||||
.post<unknown>(`/subscriptions/${id}/reset`)
|
||||
.then((d) => parseOrThrow(SubscriptionResetResult, d, "/subscriptions/reset")),
|
||||
onSuccess: done,
|
||||
});
|
||||
}
|
||||
|
||||
/** 日历:from / to 为 YYYY-MM-DD,跨度不超过 62 天 */
|
||||
export function useSubscriptionCalendar(from: string, to: string, mediaKind?: SubscriptionMediaKind) {
|
||||
return useQuery({
|
||||
queryKey: subscriptionKeys.calendar(from, to, mediaKind),
|
||||
queryFn: ({ signal }) =>
|
||||
getParsed(SubscriptionCalendar, "/subscriptions/calendar", { from, to, mediaKind }, signal),
|
||||
placeholderData: keepPreviousData,
|
||||
});
|
||||
}
|
||||
|
||||
/** 409 重复订阅:消息里带已有订阅 id */
|
||||
export function duplicateSubscriptionId(message: string): string | null {
|
||||
const m = /已有订阅[::]\s*([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})/i.exec(message);
|
||||
|
||||
Reference in new issue
Block a user