Add admin config and audit log

Bearer-token-gated admin endpoints to read/update the DB-backed
operational config (fee_address, bet_amount_sats) without a redeploy,
plus a lightweight audit log writer for round/payout/config events.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
2026-07-21 10:26:31 +02:00
co-authored by Claude Sonnet 5
parent 8380b80d12
commit 01331c1e4c
4 changed files with 130 additions and 0 deletions
+22
View File
@@ -0,0 +1,22 @@
import json
from sqlalchemy.ext.asyncio import AsyncSession
from app.db.models import AuditLog
async def write_audit_log(
session: AsyncSession,
event_type: str,
payload: dict,
user_id: int | None = None,
round_id: int | None = None,
) -> None:
session.add(
AuditLog(
event_type=event_type,
payload_json=json.dumps(payload),
user_id=user_id,
round_id=round_id,
)
)