Add impossible seen dates maintenance endpoint

- Backend: fixImpossibleSeenDates scan/fix in maintenanceService
  detects movies with EntrySeen date before release_date, adds
  them to a "Movies with impossible seen date" collection
- Frontend: ImpossibleSeenDatesSection in SettingsPage with
  Scan and Fix buttons
- Updated API docs (Clients + Reference), cleaned up removed
  migrateSeenWith references
This commit is contained in:
X4Lo committed 2026-06-25 21:38:31 +01:00
1 parent 3df2e2ce3e
commit d984210dd9
8 files changed
+294 -124

No files matched your search

+83
View File
@@ -210,6 +210,76 @@ function WatchStatusesSection() {
);
}
function ImpossibleSeenDatesSection() {
const [scanResult, setScanResult] = useState<{ count: number } | null>(null);
const [fixResult, setFixResult] = useState<{
count: number;
added: number;
} | null>(null);
const scan = useMutation({
mutationFn: maintenanceApi.scanImpossibleSeenDates,
onSuccess: (data) => setScanResult(data),
});
const fix = useMutation({
mutationFn: maintenanceApi.fixImpossibleSeenDates,
onSuccess: (data) => {
setFixResult(data);
setScanResult(null);
},
});
return (
<div className="space-y-2">
<p className="text-xs text-muted-foreground">
Detects movies with a watch date before their official release date and
adds them to a "Movies with impossible seen date" collection.
</p>
<div className="flex items-center gap-2">
<Button
variant="outline"
size="sm"
onClick={() => scan.mutate()}
disabled={scan.isPending}
>
{scan.isPending ? (
<Loader2 className="mr-1.5 h-3.5 w-3.5 animate-spin" />
) : (
<Search className="mr-1.5 h-3.5 w-3.5" />
)}
Scan
</Button>
<Button
variant="outline"
size="sm"
onClick={() => fix.mutate()}
disabled={fix.isPending || (scanResult?.count ?? 0) === 0}
>
{fix.isPending ? (
<Loader2 className="mr-1.5 h-3.5 w-3.5 animate-spin" />
) : (
<Save className="mr-1.5 h-3.5 w-3.5" />
)}
Fix
</Button>
</div>
{scanResult && (
<p className="text-xs text-muted-foreground">
Found {scanResult.count} movie
{scanResult.count !== 1 ? "s" : ""} with impossible seen dates.
</p>
)}
{fixResult && (
<p className="text-xs text-muted-foreground">
{fixResult.added} movie
{fixResult.added !== 1 ? "s" : ""} added to collection.
</p>
)}
</div>
);
}
export function SettingsPage() {
const queryClient = useQueryClient();
const { data: settings, isLoading } = useQuery({
@@ -502,6 +572,19 @@ export function SettingsPage() {
<MissingDirectorsSection />
</CardContent>
</Card>
<Card>
<CardHeader>
<CardTitle>Impossible Seen Dates</CardTitle>
<CardDescription>
Find movies watched before their release date and add them to
a dedicated collection.
</CardDescription>
</CardHeader>
<CardContent>
<ImpossibleSeenDatesSection />
</CardContent>
</Card>
</div>
</TabsContent>
</Tabs>