mirror of
https://github.com/Zproger/Aurum.git
synced 2026-10-13 11:06:40 +07:00
Initial public release
Aurum — a self-hosted personal finance operating system: cash flow, net worth tracking, budgets, goals, recurring payments, reports, proactive alerts, and a compound-interest returns calculator, all bilingual (RU/EN) and mobile-first. Ships as a three-container Docker Compose stack (Postgres + FastAPI + nginx-served React frontend). See README.md for setup and CONTRIBUTING.md for development.
This commit is contained in:
15
backend/app/services/settings_service.py
Normal file
15
backend/app/services/settings_service.py
Normal file
@@ -0,0 +1,15 @@
|
||||
from sqlalchemy.ext.asyncio import AsyncSession
|
||||
|
||||
from app.models.settings import AppSettings
|
||||
|
||||
|
||||
async def get_or_create_app_settings(session: AsyncSession) -> AppSettings:
|
||||
"""Singleton row (id=1) — get-or-create so callers never hit a missing
|
||||
row even if app startup's seeding hasn't run yet (e.g. a fresh test DB)."""
|
||||
settings = await session.get(AppSettings, 1)
|
||||
if settings is None:
|
||||
settings = AppSettings(id=1)
|
||||
session.add(settings)
|
||||
await session.commit()
|
||||
await session.refresh(settings)
|
||||
return settings
|
||||
Reference in New Issue
Block a user