Add settings and history archive repository protocols and DI support

This commit is contained in:
2026-04-17 20:54:08 +02:00
parent 7055971163
commit db5b4cb77e
8 changed files with 137 additions and 27 deletions

View File

@@ -208,6 +208,8 @@ The data access layer. Repositories execute raw SQL queries against the applicat
| `geo_cache_repo.py` | Persist and query IP geo resolution cache |
| `import_log_repo.py` | Record import run results (timestamp, source, IPs imported, errors) for the import log view |
Every repository in `app/repositories/` has a corresponding protocol in `app/repositories/protocols.py`, including `settings_repo.py` and `history_archive_repo.py`.
#### Models (`app/models/`)
Pydantic schemas that define data shapes and validation. Models are split into three categories per domain.

View File

@@ -29,6 +29,8 @@ Reference: `Docs/Refactoring.md` for full analysis of each issue.
### 2. Missing Repository Protocols for `settings_repo` and `history_archive_repo`
**Status:** Completed.
**Where:** `backend/app/repositories/protocols.py` defines protocols for 5 of the 7 repositories. The two missing are `settings_repo.py` and `history_archive_repo.py`.
**Goal:** Define `SettingsRepository` and `HistoryArchiveRepository` protocols in `protocols.py` that match the public functions of `settings_repo` (`get_setting`, `set_setting`, `delete_setting`, `get_all_settings`) and `history_archive_repo` (`archive_ban_event`, `get_max_timeofban`, `get_archived_history`). Add corresponding dependency providers in `dependencies.py` and typed aliases so these repositories can be injected the same way as the other five.