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:
@@ -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,
|
||||
)
|
||||
)
|
||||
Reference in New Issue
Block a user