Skip to content

Commit de9eb00

Browse files
committed
fix: schema mismatches — ingested_at→alert_time, source→source_type, target_host→affected_host, cve_id→cve_ids
1 parent a52b908 commit de9eb00

3 files changed

Lines changed: 7 additions & 7 deletions

File tree

apps/desktop/src/components/dashboard/widgets/AgentActivityWidget.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ export default function AgentActivityWidget(_props: WidgetProps) {
3232
const [intelRes, alertsRes, reportsRes, cveRes] = await Promise.all([
3333
supabase.from("intel_reports").select("created_at", { count: "exact", head: false })
3434
.gte("created_at", oneDayAgo).order("created_at", { ascending: false }).limit(1),
35-
supabase.from("alerts").select("ingested_at", { count: "exact", head: false })
36-
.gte("ingested_at", oneDayAgo).order("ingested_at", { ascending: false }).limit(1),
35+
supabase.from("alerts").select("alert_time", { count: "exact", head: false })
36+
.gte("alert_time", oneDayAgo).order("alert_time", { ascending: false }).limit(1),
3737
supabase.from("reports").select("created_at", { count: "exact", head: false })
3838
.gte("created_at", oneDayAgo).order("created_at", { ascending: false }).limit(1),
3939
supabase.from("cves").select("created_at", { count: "exact", head: false })

apps/desktop/src/services/findings-engine.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -645,7 +645,7 @@ class FindingsEngine {
645645
async getUniqueHosts(): Promise<string[]> {
646646
const { data, error } = await supabase
647647
.from('findings')
648-
.select('target_host')
648+
.select('affected_host')
649649
.order('target_host');
650650

651651
if (error) throw new Error(`Failed to fetch hosts: ${error.message}`);

apps/desktop/src/services/section-agent.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ What other indicators should we look for?`,
205205
206206
Alert: ${a.title}
207207
Severity: ${a.severity}
208-
Time: ${a.ingested_at}
208+
Time: ${a.alert_time}
209209
Description: ${a.description || 'N/A'}
210210
211211
Write a concise escalation message for a security manager. Include: what happened, potential impact, recommended immediate action.`,
@@ -437,7 +437,7 @@ export async function getProactiveContext(path: string): Promise<ProactiveContex
437437
if (path === '/findings') {
438438
const { data, count } = await supabase
439439
.from('findings')
440-
.select('id, title, severity, status, target_host, cve_id', { count: 'exact' })
440+
.select('id, title, severity, status, affected_host, cve_ids', { count: 'exact' })
441441
.eq('status', 'open')
442442
.order('severity', { ascending: true })
443443
.limit(20);
@@ -461,9 +461,9 @@ export async function getProactiveContext(path: string): Promise<ProactiveContex
461461
if (path === '/alert-center') {
462462
const { data, count } = await supabase
463463
.from('alerts')
464-
.select('id, title, severity, source, ingested_at', { count: 'exact' })
464+
.select('id, title, severity, source_type, alert_time', { count: 'exact' })
465465
.in('status', ['new', 'investigating'])
466-
.order('ingested_at', { ascending: false })
466+
.order('alert_time', { ascending: false })
467467
.limit(20);
468468

469469
if (!data || !count) return null;

0 commit comments

Comments
 (0)