22 lines
642 B
Python
22 lines
642 B
Python
from fastapi import APIRouter, Depends
|
|
from fastapi.params import Security
|
|
from sqlalchemy.orm import Session
|
|
|
|
from app.security import get_api_key
|
|
from app.database import get_db
|
|
from app.schemas.transaction import Transaction
|
|
from app.models.transaction import Transaction as DbTransaction
|
|
|
|
router = APIRouter(
|
|
prefix="/transactions",
|
|
tags=["Transaction (v1)"]
|
|
)
|
|
|
|
@router.get(path="", response_model=list[Transaction])
|
|
async def get_transactions(
|
|
skip: int = 0,
|
|
limit: int = 20,
|
|
api_key: str = Security(get_api_key),
|
|
db: Session = Depends(get_db)
|
|
):
|
|
return db.query(DbTransaction).offset(skip).limit(limit).all() |