-
Notifications
You must be signed in to change notification settings - Fork 0
Comprehensive workflow reminder management for booking lifecycle events #6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: workflow-queue-base
Are you sure you want to change the base?
Conversation
…re still sent (#7232) * small UI fix * fix cancelling scheduled emails * improve comments * delete reminders for rescheduled bookings * add migration file * cancel rescheduled bookings immediately * remove immediate delete for request reschedule --------- Co-authored-by: CarinaWolli <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Your free trial has ended. If you'd like to continue receiving code reviews, you can add a payment method here.
Greptile OverviewConfidence Score: 3/5
Important Files ChangedFile Analysis
Sequence DiagramsequenceDiagram
participant User
participant BookingHandler
participant ReminderManager
participant Database
participant SendGrid
participant CronJob
Note over User,CronJob: Booking Cancellation Flow
User->>BookingHandler: Cancel Booking
BookingHandler->>Database: Update booking status
BookingHandler->>ReminderManager: deleteScheduledEmailReminder(id, refId)
alt referenceId exists
ReminderManager->>Database: Mark reminder as cancelled=true
else no referenceId
ReminderManager->>Database: Delete reminder immediately
end
Note over User,CronJob: Booking Reschedule Flow
User->>BookingHandler: Reschedule Booking
BookingHandler->>Database: Load workflowReminders
BookingHandler->>ReminderManager: deleteScheduledEmailReminder(id, refId, immediate=true)
alt immediate delete
ReminderManager->>SendGrid: Cancel scheduled email
end
BookingHandler->>Database: Create new booking
BookingHandler->>ReminderManager: scheduleWorkflowReminders()
ReminderManager->>SendGrid: Schedule new reminders
ReminderManager->>Database: Create new WorkflowReminder records
Note over User,CronJob: Cron Job Processing
CronJob->>Database: Find cancelled reminders (next hour)
loop For each cancelled reminder
CronJob->>SendGrid: Cancel via batch_id
CronJob->>Database: Delete reminder record
end
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
10 files reviewed, 1 comment
| await client.request({ | ||
| url: "/v3/user/scheduled_sends", | ||
| method: "POST", | ||
| body: { | ||
| batch_id: reminder.referenceId, | ||
| status: "cancel", | ||
| }, | ||
| }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
logic: null referenceId will cause SendGrid API error
| await client.request({ | |
| url: "/v3/user/scheduled_sends", | |
| method: "POST", | |
| body: { | |
| batch_id: reminder.referenceId, | |
| status: "cancel", | |
| }, | |
| }); | |
| if (reminder.referenceId) { | |
| await client.request({ | |
| url: "/v3/user/scheduled_sends", | |
| method: "POST", | |
| body: { | |
| batch_id: reminder.referenceId, | |
| status: "cancel", | |
| }, | |
| }); | |
| } |
Prompt To Fix With AI
This is a comment left during a code review.
Path: packages/features/ee/workflows/api/scheduleEmailReminders.ts
Line: 57:64
Comment:
**logic:** null `referenceId` will cause SendGrid API error
```suggestion
if (reminder.referenceId) {
await client.request({
url: "/v3/user/scheduled_sends",
method: "POST",
body: {
batch_id: reminder.referenceId,
status: "cancel",
},
});
}
```
How can I resolve this? If you propose a fix, please make it concise.
Test 6
Replicated from ai-code-review-evaluation/cal.com-greptile#6