feat: Kundensuche – Progressbar, SERP-Supplement, Dedup, Löschen, Neu-Filter

- Progressbar geht nie mehr rückwärts (Math.min-Cap entfernt)
- E-Mails-suchen-Phase wird immer kurz angezeigt bevor Fertig
- SERP-Supplement startet automatisch wenn Maps < Zielanzahl liefert
- Suchergebnisse bleiben nach Abschluss sichtbar (kein Redirect)
- Dedup in leadVault strikt nach Domain (verhindert Duplikate)
- isNew-Flag pro Result (Batch-Query gegen bestehende Vault-Domains)
- Nur-neue-Filter + vorhanden-Badge in Suchergebnissen
- Einzeln und Bulk löschen aus Suchergebnissen + Leadspeicher
- Fehlermeldung zeigt echten API-Fehler (z.B. 402 Anymailfinder)
- SERP-Supplement aus /api/search entfernt (LoadingCard übernimmt)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
TimoUttenweiler
2026-04-01 10:25:43 +02:00
parent c232f0cb79
commit aa6707b8bc
7 changed files with 531 additions and 145 deletions

View File

@@ -18,6 +18,21 @@ export async function GET(
});
if (!job) return NextResponse.json({ error: "Job not found" }, { status: 404 });
// Find which domains already existed in vault before this job
const resultDomains = job.results
.map(r => r.domain)
.filter((d): d is string => !!d);
const preExistingDomains = new Set(
(await prisma.lead.findMany({
where: {
domain: { in: resultDomains },
sourceJobId: { not: id },
},
select: { domain: true },
})).map(l => l.domain).filter((d): d is string => !!d)
);
return NextResponse.json({
id: job.id,
type: job.type,
@@ -49,6 +64,7 @@ export async function GET(
address,
phone,
createdAt: r.createdAt,
isNew: !r.domain || !preExistingDomains.has(r.domain),
};
}),
});