chore(jobs): disable Arcadia jobs until API is available and refresh
This commit is contained in:
parent
240885577d
commit
5201aa3a5a
4 changed files with 32 additions and 22 deletions
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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()
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue