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

This commit is contained in:
2026-05-06 12:33:20 +02:00
parent 556ac06413
commit 36abf1bdd4
5 changed files with 134 additions and 9 deletions
+23
View File
@@ -159,6 +159,29 @@ class Repository
return array_map(fn(array $r) => Alert::fromRow($r), $rows);
}
// --- Log Entries ---
public function storeLogEntry(string $line, ?int $sourceId = null, ?string $sourceName = null, ?string $level = null): void
{
$stmt = $this->db->pdo()->prepare(
"INSERT INTO log_entries (line, source_id, source_name, level) VALUES (?, ?, ?, ?)"
);
$stmt->execute([$line, $sourceId, $sourceName, $level]);
}
public function searchLogEntries(string $query, int $limit = 200, int $offset = 0): array
{
$stmt = $this->db->pdo()->prepare(
"SELECT e.* FROM log_entries e
JOIN log_entries_fts fts ON e.id = fts.rowid
WHERE log_entries_fts MATCH ?
ORDER BY rank
LIMIT ? OFFSET ?"
);
$stmt->execute([$query, $limit, $offset]);
return $stmt->fetchAll();
}
// --- Config ---
public function getAllowedUserTokens(): array