- Implement automated synchronization of employees via Arcadia API (EmployeeSyncService, SynchronizeEmployeesWithArcadiaApi, FetchAndUpsertArcadiaEmployees) - Add Back-Office application settings for employee sites (Setting singleton, GetSettingsQuery, UpdateSettings, SettingsController, EmployeeSitesInputComponent.vue) - Strongly type Employee attributes using Domain Value Objects (ShopperEstablishmentCode, ShopperSiteCode, ShopperServiceCode) and Eloquent Casts - Migrate pagination from Domain to Shared\Pagination namespace across queries and inputs - Remove legacy and dead CSV employee import/export code - Restore Domain\Ports\Services\CsvGenerator interface for Regate order generation - Add comprehensive Pest unit, integration, and feature test coverage
34 lines
922 B
PHP
34 lines
922 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Actions\Employee;
|
|
|
|
use App\Contracts\Action;
|
|
use App\Contracts\ActionInput;
|
|
use App\Contracts\ActionInputEmpty;
|
|
use App\Contracts\Repositories\EmployeeRepository;
|
|
use App\Services\EmployeeSyncService;
|
|
use Webmozart\Assert\Assert;
|
|
|
|
/**
|
|
* @implements \App\Contracts\Action<\App\Contracts\ActionInputEmpty, void>
|
|
*/
|
|
final class SynchronizeEmployeesWithArcadiaApi implements Action
|
|
{
|
|
public function __construct(
|
|
private readonly EmployeeRepository $employeeRepository,
|
|
private readonly EmployeeSyncService $syncService
|
|
) {
|
|
}
|
|
|
|
/** @param \App\Contracts\ActionInputEmpty $input */
|
|
public function __invoke(ActionInput $input): void
|
|
{
|
|
Assert::isAOf($input, ActionInputEmpty::class);
|
|
|
|
$wasLastSyncedAt = $this->employeeRepository->getMostRecentSyncDate();
|
|
|
|
$this->syncService->synchronize($wasLastSyncedAt);
|
|
}
|
|
}
|