feat(email): per-weekday business hours + manual queue flush
Move the scheduled-email business-hours floor onto the business profile
as Google-style per-weekday opening blocks (multiple blocks/day for lunch
breaks). Migration 114 adds business_profile.business_hours (JSON) +
scheduled_email_floor_enabled; emailProcessor snaps a queued email to the
next open block, read in the profile timezone. Editor lives under
Settings → Business profile.
Add an admin "Send queued emails now" flush (POST /admin/email/flush-queue)
that drains the queue immediately, ignoring the business-hours floor — the
escape hatch before maintenance/updates. processEmailQueue now takes
{ignoreSchedule, limit} and returns send counts; the scheduled interval
run is unchanged.
This commit is contained in:
@@ -74,6 +74,16 @@ export const emailService = {
|
||||
await api.post('/admin/email/test', { test_email: testEmail });
|
||||
},
|
||||
|
||||
/** Flush the email queue immediately. Sends every pending email now,
|
||||
* bypassing the business-hours floor — the escape hatch for draining
|
||||
* the queue before maintenance/updates. */
|
||||
async flushQueue(): Promise<{ processed: number; sent: number; failed: number }> {
|
||||
const response = await api.post<{ processed: number; sent: number; failed: number }>(
|
||||
'/admin/email/flush-queue'
|
||||
);
|
||||
return response.data;
|
||||
},
|
||||
|
||||
// Get all email templates
|
||||
async getTemplates(): Promise<EmailTemplate[]> {
|
||||
const response = await api.get<EmailTemplate[]>('/admin/email/templates');
|
||||
|
||||
Reference in New Issue
Block a user