fix(webhooks): JSONB-Containment statt .any() auf JSON-Spalte — behebt 158 fehlgeschlagene Outbox-Events
This commit is contained in:
@@ -14,7 +14,8 @@ from typing import Any
|
||||
from urllib.parse import urlparse
|
||||
|
||||
import httpx
|
||||
from sqlalchemy import select
|
||||
from sqlalchemy import cast, select
|
||||
from sqlalchemy.dialects.postgresql import JSONB
|
||||
from sqlalchemy.ext.asyncio import AsyncSession
|
||||
|
||||
from app.core.visibility import apply_visibility_filter, check_single_entity_access
|
||||
@@ -74,7 +75,10 @@ async def list_webhooks(
|
||||
Webhook.tenant_id == tenant_id,
|
||||
)
|
||||
if event:
|
||||
stmt = stmt.where(Webhook.events.any(event))
|
||||
# Webhook.events is a JSONB array column (NOT a relationship):
|
||||
# events @> '["<event>"]' — JSONB containment instead of the invalid
|
||||
# relationship .any() call (same fix as webhook_dispatcher).
|
||||
stmt = stmt.where(cast(Webhook.events, JSONB).contains([event]))
|
||||
if user_id and not is_system_admin:
|
||||
stmt = await apply_visibility_filter(
|
||||
db, stmt, "webhook", Webhook, user_id, tenant_id, is_system_admin
|
||||
|
||||
Reference in New Issue
Block a user