Add 17 features: My Work view, card copy/numbering, calendar, bulk ops, custom fields, automations, webhooks, invites, import/export, and more
Features implemented across 6 batches: - Batch A: Fix ColorPicker gradient sync, tenant custom logo, unarchive cards, board backgrounds - Batch B: My Work view, card copy/duplicate, card numbering (BOARD-123) - Batch C: Due date reminders (cron), card watching with notifications - Batch D: Bulk card operations, column sorting, calendar view - Batch E: Invite by link, board import/export (Pounce + Trello JSON) - Batch F: Webhooks with HMAC signing, custom fields, automation rules engine Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
import { prisma } from './db.js';
|
||||
import crypto from 'crypto';
|
||||
|
||||
export async function dispatchWebhooks(tenantId: string, event: string, data: any) {
|
||||
// Don't await this - fire and forget
|
||||
doDispatch(tenantId, event, data).catch(() => {});
|
||||
}
|
||||
|
||||
async function doDispatch(tenantId: string, event: string, data: any) {
|
||||
const webhooks = await prisma.webhook.findMany({
|
||||
where: { tenantId, active: true, events: { has: event } }
|
||||
});
|
||||
|
||||
const payload = JSON.stringify({ event, data, timestamp: new Date().toISOString() });
|
||||
|
||||
for (const webhook of webhooks) {
|
||||
const signature = crypto.createHmac('sha256', webhook.secret).update(payload).digest('hex');
|
||||
|
||||
fetch(webhook.url, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'X-Pounce-Signature': signature,
|
||||
'X-Pounce-Event': event
|
||||
},
|
||||
body: payload
|
||||
}).catch(() => {});
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user