diff --git a/server/storage.ts b/server/storage.ts index 45b028b..d9fc94b 100644 --- a/server/storage.ts +++ b/server/storage.ts @@ -160,8 +160,9 @@ export class DatabaseStorage implements IStorage { conditions.push(eq(detections.anomalyType, anomalyType)); } + // Cast riskScore to numeric for proper comparison (stored as text in DB) if (minScore !== undefined) { - conditions.push(gte(detections.riskScore, minScore.toString())); + conditions.push(sql`${detections.riskScore}::numeric >= ${minScore}`); } if (maxScore !== undefined) {