refactor(presentation): remove authorize method from FormRequests in favor of middleware filters

This commit is contained in:
Jérémy Munsch 2026-08-20 17:35:26 +02:00
parent 6be00bb21e
commit 6f35e031fa
Signed by: forge-joniko
GPG key ID: D7EFE2F5CB6CC0E4
7 changed files with 4 additions and 30 deletions

View file

@ -17,11 +17,6 @@ final class EmployeeShowRequest extends FormRequest
];
}
public function authorize(): bool
{
return true;
}
protected function prepareForValidation(): void
{
$this->merge([

View file

@ -42,11 +42,6 @@ final class EmployeesIndexRequest extends FormRequest
];
}
public function authorize(): bool
{
return true;
}
public function sorter(): EmployeeSorter
{
return new EmployeeSorter($this->sortBy(), $this->direction());

View file

@ -17,11 +17,6 @@ final class IncoCompositionShowRequest extends FormRequest
];
}
public function authorize(): bool
{
return true;
}
protected function prepareForValidation(): void
{
$this->merge([

View file

@ -38,11 +38,6 @@ final class IncoSheetsIndexRequest extends FormRequest
];
}
public function authorize(): bool
{
return true;
}
public function sorter(): IncoSheetSorter
{
return new IncoSheetSorter($this->sortBy(), $this->direction());

View file

@ -24,11 +24,6 @@ final class IncoSheetsSearchRequest extends FormRequest
];
}
public function authorize(): bool
{
return true;
}
public function incoIdSearch(): IncoIdQuery
{
return new IncoIdQuery($this->string('incoIdLike')->value());

View file

@ -17,11 +17,6 @@ final class IncoSheetsShowRequest extends FormRequest
];
}
public function authorize(): bool
{
return true;
}
protected function prepareForValidation(): void
{
$this->merge([

View file

@ -31,6 +31,10 @@ describe('Presentation Architecture Rules', function (): void {
->expect('Presentation\Api\V1\Http\Requests')
->not->toHaveMethod('toInput');
arch('Presentation FormRequests do not contain authorize method (auth is handled in middleware filters)')
->expect('Presentation\Api\V1\Http\Requests')
->not->toHaveMethod('authorize');
arch('Presentation layer uses strict types')
->expect('Presentation')
->toUseStrictTypes();