2026-07-21 10:26:18 +02:00
|
|
|
from sqlalchemy import select
|
|
|
|
|
from sqlalchemy.ext.asyncio import AsyncSession
|
|
|
|
|
|
|
|
|
|
from app.db.models import RoundConfig
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async def get_round_config(session: AsyncSession) -> RoundConfig:
|
2026-07-21 15:05:40 +02:00
|
|
|
"""Single-row operational config, lazily created on first use with the
|
|
|
|
|
column defaults declared on RoundConfig itself (app/db/models.py) — no env
|
|
|
|
|
var involved. fee_address starts empty until an operator sets it via the
|
|
|
|
|
admin panel/API — payouts must refuse to run until it's set."""
|
2026-07-21 10:26:18 +02:00
|
|
|
config = await session.scalar(select(RoundConfig))
|
|
|
|
|
if config is None:
|
2026-07-21 15:05:40 +02:00
|
|
|
config = RoundConfig(fee_address="")
|
2026-07-21 10:26:18 +02:00
|
|
|
session.add(config)
|
|
|
|
|
await session.flush()
|
|
|
|
|
return config
|