APIv1 cbv

This commit is contained in:
Piotr Dec 2025-10-21 17:41:41 +02:00
parent de6184273a
commit 120e929469
Signed by: stawros
GPG key ID: 74B18A3F0F1E99C0
3 changed files with 37 additions and 8 deletions

View file

@ -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)