Adding ledger module
This commit is contained in:
17
api/app/ledger/routes.py
Normal file
17
api/app/ledger/routes.py
Normal file
@@ -0,0 +1,17 @@
|
||||
from uuid import UUID
|
||||
|
||||
from fastapi import APIRouter, Depends
|
||||
|
||||
from db import SessionDep
|
||||
from ledger.schema import TransactionLedgerRead
|
||||
from transaction.resource import TransactionResource
|
||||
from user.manager import get_current_user
|
||||
|
||||
router = APIRouter()
|
||||
|
||||
@router.get("/{account_id}")
|
||||
def read_ledger(account_id: UUID, session: SessionDep, current_user=Depends(get_current_user)) -> list[TransactionLedgerRead]:
|
||||
response = []
|
||||
for transaction, split in TransactionResource.get_ledger(session, account_id):
|
||||
response.append(TransactionLedgerRead(transaction=transaction, account_split=split))
|
||||
return response
|
||||
Reference in New Issue
Block a user