Booking status base#12
Conversation
…#8884) * test: booking rejection * test: check if webhook is called * feat: BOOKING_REJECTED enum ,constant in backend * feat: send booking rejected webhook to subscribers * feat: add Booking rejected migration * calendar event * Revert "calendar event" This reverts commit 28d45dccfdd3788f0124f9be8783161b1156cd09. * feat: BOOKING_REQUESTED enum, constant, migration * feat: Send BOOKING REQUESTED Webhook call * feat: Add booking rejected/requested event in form * feat: data-testid to rejection confirm btn * test: BOOKING_REJECTED, BOOKING_REQUESTED * fix: booking status PENDING, Linting * feat: add new labels to common.json * remove: meeting ended hook from request hook * refactor: abstract handleWebhookTrigger * fix: create a single file for migration * refactor: reduce code repetition and fix test * feat: add team webhooks to subscriberOptions * refactor: subscriberOptions --------- Co-authored-by: Joe Au-Yeung <65426560+joeauyeung@users.noreply.github.com> Co-authored-by: Peer Richelsen <peeroke@gmail.com> Co-authored-by: Alex van Andel <me@alexvanandel.com>
feat: Add new events to webhook BOOKING_CONFIRMED, BOOKING_REJECTED (…
|
Caution Review failedThe pull request is closed. WalkthroughThis PR introduces support for two new webhook trigger events (BOOKING_REJECTED and BOOKING_REQUESTED) by adding them to the database schema, constants, and UI configuration. It centralizes webhook dispatching logic through a new handleWebhookTrigger utility, refactors existing booking flows to use this utility, and extends webhook support to the booking confirmation/rejection handler with comprehensive e2e test coverage. Changes
Sequence Diagram(s)sequenceDiagram
participant Booking Handler as Booking Handler<br/>(confirm/create)
participant handleWebhookTrigger
participant getWebhooks
participant sendPayload
participant Webhook Endpoint
rect rgb(200, 220, 255)
Note over Booking Handler,Webhook Endpoint: Centralized Webhook Dispatch Flow
Booking Handler->>Booking Handler: Prepare subscriberOptions<br/>(eventType, userId, trigger)
Booking Handler->>Booking Handler: Build webhookData<br/>(calendar event, metadata)
Booking Handler->>handleWebhookTrigger: Call with subscriberOptions,<br/>eventTrigger, webhookData
handleWebhookTrigger->>getWebhooks: Fetch subscribers matching<br/>subscriberOptions
getWebhooks-->>handleWebhookTrigger: Return webhooks list
par Parallel Dispatch
handleWebhookTrigger->>sendPayload: Dispatch to subscriber 1
handleWebhookTrigger->>sendPayload: Dispatch to subscriber 2
handleWebhookTrigger->>sendPayload: Dispatch to subscriber N
and
sendPayload->>Webhook Endpoint: POST with payload +<br/>secret, timestamp
Webhook Endpoint-->>sendPayload: Response
sendPayload-->>handleWebhookTrigger: Per-subscriber result
end
handleWebhookTrigger->>handleWebhookTrigger: Log errors (if any)
handleWebhookTrigger-->>Booking Handler: Complete
end
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes The changes involve: database schema additions with migrations, a new centralized webhook abstraction layer, refactoring of existing webhook logic across multiple booking handlers, integration into the booking confirmation flow, substantial e2e test reorganization with expanded payload validation, and new UI/localization elements. While many changes follow consistent patterns, they span multiple architectural layers and require verification of webhook dispatch correctness, event type handling, and test coverage. Poem
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (11)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
What does this PR do?
Visual Demo (For contributors especially)
A visual demonstration is strongly recommended, for both the original and new change (video / image - any one).
Video Demo (if applicable):
Image Demo (if applicable):
Mandatory Tasks (DO NOT REMOVE)
How should this be tested?
Checklist
Summary by CodeRabbit
New Features
BOOKING_REJECTEDandBOOKING_REQUESTEDwebhook trigger events, enabling webhooks for booking rejections and pending booking requests.Tests
Localization