Mark task 19 done and centralize map-color thresholds in settings_service

This commit is contained in:
2026-04-17 17:04:09 +02:00
parent 7a1cb0c46c
commit 4754f1407e
4 changed files with 76 additions and 103 deletions

View File

@@ -15,12 +15,6 @@ import structlog
from app.db import init_db, open_db
from app.repositories import settings_repo
from app.services.settings_service import (
get_map_color_thresholds as util_get_map_color_thresholds,
)
from app.services.settings_service import (
set_map_color_thresholds as util_set_map_color_thresholds,
)
from app.utils.async_utils import run_blocking
if TYPE_CHECKING:
@@ -195,30 +189,3 @@ async def get_timezone(db: aiosqlite.Connection) -> str:
return tz if tz else "UTC"
async def get_map_color_thresholds(
db: aiosqlite.Connection,
) -> tuple[int, int, int]:
"""Return the configured map color thresholds (high, medium, low)."""
return await util_get_map_color_thresholds(db)
async def set_map_color_thresholds(
db: aiosqlite.Connection,
*,
threshold_high: int,
threshold_medium: int,
threshold_low: int,
) -> None:
"""Update the map color threshold configuration."""
await util_set_map_color_thresholds(
db,
threshold_high=threshold_high,
threshold_medium=threshold_medium,
threshold_low=threshold_low,
)
log.info(
"map_color_thresholds_updated",
high=threshold_high,
medium=threshold_medium,
low=threshold_low,
)