- Added new automation-related routes and controllers for managing automations. - Introduced automation nodes in the UI with distinct styles and interactions. - Updated sidebar to include navigation for automations. - Enhanced post creation logic to support automation metadata. - Refactored content type and platform enums into types for better type safety. - Added localization for automation-related terms in English, Spanish, and Portuguese. - Improved error handling in various components to accommodate new features.
26 lines
709 B
PHP
26 lines
709 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Actions\Automation\Node;
|
|
|
|
use App\DataTransferObjects\Automation\NodeRunResult;
|
|
use App\Models\AutomationRun;
|
|
|
|
class RunDelayNode
|
|
{
|
|
public function __invoke(AutomationRun $run, array $config): NodeRunResult
|
|
{
|
|
$duration = (int) ($config['duration'] ?? 0);
|
|
$unit = $config['unit'] ?? 'minutes';
|
|
|
|
$until = match ($unit) {
|
|
'minutes' => now()->addMinutes($duration),
|
|
'hours' => now()->addHours($duration),
|
|
'days' => now()->addDays($duration),
|
|
default => throw new \InvalidArgumentException("Unknown delay unit: {$unit}"),
|
|
};
|
|
|
|
return NodeRunResult::sleep($until);
|
|
}
|
|
}
|