TorbatYar/backend/services/communication/app/api/v1/webhooks.py
Mortezakoohjani e41ecfad4c Sync platform docs, infra, and module services with Accounting integration.
Include Loyalty/Communication/Sports Center backends and registry updates alongside production nginx and compose wiring.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-25 22:35:23 +03:30

23 lines
701 B
Python

from uuid import UUID
from fastapi import APIRouter, Depends, Header
from app.api.deps import AsyncSession, get_db, require_tenant
from app.schemas.common import WebhookIn, WebhookOut
from app.services.webhook_service import WebhookService
router = APIRouter()
@router.post("/incoming", response_model=WebhookOut, status_code=201)
async def incoming_webhook(
body: WebhookIn,
tenant_id: UUID = Depends(require_tenant),
session: AsyncSession = Depends(get_db),
x_webhook_secret: str | None = Header(default=None),
):
data = body.model_dump()
return await WebhookService(session).receive(
tenant_id, data, webhook_secret=x_webhook_secret
)