feat(seo-tracking): implement closed-loop performance tracking, admin panel and CEO directive gate

This commit is contained in:
Canina Automation committed 2026-10-28 06:31:49 +00:00
1 parent 00ba4360cf
commit 13f4fdc58d
12 files changed
+1072

No files matched your search

+65
View File
@@ -219,6 +219,7 @@ model Blog {
category BlogCategory? @relation(fields: [categoryId], references: [id], onDelete: SetNull)
tags BlogTag[]
comments BlogComment[]
researchFinding ContentResearchFinding?
@@index([categoryId])
@@index([status])
@@ -1020,3 +1021,67 @@ model SmsCampaign {
@@map("sms_campaigns")
}
// ------------------------------------------------------------------------------
// 5. SEO & Performance Tracking Models
// ------------------------------------------------------------------------------
enum ResearchFindingStatus {
RESEARCHED
ACTIONED
EVALUATING
SCALED
PRUNED
}
model ContentResearchFinding {
id String @id @default(uuid()) @db.Uuid
title String @db.VarChar(255)
hypothesis String @db.Text
targetKeywords String[] @map("target_keywords")
primaryKeyword String @map("primary_keyword") @db.VarChar(128)
expectedOutcome String @map("expected_outcome") @db.Text
status ResearchFindingStatus @default(RESEARCHED)
blogId String? @unique @map("blog_id") @db.Uuid
blog Blog? @relation(fields: [blogId], references: [id], onDelete: SetNull)
ceoFeedback String? @map("ceo_feedback") @db.Text
feedbackSubmittedAt DateTime? @map("feedback_submitted_at") @db.Timestamptz()
snapshots ContentPerformanceSnapshot[]
createdAt DateTime @default(now()) @map("created_at") @db.Timestamptz()
updatedAt DateTime @updatedAt @map("updated_at") @db.Timestamptz()
@@index([status])
@@index([primaryKeyword])
@@map("content_research_findings")
}
model ContentPerformanceSnapshot {
id String @id @default(uuid()) @db.Uuid
findingId String @map("finding_id") @db.Uuid
finding ContentResearchFinding @relation(fields: [findingId], references: [id], onDelete: Cascade)
snapshotDate DateTime @default(now()) @map("snapshot_date") @db.Timestamptz()
gscImpressions Int @default(0) @map("gsc_impressions")
gscClicks Int @default(0) @map("gsc_clicks")
gscPosition Float @default(0.0) @map("gsc_position")
ga4ActiveUsers Int @default(0) @map("ga4_active_users")
ga4AvgEngagementSec Float @default(0.0) @map("ga4_avg_engagement_sec")
ga4BounceRate Float @default(0.0) @map("ga4_bounce_rate")
ga4ScrollDepthRate Float @default(0.0) @map("ga4_scroll_depth_rate")
attributedOrdersCount Int @default(0) @map("attributed_orders_count")
attributedSalesValue Decimal @default(0) @map("attributed_sales_value") @db.Decimal(15, 2)
actionRecommendation String? @map("action_recommendation") @db.VarChar(64)
analysisNotes String? @map("analysis_notes") @db.Text
createdAt DateTime @default(now()) @map("created_at") @db.Timestamptz()
@@index([findingId, snapshotDate])
@@map("content_performance_snapshots")
}