mirror of
https://github.com/Zproger/Aurum.git
synced 2026-10-13 02:56:39 +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:
34
backend/app/api/routes/accounts.py
Normal file
34
backend/app/api/routes/accounts.py
Normal file
@@ -0,0 +1,34 @@
|
||||
from fastapi import APIRouter, Depends
|
||||
from sqlalchemy.ext.asyncio import AsyncSession
|
||||
|
||||
from app.api.deps import get_session
|
||||
from app.schemas.account import AccountCreate, AccountUpdate, AccountWithBalance
|
||||
from app.services.account_service import create_account, delete_account, list_accounts, update_account
|
||||
|
||||
router = APIRouter(prefix="/accounts", tags=["accounts"])
|
||||
|
||||
|
||||
@router.get("", response_model=list[AccountWithBalance])
|
||||
async def read_accounts(
|
||||
include_archived: bool = False, session: AsyncSession = Depends(get_session)
|
||||
) -> list[AccountWithBalance]:
|
||||
return await list_accounts(session, include_archived)
|
||||
|
||||
|
||||
@router.post("", response_model=AccountWithBalance, status_code=201)
|
||||
async def create_account_route(
|
||||
payload: AccountCreate, session: AsyncSession = Depends(get_session)
|
||||
) -> AccountWithBalance:
|
||||
return await create_account(session, payload)
|
||||
|
||||
|
||||
@router.patch("/{account_id}", response_model=AccountWithBalance)
|
||||
async def update_account_route(
|
||||
account_id: int, payload: AccountUpdate, session: AsyncSession = Depends(get_session)
|
||||
) -> AccountWithBalance:
|
||||
return await update_account(session, account_id, payload)
|
||||
|
||||
|
||||
@router.delete("/{account_id}", status_code=204)
|
||||
async def delete_account_route(account_id: int, session: AsyncSession = Depends(get_session)) -> None:
|
||||
await delete_account(session, account_id)
|
||||
Reference in New Issue
Block a user