feat(automations): add run-now test endpoint and sends log table

Enable immediate automation test runs without waiting for the scheduled hour, expose send history for debugging, and return all SuperAdmin overlay keys on refresh instead of only enable_automation.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-08-24 21:46:13 +03:30
co-authored by Cursor
parent 7e8979d78d
commit 995f6984ed
7 changed files with 127 additions and 17 deletions
+7 -3
View File
@@ -21,9 +21,9 @@ class AutomationSender
) {
}
public function send(Automation $auto, Customer $customer, string $channel): bool
public function send(Automation $auto, Customer $customer, string $channel, bool $force = false): bool
{
if (! $this->maySend($auto, $customer, $channel)) {
if (! $this->maySend($auto, $customer, $channel, $force)) {
return false;
}
@@ -71,12 +71,16 @@ class AutomationSender
}
}
public function maySend(Automation $auto, Customer $customer, string $channel): bool
public function maySend(Automation $auto, Customer $customer, string $channel, bool $force = false): bool
{
if (! $auto->usesChannel($channel)) {
return false;
}
if ($force) {
return true;
}
$max = $auto->max_sends;
if ($max !== null && (int) $max > 0) {
$count = AutomationSend::query()