karl/app/api/v1.py
2025-10-21 17:45:32 +02:00

27 lines
735 B
Python

from fastapi import APIRouter, Depends
from fastapi_utils.cbv import cbv
from starlette.responses import JSONResponse, Response
from app.api.models import Request
from app.core.core import WebhookProcessor
from app.core.injects import AutowireSupport
router = APIRouter()
@router.get("/", summary="Main API")
async def root():
return {"message": "Witaj w API v1"}
@cbv(router)
class APIv1:
webhook_service: WebhookProcessor = Depends(AutowireSupport.webhook_processor)
@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)