Mappings & processing WIP
This commit is contained in:
parent
120e929469
commit
1d7c4c2dfd
4 changed files with 11 additions and 3 deletions
|
|
@ -1,3 +1,4 @@
|
|||
from automapper import mapper
|
||||
from fastapi import APIRouter, Depends
|
||||
from fastapi_utils.cbv import cbv
|
||||
from starlette.responses import JSONResponse, Response
|
||||
|
|
@ -5,6 +6,7 @@ from starlette.responses import JSONResponse, Response
|
|||
from app.api.models import Request
|
||||
from app.core.core import WebhookProcessor
|
||||
from app.core.injects import AutowireSupport
|
||||
from app.model.webhook import WebhookEvent
|
||||
|
||||
router = APIRouter()
|
||||
|
||||
|
|
@ -20,8 +22,9 @@ class APIv1:
|
|||
|
||||
@router.get("/health", summary="Health check")
|
||||
async def health(self) -> JSONResponse:
|
||||
return JSONResponse({"status": "ok"})
|
||||
return JSONResponse({"status": self.webhook_service.health})
|
||||
|
||||
@router.post("/ci", summary="CI Webhook")
|
||||
async def ci(self, request: Request):
|
||||
self.webhook_service.process_ci_event(mapper.to(WebhookEvent).map(request))
|
||||
return Response(status_code=201)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue