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
@@ -86,7 +86,7 @@ class SuperAdminProgramSettingsOverlay
/**
* کش را پاک می‌کند و دوباره از سوپرادمین می‌خواند.
*
* @return array{ok: bool, count: int, enable_automation: string|null, source: string}
* @return array{ok: bool, count: int, items: array<string, string>, source: string}
*/
public function refreshFromSuperAdmin(): array
{
@@ -96,17 +96,27 @@ class SuperAdminProgramSettingsOverlay
return [
'ok' => false,
'count' => 0,
'enable_automation' => null,
'items' => [],
'source' => 'unavailable',
];
}
$auto = $map['enable_automation']['value'] ?? null;
$items = [];
foreach ($map as $key => $row) {
if (! is_array($row)) {
continue;
}
$value = $row['value'] ?? null;
if ($value === null || $value === '') {
continue;
}
$items[(string) $key] = (string) $value;
}
return [
'ok' => true,
'count' => count($map),
'enable_automation' => $auto === null || $auto === '' ? null : (string) $auto,
'count' => count($items),
'items' => $items,
'source' => 'superadmin',
];
}