Move history archive max timestamp query into repository

This commit is contained in:
2026-04-15 21:18:44 +02:00
parent cdb0c3681e
commit 56f03f39c7
4 changed files with 38 additions and 7 deletions

View File

@@ -36,6 +36,15 @@ async def archive_ban_event(
return inserted
async def get_max_timeofban(db: aiosqlite.Connection) -> int | None:
"""Return the latest archived ban timestamp or ``None`` when empty."""
async with db.execute("SELECT MAX(timeofban) FROM history_archive") as cursor:
row = await cursor.fetchone()
if row is None or row[0] is None:
return None
return int(row[0])
async def get_archived_history(
db: aiosqlite.Connection,
since: int | None = None,