o2o-infinith-demo/supabase/functions/generate-report
Haewon Kam 7fe3ff82c9 feat: DB V3 dual-write — clinics + analysis_runs + channel_snapshots
Phase 2-4 of SaaS schema migration. All Edge Functions now write to
BOTH legacy marketing_reports AND new V3 tables:

discover-channels:
  - UPSERT clinics (url-based dedup)
  - INSERT analysis_runs (status: discovering)

collect-channel-data:
  - INSERT channel_snapshots (one per channel — time-series!)
  - INSERT screenshots (evidence rows)
  - UPDATE analysis_runs (raw_channel_data, vision_analysis)

generate-report:
  - UPDATE analysis_runs (report, status: complete)
  - UPDATE clinics (last_analyzed_at, established_year)

Frontend passes clinicId + runId through all 3 phases.
Legacy marketing_reports still written for backward compatibility.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-05 00:51:11 +09:00
..
.npmrc feat: real API integration + YouTube Data API v3 + progressive loading 2026-04-02 10:57:14 +09:00
deno.json feat: real API integration + YouTube Data API v3 + progressive loading 2026-04-02 10:57:14 +09:00
index.ts feat: DB V3 dual-write — clinics + analysis_runs + channel_snapshots 2026-04-05 00:51:11 +09:00