APIv1 cbv
This commit is contained in:
parent
de6184273a
commit
120e929469
3 changed files with 37 additions and 8 deletions
|
|
@ -1,6 +1,10 @@
|
|||
from fastapi import APIRouter
|
||||
from fastapi import APIRouter, Depends
|
||||
from fastapi_utils.cbv import cbv
|
||||
from starlette.responses import JSONResponse, Response
|
||||
|
||||
from app.api.models import Request, Response
|
||||
from app.api.models import Request
|
||||
from app.core.core import WebhookProcessor
|
||||
from app.core.injects import AutowireSupport
|
||||
|
||||
router = APIRouter()
|
||||
|
||||
|
|
@ -10,10 +14,14 @@ async def root():
|
|||
return {"message": "Witaj w API v1"}
|
||||
|
||||
|
||||
@router.get("/health", summary="Health check")
|
||||
async def health():
|
||||
return {"status": "ok"}
|
||||
@cbv(router)
|
||||
class APIv1:
|
||||
webhook_service: WebhookProcessor = Depends(AutowireSupport.webhook_processor)
|
||||
|
||||
@router.post("/ci", summary="CI Webhook")
|
||||
async def ci(request: Request):
|
||||
return Response(200)
|
||||
@router.get("/health", summary="Health check")
|
||||
async def health(self) -> JSONResponse:
|
||||
return JSONResponse({"status": "ok"})
|
||||
|
||||
@router.post("/ci", summary="CI Webhook")
|
||||
async def ci(self, request: Request):
|
||||
return Response(status_code=201)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue