feat: 接入mysql数据库
This commit is contained in:
18
routers/report.py
Normal file
18
routers/report.py
Normal file
@@ -0,0 +1,18 @@
|
||||
from fastapi import APIRouter, Depends
|
||||
from sqlalchemy.orm import Session
|
||||
|
||||
from config.database import get_db
|
||||
from schema.report import ReportRequest
|
||||
from service import report_service
|
||||
|
||||
router = APIRouter(prefix="/report", tags=["Report"])
|
||||
|
||||
|
||||
@router.get("/{id}")
|
||||
def query_report(id: int, db: Session = Depends(get_db)):
|
||||
return report_service.query_report(id, db)
|
||||
|
||||
|
||||
@router.post("")
|
||||
def upload_report(req: ReportRequest, db: Session = Depends(get_db)):
|
||||
return report_service.upload_report(req.content, db)
|
||||
Reference in New Issue
Block a user