36 lines
1.1 KiB
Python
36 lines
1.1 KiB
Python
|
|
from fastapi import APIRouter, FastAPI, Request
|
||
|
|
|
||
|
|
from app.services import crash_api_service
|
||
|
|
|
||
|
|
|
||
|
|
router = APIRouter()
|
||
|
|
|
||
|
|
|
||
|
|
def register_exception_handlers(app: FastAPI):
|
||
|
|
app.add_exception_handler(crash_api_service.CrashApiException, crash_api_service.crash_api_exception_handler)
|
||
|
|
|
||
|
|
|
||
|
|
@router.get("/api/v1/health")
|
||
|
|
def crash_health():
|
||
|
|
return crash_api_service.health_payload()
|
||
|
|
|
||
|
|
|
||
|
|
@router.post("/api/v1/crash-reports")
|
||
|
|
async def create_crash_report(request: Request):
|
||
|
|
return await crash_api_service.create_crash_report(request)
|
||
|
|
|
||
|
|
|
||
|
|
@router.get("/api/v1/crash-reports/{report_id}")
|
||
|
|
def get_crash_report(report_id: str, request: Request):
|
||
|
|
return crash_api_service.get_crash_report_detail(report_id, request)
|
||
|
|
|
||
|
|
|
||
|
|
@router.get("/api/v1/crash-reports/{report_id}/files/{file_name}")
|
||
|
|
def download_crash_report_file(report_id: str, file_name: str, request: Request):
|
||
|
|
return crash_api_service.download_crash_report_file(report_id, file_name, request)
|
||
|
|
|
||
|
|
|
||
|
|
@router.post("/api/v1/symbols")
|
||
|
|
async def upload_symbols(request: Request):
|
||
|
|
return await crash_api_service.upload_symbols(request)
|