36 lines
838 B
PHP
36 lines
838 B
PHP
|
|
<?php
|
||
|
|
|
||
|
|
declare(strict_types=1);
|
||
|
|
|
||
|
|
namespace App\Jobs;
|
||
|
|
|
||
|
|
use App\Actions\Employee\SynchronizeEmployeesWithArcadiaApi;
|
||
|
|
use App\Contracts\ActionInputEmpty;
|
||
|
|
use App\Contracts\Executor;
|
||
|
|
use Illuminate\Contracts\Queue\ShouldBeUnique;
|
||
|
|
use Illuminate\Contracts\Queue\ShouldQueue;
|
||
|
|
use Illuminate\Foundation\Queue\Queueable;
|
||
|
|
|
||
|
|
class FetchAndUpsertArcadiaEmployees implements ShouldBeUnique, ShouldQueue
|
||
|
|
{
|
||
|
|
use Queueable;
|
||
|
|
|
||
|
|
/** Retain unique lock for 3600 seconds (1 hour) */
|
||
|
|
public int $uniqueFor = 3600;
|
||
|
|
|
||
|
|
public function uniqueId(): string
|
||
|
|
{
|
||
|
|
return 'fetch-and-upsert-arcadia-employees';
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Execute the job.
|
||
|
|
*/
|
||
|
|
public function handle(
|
||
|
|
Executor $executor,
|
||
|
|
SynchronizeEmployeesWithArcadiaApi $action
|
||
|
|
): void {
|
||
|
|
$executor->execute($action, new ActionInputEmpty());
|
||
|
|
}
|
||
|
|
}
|