feat: add reading_status_push job — differential push to AniList

Push reading statuses (PLANNING/CURRENT/COMPLETED) to AniList for all
linked series that changed since last sync, or have new books/no sync yet.

- Migration 0057: adds reading_status_push to index_jobs type constraint
- Migration 0058: creates reading_status_push_results table (pushed/skipped/no_books/error)
- API: new reading_status_push module with start_push, get_push_report, get_push_results
- Differential detection: synced_at IS NULL OR reading progress updated OR new books added
- Same 429 retry logic as reading_status_match (wait 10s, retry once, abort on 2nd 429)
- Notifications: ReadingStatusPushCompleted/Failed events
- Backoffice: push button in reading status group, job detail report with per-series list
- Replay support, badge label, i18n (FR + EN)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-25 10:30:04 +01:00
parent d977b6b27a
commit 10cc69e53f
13 changed files with 939 additions and 7 deletions

View File

@@ -1102,6 +1102,43 @@ export async function getReadingStatusMatchResults(jobId: string) {
return apiFetch<ReadingStatusMatchResultDto[]>(`/reading-status/match/${jobId}/results`);
}
export async function startReadingStatusPush(libraryId: string) {
return apiFetch<{ id: string; status: string }>("/reading-status/push", {
method: "POST",
body: JSON.stringify({ library_id: libraryId }),
});
}
export type ReadingStatusPushReportDto = {
job_id: string;
status: string;
total_series: number;
pushed: number;
skipped: number;
no_books: number;
errors: number;
};
export type ReadingStatusPushResultDto = {
id: string;
series_name: string;
status: "pushed" | "skipped" | "no_books" | "error";
anilist_id: number | null;
anilist_title: string | null;
anilist_url: string | null;
anilist_status: string | null;
progress_volumes: number | null;
error_message: string | null;
};
export async function getReadingStatusPushReport(jobId: string) {
return apiFetch<ReadingStatusPushReportDto>(`/reading-status/push/${jobId}/report`);
}
export async function getReadingStatusPushResults(jobId: string) {
return apiFetch<ReadingStatusPushResultDto[]>(`/reading-status/push/${jobId}/results`);
}
export type RefreshFieldDiff = {
field: string;
old?: unknown;