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>
23 lines
461 B
Python
23 lines
461 B
Python
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,
|
|
)
|
|
)
|