feat(schedule): add schedule:bootstrap and minute-precise automation runs

Install per-module schedule:run cron from artisan, store sms/in_app send minutes, and match scheduled triggers at exact HH:mm Tehran time.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-08-24 22:13:06 +03:30
co-authored by Cursor
parent 9bb0fa3a1d
commit 1c8ab4b725
7 changed files with 214 additions and 17 deletions
@@ -167,7 +167,9 @@ class AutomationController extends Controller
}
$smsHour = $request->input('sms_send_hour');
$smsMinute = $request->input('sms_send_minute');
$inAppHour = $request->input('in_app_send_hour');
$inAppMinute = $request->input('in_app_send_minute');
$triggerConfigRaw = (array) $request->input('trigger_config', []);
$priceWindow = (string) ($triggerConfigRaw['price_window'] ?? 'calendar_day');
$needsChannelHour = ! (
@@ -266,9 +268,15 @@ class AutomationController extends Controller
'sms_send_hour' => in_array(AutomationCatalog::CHANNEL_SMS, $channels, true)
? ($smsHour === null ? null : (int) $smsHour)
: null,
'sms_send_minute' => in_array(AutomationCatalog::CHANNEL_SMS, $channels, true)
? ($smsHour === null ? null : max(0, min(59, (int) ($smsMinute ?? 0))))
: null,
'in_app_send_hour' => in_array(AutomationCatalog::CHANNEL_IN_APP, $channels, true)
? ($inAppHour === null ? null : (int) $inAppHour)
: null,
'in_app_send_minute' => in_array(AutomationCatalog::CHANNEL_IN_APP, $channels, true)
? ($inAppHour === null ? null : max(0, min(59, (int) ($inAppMinute ?? 0))))
: null,
'trigger_type' => $triggerType,
'trigger_config' => $triggerConfig,
'conditions' => $conditions,