feat:增加批量插入和查询日志告警功能
This commit is contained in:
BIN
apis/__pycache__/__init__.cpython-310.pyc
Normal file
BIN
apis/__pycache__/__init__.cpython-310.pyc
Normal file
Binary file not shown.
BIN
apis/__pycache__/log.cpython-310.pyc
Normal file
BIN
apis/__pycache__/log.cpython-310.pyc
Normal file
Binary file not shown.
13
apis/log.py
13
apis/log.py
@@ -1,5 +1,7 @@
|
||||
from fastapi import APIRouter
|
||||
from fastapi import APIRouter, Depends
|
||||
from sqlalchemy.orm import Session
|
||||
|
||||
from config.database import get_db
|
||||
from schemas.log_alert import LogAlertTrigger
|
||||
from service import log_alert_service
|
||||
|
||||
@@ -10,6 +12,11 @@ router = APIRouter(
|
||||
)
|
||||
|
||||
|
||||
@router.get("", summary="查询日志告警")
|
||||
def query_alert(db: Session = Depends(get_db)):
|
||||
return log_alert_service.query_alert(db)
|
||||
|
||||
|
||||
@router.post("", summary="触发日志告警")
|
||||
def trigger_log_alter(log_alter: LogAlertTrigger):
|
||||
return log_alert_service.trigger_alert(log_alter)
|
||||
def trigger_log_alter(log_alter: LogAlertTrigger, db: Session = Depends(get_db)) -> bool:
|
||||
return log_alert_service.trigger_alert(log_alter, db)
|
||||
|
||||
Reference in New Issue
Block a user