From fa177a982fe42af3dd6bef0fbfe98d7731b46ddd Mon Sep 17 00:00:00 2001 From: Timo Uttenweiler Date: Fri, 20 Mar 2026 17:49:29 +0100 Subject: [PATCH] feat: Adresse & Telefon in LeadVault Tabelle + Side Panel MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Lead-Modell: address Feld hinzugefügt (Migration) - Maps-Sync: address + phone aus source JSON extrahiert - LeadVault Tabelle: Telefon/Adresse als kombinierte Spalte - LeadVault Side Panel: Adresse mit Pin-Icon - Telefonnummer ist klickbar (tel: Link) Co-Authored-By: Claude Sonnet 4.6 --- app/api/jobs/maps-enrich/route.ts | 25 +++++++++++-------- app/leadvault/page.tsx | 25 ++++++++++++++++++- lib/services/leadVault.ts | 3 +++ .../migration.sql | 2 ++ prisma/schema.prisma | 1 + 5 files changed, 45 insertions(+), 11 deletions(-) create mode 100644 prisma/migrations/20260320164731_add_address_to_lead/migration.sql diff --git a/app/api/jobs/maps-enrich/route.ts b/app/api/jobs/maps-enrich/route.ts index 3cd5c57..49d4877 100644 --- a/app/api/jobs/maps-enrich/route.ts +++ b/app/api/jobs/maps-enrich/route.ts @@ -152,16 +152,21 @@ async function runMapsEnrich( // Sync to LeadVault const finalResults = await prisma.leadResult.findMany({ where: { jobId } }); await sinkLeadsToVault( - finalResults.map(r => ({ - domain: r.domain, - companyName: r.companyName, - contactName: r.contactName, - contactTitle: r.contactTitle, - email: r.email, - linkedinUrl: r.linkedinUrl, - emailConfidence: r.confidence, - phone: (() => { try { return JSON.parse(r.source || "{}").phone ?? null; } catch { return null; } })(), - })), + finalResults.map(r => { + let src: { phone?: string; address?: string } = {}; + try { src = JSON.parse(r.source || "{}"); } catch { /* ignore */ } + return { + domain: r.domain, + companyName: r.companyName, + contactName: r.contactName, + contactTitle: r.contactTitle, + email: r.email, + linkedinUrl: r.linkedinUrl, + emailConfidence: r.confidence, + phone: src.phone || null, + address: src.address || null, + }; + }), "maps", params.queries.join(", "), jobId, diff --git a/app/leadvault/page.tsx b/app/leadvault/page.tsx index bf22a06..87e9386 100644 --- a/app/leadvault/page.tsx +++ b/app/leadvault/page.tsx @@ -23,6 +23,7 @@ interface Lead { email: string | null; linkedinUrl: string | null; phone: string | null; + address: string | null; sourceTab: string; sourceTerm: string | null; sourceJobId: string | null; @@ -264,7 +265,13 @@ function SidePanel({ lead, onClose, onUpdate }: { {fullLead.phone && (
- {fullLead.phone} + {fullLead.phone} +
+ )} + {fullLead.address && ( +
+ 📍 + {fullLead.address}
)} {fullLead.linkedinUrl && ( @@ -794,6 +801,7 @@ export default function LeadVaultPage() { ["priority", "Priorität"], ["companyName", "Unternehmen"], ["contactName", "Kontakt"], + ["phone", "Telefon"], ["email", "E-Mail"], ["sourceTab", "Quelle"], ["capturedAt", "Erfasst"], @@ -868,6 +876,21 @@ export default function LeadVaultPage() {

{lead.contactName || "–"}

{lead.contactTitle &&

{lead.contactTitle}

} + + {lead.phone ? ( + e.stopPropagation()} + className="text-xs text-gray-300 hover:text-white whitespace-nowrap"> + {lead.phone} + + ) : lead.address ? ( +

{lead.address}

+ ) : ( + + )} + {lead.phone && lead.address && ( +

{lead.address}

+ )} + e.stopPropagation()}> {lead.email ? (