- Rename LeadVault → Leadspeicher throughout (sidebar, topbar, page) - SidePanel: full lead detail view with contact, source, tags (read-only), Google Maps link for address - Tags: kontaktiert stored as tag (toggleable), favorit tag toggle - Remove Status column, StatusBadge dropdown, Priority feature - Remove Aktualisieren button from Leadspeicher - Bulk actions: remove status dropdown - Export: LeadVault Excel-only, clean columns, freeze row + autofilter - Export dropdown: click-based (fix overflow-hidden clipping) - ExportButtons: remove CSV, Excel only everywhere - Maps page: post-search Anymailfinder enrichment button - ProgressCard: "Suche läuft..." instead of "Warte auf Anymailfinder-Server..." - Quick SERP renamed to "Schnell neue Suche" - Results page: Excel export, always-enabled download button - Anymailfinder: fix bulk field names, array-of-arrays format - Apify: fix countryCode lowercase - API: sourceTerm search, contacted/favorite tag filters Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
60 lines
1.6 KiB
TypeScript
60 lines
1.6 KiB
TypeScript
import { NextRequest, NextResponse } from "next/server";
|
|
import { prisma } from "@/lib/db";
|
|
|
|
export async function GET(
|
|
_req: NextRequest,
|
|
{ params }: { params: Promise<{ id: string }> }
|
|
) {
|
|
try {
|
|
const { id } = await params;
|
|
const job = await prisma.job.findUnique({
|
|
where: { id },
|
|
include: {
|
|
results: {
|
|
orderBy: { createdAt: "desc" },
|
|
take: 200,
|
|
},
|
|
},
|
|
});
|
|
if (!job) return NextResponse.json({ error: "Job not found" }, { status: 404 });
|
|
|
|
return NextResponse.json({
|
|
id: job.id,
|
|
type: job.type,
|
|
status: job.status,
|
|
config: JSON.parse(job.config),
|
|
totalLeads: job.totalLeads,
|
|
emailsFound: job.emailsFound,
|
|
error: job.error,
|
|
createdAt: job.createdAt,
|
|
updatedAt: job.updatedAt,
|
|
results: job.results.map(r => {
|
|
let address: string | null = null;
|
|
let phone: string | null = null;
|
|
if (r.source) {
|
|
try {
|
|
const src = JSON.parse(r.source) as { address?: string; phone?: string };
|
|
address = src.address ?? null;
|
|
phone = src.phone ?? null;
|
|
} catch { /* ignore */ }
|
|
}
|
|
return {
|
|
id: r.id,
|
|
companyName: r.companyName,
|
|
domain: r.domain,
|
|
contactName: r.contactName,
|
|
contactTitle: r.contactTitle,
|
|
email: r.email,
|
|
linkedinUrl: r.linkedinUrl,
|
|
address,
|
|
phone,
|
|
createdAt: r.createdAt,
|
|
};
|
|
}),
|
|
});
|
|
} catch (err) {
|
|
console.error("GET /api/jobs/[id]/status error:", err);
|
|
return NextResponse.json({ error: "Failed" }, { status: 500 });
|
|
}
|
|
}
|