chore(jobs): disable Arcadia jobs until API is available and refresh

This commit is contained in:
Jérémy Munsch 2026-10-27 11:06:25 +01:00
parent 240885577d
commit 5201aa3a5a
No known key found for this signature in database
GPG key ID: 2AAECDA6B7330F91
4 changed files with 32 additions and 22 deletions

View file

@ -6,16 +6,18 @@ namespace App\Policies\Backend;
use App\Models\Customer;
use App\Models\User;
use Domain\Enums\UserRole;
class EmployeePolicy
{
public function dispatchArcadiaRefreshJob(Customer | User $user): bool
{
if ($user instanceof Customer) {
return false;
}
// FIXME: The Arcadia refresh job dispatching is currently disabled and needs to be enabled when api will be available.
return false;
return $user->role->isAtLeastEqualsTo(UserRole::Admin);
// if ($user instanceof Customer) {
// return false;
// }
// return $user->role->isAtLeastEqualsTo(UserRole::Admin);
}
}

View file

@ -3,8 +3,6 @@
declare(strict_types=1);
use App\Jobs\DeleteOldResetTokens;
use App\Jobs\FetchAndUpsertArcadiaEmployees;
use App\Jobs\FetchAndUpsertArcadiaProductIncos;
use App\Jobs\SendMissingOrderReminderJob;
use App\Jobs\SendReminderMail;
use App\Jobs\UpdateSlidesStatus;
@ -16,8 +14,11 @@ use Illuminate\Support\Facades\Date;
return function (Schedule $schedule): void {
$schedule->job(DeleteOldResetTokens::class)->everyMinute();
$schedule->job(UpdateSlidesStatus::class)->everyMinute();
$schedule->job(FetchAndUpsertArcadiaEmployees::class)->onOneServer()->dailyAt('00:00');
$schedule->job(FetchAndUpsertArcadiaProductIncos::class)->onOneServer()->dailyAt('02:00');
// FIXME: The Arcadia jobs are currently disabled and need to be enabled when api will be available.
// $schedule->job(FetchAndUpsertArcadiaEmployees::class)->onOneServer()->dailyAt('00:00');
// $schedule->job(FetchAndUpsertArcadiaProductIncos::class)->onOneServer()->dailyAt('02:00');
$schedule->job(SendReminderMail::class)->onOneServer()->dailyAt('10:00');
$schedule->job(SendMissingOrderReminderJob::class)
->onOneServer()

View file

@ -11,23 +11,24 @@ describe('EmployeesController', function () {
beforeEach(function () {
// GIVEN
/** @var \Tests\TestCase $this */
$this->user = User::factory()->create(['role' => UserRole::SuperAdmin]);
$this->actingAs($this->user, 'backend');
$user = User::factory()->create(['role' => UserRole::SuperAdmin]);
$this->actingAs($user, 'backend');
});
it('can launch employee sync job', function () {
// GIVEN
/** @var \Tests\TestCase $this */
Queue::fake();
// FIXME: The Arcadia refresh action is inhibited, uncomment this test when api acrcadia is up.
// it('can launch employee sync job', function () {
// // GIVEN
// /** @var \Tests\TestCase $this */
// Queue::fake();
// WHEN
$response = $this->post('/bo/settings/employees/sync');
// // WHEN
// $response = $this->post('/bo/settings/employees/sync');
// THEN
$response->assertSessionHasNoErrors();
$response->assertRedirect(route('bo.dashboard'));
Queue::assertPushed(FetchAndUpsertArcadiaEmployees::class);
});
// // THEN
// $response->assertSessionHasNoErrors();
// $response->assertRedirect(route('bo.dashboard'));
// Queue::assertPushed(FetchAndUpsertArcadiaEmployees::class);
// });
it('redirects unauthenticated users to login', function () {
// GIVEN

View file

@ -24,6 +24,12 @@ afterEach(function (): void {
describe('Employee Sync Feature E2E', function (): void {
it('configures sites in back office and synchronizes employees from Arcadia API into database', function (): void {
// FIXME: Arcadia API is offline renablethis this test when up.
expect(true)->toBeTruthy();
return;
/** @var \Tests\TestCase $this */
// GIVEN