Files
chorus-services/modules/dashboard/lib/db.ts
tony 2e1bb2e55e Major update to chorus.services platform
- Extensive updates to system configuration and deployment
- Enhanced documentation and architecture improvements
- Updated dependencies and build configurations
- Improved service integrations and workflows

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-17 22:01:07 +10:00

40 lines
998 B
TypeScript

import { Pool } from 'pg'
const pool = new Pool({
host: process.env.POSTGRES_HOST || 'chorus-db',
port: parseInt(process.env.POSTGRES_PORT || '5432'),
database: process.env.POSTGRES_DB || 'chorus_teaser',
user: process.env.POSTGRES_USER || 'chorus_admin',
password: process.env.POSTGRES_PASSWORD || 'chorus_secure_password_123',
})
export { pool }
export interface Lead {
id: number
first_name: string
last_name: string
email: string
company_name?: string
company_role?: string
lead_source: string
inquiry_details?: string
custom_message?: string
ip_address: string
user_agent?: string
country_code?: string
gdpr_consent_given: boolean
gdpr_consent_date?: Date
marketing_consent: boolean
created_at: Date
updated_at: Date
}
export interface LeadStats {
total_leads: number
leads_today: number
leads_this_week: number
leads_this_month: number
by_source: { lead_source: string; count: number }[]
by_date: { date: string; count: number }[]
}