ceo-api/drizzle/0002_burly_nightcrawler.sql
valentinbvro 0f8390f31b feat: Faza A2 -- intelligence proxy, saved segments, research briefs, briefing
- IntelligenceModule: proxy tenant-scoped catre intelligence-api
  (/companies/search, /companies/{id}); ceo-web nu vorbeste niciodata
  direct cu intelligence-api (blueprint 10.3/16).
- SavedSegments: salveaza o cautare Apollo si o ruleaza din nou oricand.
- ResearchBriefs: dovezi curatate manual per companie, cu sursa Apollo
  implicita plus surse suplimentare -- explicit fara rezumat generat de
  AI (AI Gateway inca neconstruit, blueprint 14).
- BriefingService: /v1/briefing/today, agregare deterministica de
  taskuri restante/viitoare + activitate saptamanala; campul
  aiExplanation ramane null si vizibil in raspuns, nu simulat.
2026-07-28 22:01:17 +02:00

22 lines
764 B
SQL

CREATE TABLE IF NOT EXISTS "research_briefs" (
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
"tenant_id" uuid NOT NULL,
"created_by_user_id" uuid NOT NULL,
"organization_id" text NOT NULL,
"organization_name" text,
"title" text NOT NULL,
"summary" text NOT NULL,
"sources" jsonb DEFAULT '[]'::jsonb NOT NULL,
"created_at" timestamp DEFAULT now() NOT NULL,
"updated_at" timestamp DEFAULT now() NOT NULL
);
--> statement-breakpoint
CREATE TABLE IF NOT EXISTS "saved_segments" (
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
"tenant_id" uuid NOT NULL,
"created_by_user_id" uuid NOT NULL,
"name" text NOT NULL,
"query" text NOT NULL,
"result_limit" integer DEFAULT 20 NOT NULL,
"created_at" timestamp DEFAULT now() NOT NULL
);