feat: Enhance transaction model and dashboard with Azure OAuth integration
This commit is contained in:
+20
-5
@@ -13,7 +13,9 @@ from app.service.recon_service import (
|
||||
router = APIRouter(prefix="/api", tags=["Transactions"])
|
||||
|
||||
|
||||
@router.get("/transactions", response_model=list[Transaction], summary="List transactions")
|
||||
@router.get(
|
||||
"/transactions", response_model=list[Transaction], summary="List transactions"
|
||||
)
|
||||
async def list_transactions_endpoint(
|
||||
status: StatusType | None = Query(None, description="Filter by status"),
|
||||
flag: FlagType | None = Query(None, description="Filter by flag"),
|
||||
@@ -21,7 +23,11 @@ async def list_transactions_endpoint(
|
||||
return list_transactions(status=status, flag=flag)
|
||||
|
||||
|
||||
@router.get("/transactions/{transaction_id}", response_model=Transaction, summary="Get a transaction")
|
||||
@router.get(
|
||||
"/transactions/{transaction_id}",
|
||||
response_model=Transaction,
|
||||
summary="Get a transaction",
|
||||
)
|
||||
async def get_transaction_endpoint(transaction_id: str) -> Transaction:
|
||||
transaction = get_transaction_by_id(transaction_id)
|
||||
if transaction is None:
|
||||
@@ -29,15 +35,24 @@ async def get_transaction_endpoint(transaction_id: str) -> Transaction:
|
||||
return transaction
|
||||
|
||||
|
||||
@router.post("/transactions", response_model=Transaction, status_code=201, summary="Submit a transaction")
|
||||
@router.post(
|
||||
"/transactions",
|
||||
response_model=Transaction,
|
||||
status_code=201,
|
||||
summary="Submit a transaction",
|
||||
)
|
||||
async def create_transaction_endpoint(transaction: Transaction) -> Transaction:
|
||||
created = add_transaction(transaction)
|
||||
if not created:
|
||||
raise HTTPException(status_code=409, detail=f"{transaction.transaction_id} already exists")
|
||||
raise HTTPException(
|
||||
status_code=409, detail=f"{transaction.transaction_id} already exists"
|
||||
)
|
||||
return transaction
|
||||
|
||||
|
||||
@router.delete("/transactions/{transaction_id}", status_code=204, summary="Delete a transaction")
|
||||
@router.delete(
|
||||
"/transactions/{transaction_id}", status_code=204, summary="Delete a transaction"
|
||||
)
|
||||
async def delete_transaction_endpoint(transaction_id: str) -> None:
|
||||
removed = delete_transaction_by_id(transaction_id)
|
||||
if not removed:
|
||||
|
||||
Reference in New Issue
Block a user