00bda54695
Build & Auto-Repair / build (push) Has been cancelled
Lead Scoring:
- lead_scoring_config table with configurable feature weights
- Scoring engine: boolean, keyword, and range-based feature scoring
- Settings tab: configure scoring features, run scoring on all leads
- ml_score + ml_score_details columns on leads table
- API: /api/leads/score, /api/leads/score/config
- mlScore returned in lead detail and list APIs
Email Campaigns:
- email_campaigns, email_campaign_steps, subscribers, logs tables
- Campaign list page with status badges and subscriber counts
- Campaign detail with step management, subscriber search/add, send
- Drip logic: steps with configurable delay days, template variables
- Variable replacement ({{name}}, {{email}}) in email bodies
- Sidebar: Campaigns nav item
22 lines
818 B
TypeScript
22 lines
818 B
TypeScript
import { NextRequest, NextResponse } from "next/server"
|
|
import { getSessionUser } from "@/lib/auth"
|
|
import { query } from "@/lib/db"
|
|
|
|
export async function GET(request: NextRequest, { params }: { params: Promise<{ id: string }> }) {
|
|
try {
|
|
const user = await getSessionUser()
|
|
if (!user) return NextResponse.json({ error: "Unauthorized" }, { status: 401 })
|
|
const { id } = await params
|
|
const result = await query(
|
|
`SELECT l.*, s.contact_name, s.email AS subscriber_email
|
|
FROM email_campaign_logs l
|
|
LEFT JOIN email_campaign_subscribers s ON s.id = l.subscriber_id
|
|
WHERE l.campaign_id = $1 ORDER BY l.sent_at DESC LIMIT 100`,
|
|
[id]
|
|
)
|
|
return NextResponse.json(result.rows)
|
|
} catch (error) {
|
|
return NextResponse.json({ error: "Failed" }, { status: 500 })
|
|
}
|
|
}
|