fix(scheduling): fire a schedule's capture into its owning organisation

This commit is contained in:
sam committed 2026-10-27 10:03:29 +11:00
1 parent b705019eb8
commit 334bb8cc40
18 files changed
+77 -21

No files matched your search

@@ -522,7 +522,8 @@ const insertCapture = `-- name: InsertCapture :exec
INSERT INTO captures (id, source, remote_addr, content_type, headers, body, authenticated, received_at, unsigned, event_type, delivery, org_id, workspace_id)
SELECT $1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11,
COALESCE(s.org_id, $12::text), COALESCE(s.workspace_id, $13::text)
CASE WHEN $2 = 'schedule' AND $12::text <> '' THEN $12::text ELSE COALESCE(s.org_id, $13::text) END,
COALESCE(s.workspace_id, $14::text)
FROM (SELECT 1) intake LEFT JOIN sources s ON s.path = $2
`
@@ -538,6 +539,7 @@ type InsertCaptureParams struct {
Unsigned bool
EventType string
Delivery string
ScheduleOrg string
DefaultOrg string
DefaultWorkspace string
}
@@ -556,6 +558,7 @@ func (q *Queries) InsertCapture(ctx context.Context, arg InsertCaptureParams) er
arg.Unsigned,
arg.EventType,
arg.Delivery,
arg.ScheduleOrg,
arg.DefaultOrg,
arg.DefaultWorkspace,
)