feat: add crm webhook worker

This commit is contained in:
Codex
2026-06-29 04:35:19 +08:00
parent 0cff0d102d
commit ead1296f80
23 changed files with 1098 additions and 14 deletions

View File

@@ -309,6 +309,7 @@ async function main() {
where tenant_id = $1
and (
record_id in ($2::text, $3::text, $4::text, $5::text)
or idempotency_key = 'lead:worker-integration'
or lead_id in (
select id::text
from public.referral_leads
@@ -320,6 +321,18 @@ async function main() {
[tenantId, ids.user, ids.tenantOperatorUser, ids.tenantSalesUser, ids.tenantAgentUser],
);
await client.query(
`
delete from public.crm_webhook_log
where tenant_id = $1
and (
record_id in ($2::text, $3::text, $4::text, $5::text)
or response_summary like '%worker%'
)
`,
[tenantId, ids.user, ids.tenantOperatorUser, ids.tenantSalesUser, ids.tenantAgentUser],
);
await client.query(
`
with transient_users as (