Full-stack Next.js 16 app with three scraping pipelines: - AirScale CSV → Anymailfinder Bulk Decision Maker search - LinkedIn Sales Navigator → Vayne → Anymailfinder email enrichment - Apify Google SERP → domain extraction → Anymailfinder bulk enrichment Includes Docker multi-stage build + docker-compose for Coolify deployment. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
48 lines
1.3 KiB
TypeScript
48 lines
1.3 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 => ({
|
|
id: r.id,
|
|
companyName: r.companyName,
|
|
domain: r.domain,
|
|
contactName: r.contactName,
|
|
contactTitle: r.contactTitle,
|
|
email: r.email,
|
|
confidence: r.confidence,
|
|
linkedinUrl: r.linkedinUrl,
|
|
createdAt: r.createdAt,
|
|
})),
|
|
});
|
|
} catch (err) {
|
|
console.error("GET /api/jobs/[id]/status error:", err);
|
|
return NextResponse.json({ error: "Failed" }, { status: 500 });
|
|
}
|
|
}
|