Initial MVP for QA asset backend
This commit is contained in:
18
hy_qa_asset_backend/backend/app/api/logs.py
Normal file
18
hy_qa_asset_backend/backend/app/api/logs.py
Normal file
@@ -0,0 +1,18 @@
|
||||
from fastapi import APIRouter, Depends
|
||||
from sqlalchemy.orm import Session
|
||||
|
||||
from app import models, schemas
|
||||
from app.database import get_db
|
||||
|
||||
router = APIRouter(prefix="/logs", tags=["logs"])
|
||||
|
||||
|
||||
@router.get("/audit", response_model=list[schemas.AuditLogRead])
|
||||
def audit_logs(db: Session = Depends(get_db)) -> list[models.AuditLog]:
|
||||
return db.query(models.AuditLog).order_by(models.AuditLog.created_at.desc()).limit(200).all()
|
||||
|
||||
|
||||
@router.get("/tasks", response_model=list[schemas.TaskRunRead])
|
||||
def task_logs(db: Session = Depends(get_db)) -> list[models.TaskRun]:
|
||||
return db.query(models.TaskRun).order_by(models.TaskRun.created_at.desc()).limit(200).all()
|
||||
|
||||
Reference in New Issue
Block a user