fix(reminders): re-arm reminder jobs on waitlist promotion

A booking promoted off the waitlist after its reminder had already
dispatched-as-skipped went unreminded. Promotion now clears pending
jobs and re-arms via the shared armReminderJobs helper — extracted
from booking creation so both paths arm email plus opt-in SMS.

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
Tomas DvorakandDevin committed 2026-09-18 13:18:39 +02:00
1 parent 10df4e4c64
commit e4d95bf504
3 files changed
+37 -20

No files matched your search

+2 -20
View File
@@ -357,26 +357,8 @@ func (s *Service) Create(ctx context.Context, request domain.CreateBookingReques
}
}
if scheduledFor, ok := reminderSchedule(startsAt); ok {
if err := s.repo.CreateReminderJob(ctx, db.ReminderJobParams{
TenantID: tenant.ID,
BookingID: created.ID,
Channel: "email",
ScheduledFor: scheduledFor,
}); err != nil {
return domain.CreateBookingResponse{}, err
}
// SMS reminders are a per-tenant opt-in and need a customer phone.
if request.CustomerPhone != "" {
if smsSettings, err := s.repo.GetTenantSMSSettings(ctx, tenant.ID); err == nil && smsSettings.Enabled {
_ = s.repo.CreateReminderJob(ctx, db.ReminderJobParams{
TenantID: tenant.ID,
BookingID: created.ID,
Channel: "sms",
ScheduledFor: scheduledFor,
})
}
}
if err := armReminderJobs(ctx, s.repo, tenant.ID, created.ID, startsAt, request.CustomerPhone); err != nil {
return domain.CreateBookingResponse{}, err
}
// Send confirmation emails (async - don't fail booking if email fails)