mirror of
https://github.com/Zproger/Aurum.git
synced 2026-10-12 18:46:40 +07:00
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.
20 lines
686 B
Python
20 lines
686 B
Python
from fastapi import APIRouter, Depends
|
|
from sqlalchemy.ext.asyncio import AsyncSession
|
|
|
|
from app.api.deps import get_session
|
|
from app.schemas.backup import BackupPayload
|
|
from app.services.backup_service import build_backup, restore_backup
|
|
|
|
router = APIRouter(prefix="/backup", tags=["backup"])
|
|
|
|
|
|
@router.get("/export", response_model=BackupPayload)
|
|
async def export_backup(session: AsyncSession = Depends(get_session)) -> BackupPayload:
|
|
return await build_backup(session)
|
|
|
|
|
|
@router.post("/import")
|
|
async def import_backup(payload: BackupPayload, session: AsyncSession = Depends(get_session)) -> dict[str, str]:
|
|
await restore_backup(session, payload)
|
|
return {"status": "ok"}
|