Files
lead-scraper/prisma/schema.prisma
Timo Uttenweiler 54e0d22f9c mein-solar: full feature set
- Schema: companyType, topics, salesScore, salesReason, offerPackage, approved, approvedAt, SearchHistory table
- /api/search-history: GET (by mode) + POST (save query)
- /api/ai-search: stadtwerke/industrie/custom prompts with history dedup
- /api/enrich-leads: website scraping + GPT-4o-mini enrichment (fire-and-forget after each job)
- /api/generate-email: personalized outreach via GPT-4o
- Suche page: 3 mode tabs (Stadtwerke/Industrie/Freie Suche), Alle-Bundesländer queue button, AiSearchModal gets searchMode + history
- Leadspeicher: Bewertung dots column, Paket badge column, Freigeben toggle button, email generator in SidePanel, approved-only export option
- Leads API: approvedOnly + companyType filters, new fields in PATCH

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-08 21:06:07 +02:00

121 lines
2.7 KiB
Plaintext

generator client {
provider = "prisma-client-js"
}
datasource db {
provider = "sqlite"
}
model ApiCredential {
id String @id @default(cuid())
service String @unique
value String
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
}
model Job {
id String @id @default(cuid())
type String
status String @default("pending")
config String @default("{}")
totalLeads Int @default(0)
emailsFound Int @default(0)
error String?
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
results LeadResult[]
}
model LeadResult {
id String @id @default(cuid())
jobId String
job Job @relation(fields: [jobId], references: [id], onDelete: Cascade)
companyName String?
domain String?
contactName String?
contactTitle String?
email String?
confidence Float?
linkedinUrl String?
source String?
createdAt DateTime @default(now())
}
model Lead {
id String @id @default(cuid())
domain String?
companyName String?
contactName String?
contactTitle String?
email String?
linkedinUrl String?
phone String?
address String?
sourceTab String
sourceTerm String?
sourceJobId String?
serpTitle String?
serpSnippet String?
serpRank Int?
serpUrl String?
emailConfidence Float?
status String @default("new")
priority String @default("normal")
notes String?
tags String?
country String?
headcount String?
industry String?
description String?
companyType String?
topics String?
salesScore Int?
salesReason String?
offerPackage String?
approved Boolean @default(false)
approvedAt DateTime?
capturedAt DateTime @default(now())
contactedAt DateTime?
updatedAt DateTime @updatedAt
events LeadEvent[]
@@index([domain])
@@index([status])
@@index([sourceTab])
@@index([capturedAt])
@@index([email])
@@index([approved])
@@index([companyType])
}
model SearchHistory {
id String @id @default(cuid())
query String
region String
searchMode String
executedAt DateTime @default(now())
@@index([searchMode])
@@index([executedAt])
}
model LeadEvent {
id String @id @default(cuid())
leadId String
lead Lead @relation(fields: [leadId], references: [id], onDelete: Cascade)
event String
at DateTime @default(now())
@@index([leadId])
}