- Add ImportEmployees Action and ImportEmployeesInput - Add GetEmployeeImportColumnsQuery - Encapsulate toImportEmployeesInput in ImportRequest - Use Executor in Bo\EmployeesController - Add feature tests for Bo\EmployeesController
35 lines
778 B
PHP
35 lines
778 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Queries\Employees;
|
|
|
|
use App\Contracts\Query;
|
|
use App\Contracts\QueryInput;
|
|
use App\Contracts\QueryInputEmpty;
|
|
use Domain\Services\EmployeeImportService;
|
|
use Webmozart\Assert\Assert;
|
|
|
|
/**
|
|
* @implements \App\Contracts\Query<\App\Contracts\QueryInputEmpty, list<string>>
|
|
*/
|
|
final readonly class GetEmployeeImportColumnsQuery implements Query
|
|
{
|
|
public function __construct(
|
|
private EmployeeImportService $employeeService,
|
|
) {
|
|
}
|
|
|
|
/**
|
|
* @return list<string>
|
|
*/
|
|
public function __invoke(QueryInput $input): array
|
|
{
|
|
Assert::isInstanceOf(
|
|
$input,
|
|
QueryInputEmpty::class,
|
|
);
|
|
|
|
return array_values($this->employeeService->getImportColumns());
|
|
}
|
|
}
|