adding editing
Deploy / deploy (push) Successful in 8s

This commit is contained in:
2026-05-06 18:23:36 +02:00
parent 3d3895e47b
commit 08df9bfe5c
3 changed files with 74 additions and 12 deletions
+9
View File
@@ -82,6 +82,15 @@ class Repository
$this->db->pdo()->prepare("DELETE FROM rules WHERE id = ?")->execute([$id]);
}
public function updateRule(int $id, string $name, string $pattern, string $severity, ?int $rateLimitSeconds = null, bool $active = true): Rule
{
$stmt = $this->db->pdo()->prepare(
"UPDATE rules SET name = ?, pattern = ?, severity = ?, rate_limit_seconds = ?, active = ? WHERE id = ?"
);
$stmt->execute([$name, $pattern, $severity, $rateLimitSeconds, (int) $active, $id]);
return $this->getRule($id);
}
// --- Alerts ---
public function createAlert(int $ruleId, string $ruleName, string $severity, string $message, string $rawLine, ?int $sourceId = null, ?string $sourceName = null): Alert