Spaces:
Build error
Build error
Hkoradiya123
feat: Initialize frontend with Zustand for state management, Tailwind CSS for styling, and TypeScript for type safety
4854e2b Download backend/app/api/webhook_routes.py from jinksQspider/fmproService: direct link, hf CLI and curl.
- Browser
- Download file 1.77 kB
-
https://huggingface.co/spaces/jinksQspider/fmproService/resolve/main/backend/app/api/webhook_routes.py
- Command line
-
hf download hf://spaces/jinksQspider/fmproService/backend/app/api/webhook_routes.py
-
curl -L -o webhook_routes.py https://huggingface.co/spaces/jinksQspider/fmproService/resolve/main/backend/app/api/webhook_routes.py
1.77 kB
| """Webhook management routes""" | |
| from uuid import UUID | |
| from fastapi import APIRouter, Depends, HTTPException, Query, status, Request | |
| from sqlalchemy.orm import Session | |
| from app.core.database import get_db | |
| from app.core.security import get_current_tenant_id | |
| from app.core.rate_limit import limiter, RATE_LIMIT_VALUE | |
| from app.schemas import WebhookCreateRequest, WebhookResponse | |
| from app.services.webhook_service import WebhookService | |
| router = APIRouter(prefix="/api/webhooks", tags=["webhooks"]) | |
| async def create_webhook( | |
| request: Request, | |
| payload: WebhookCreateRequest, | |
| tenant_id: str = Depends(get_current_tenant_id), | |
| db: Session = Depends(get_db), | |
| ): | |
| try: | |
| endpoint = WebhookService.create_endpoint(db, UUID(tenant_id), payload.url, payload.secret) | |
| return endpoint | |
| except Exception as exc: | |
| raise HTTPException(status_code=status.HTTP_400_BAD_REQUEST, detail=str(exc)) | |
| async def list_webhooks( | |
| request: Request, | |
| tenant_id: str = Depends(get_current_tenant_id), | |
| db: Session = Depends(get_db), | |
| ): | |
| return WebhookService.list_endpoints(db, UUID(tenant_id)) | |
| async def delete_webhook( | |
| request: Request, | |
| endpoint_id: str, | |
| tenant_id: str = Depends(get_current_tenant_id), | |
| db: Session = Depends(get_db), | |
| ): | |
| try: | |
| WebhookService.delete_endpoint(db, UUID(tenant_id), UUID(endpoint_id)) | |
| return {"message": "Webhook deleted"} | |
| except ValueError as exc: | |
| raise HTTPException(status_code=status.HTTP_404_NOT_FOUND, detail=str(exc)) | |