dana-medical-site/internal/storage/migrations/0026_crm_deals.sql
Abdulkadyr Karagishiev 121f286016 feat(crm): integrate website leads and online booking with new CRM and 1C
- Add internal/crm client with CanonicalJSON and HMAC-SHA256 signing for POST /api/public/leads
- Add database migration 0026_crm_deals.sql with crm_deal_id and partial indexes
- Add async lead intake dispatch to new CRM in handlers_leads.go
- Support dual-mode booking confirmation (CRM_MODE=both/crm_only/bitrix_only) in booking_confirm.go
- Add LinkCRM endpoint to bridge_1c.py and onec.Client
- Update config and env examples with CRM_API_URL, CRM_LEAD_INTAKE_SECRET, CRM_MODE
2026-10-16 18:01:49 +03:00

18 lines
754 B
SQL
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

-- Интеграция с новой CRM (dana-medccrm).
-- Фиксация сделок по онлайн-записям и заявкам с сайта.
ALTER TABLE onec_appointments
ADD COLUMN crm_deal_id text NOT NULL DEFAULT '',
ADD COLUMN crm_confirm_state text NOT NULL DEFAULT '',
ADD COLUMN crm_error text NOT NULL DEFAULT '',
ADD COLUMN crm_sent_at timestamptz;
CREATE INDEX onec_appointments_crm_idx ON onec_appointments (id) WHERE crm_deal_id = '' AND status = 'booked';
ALTER TABLE leads
ADD COLUMN crm_deal_id text NOT NULL DEFAULT '',
ADD COLUMN crm_error text NOT NULL DEFAULT '',
ADD COLUMN crm_sent_at timestamptz;
CREATE INDEX leads_crm_idx ON leads (id) WHERE crm_deal_id = '';