-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
cf14cba
commit 63f9bc2
Showing
4 changed files
with
12 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,22 @@ | ||
import logging | ||
|
||
from fastapi import APIRouter, status | ||
from fastapi.exceptions import HTTPException | ||
|
||
from src.app.repositories.report import Report | ||
from src.app.views.input.report import Detection | ||
from src.app.views.response.ok import Ok | ||
|
||
logger = logging.getLogger(__name__) | ||
router = APIRouter(tags=["Report"]) | ||
|
||
|
||
@router.post("/report", status_code=status.HTTP_201_CREATED, response_model=Ok) | ||
async def post_reports(detection: list[Detection]): | ||
async def post_reports(detections: list[Detection]): | ||
report = Report() | ||
data = await report.parse_data(detection) | ||
data = await report.parse_data(detections) | ||
if not data: | ||
logger.debug(detections[0]) | ||
raise HTTPException(status.HTTP_400_BAD_REQUEST, detail="invalid data") | ||
await report.send_to_kafka(data) | ||
return Ok() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.