diff --git a/modules/Auth/Controllers/AuthController.php b/modules/Auth/Controllers/AuthController.php index 978c536..71935e9 100644 --- a/modules/Auth/Controllers/AuthController.php +++ b/modules/Auth/Controllers/AuthController.php @@ -7,7 +7,6 @@ use App\Http\Controllers\Controller; use Exa\Http\Responses\ApiSuccessResponse; use Exa\Http\Responses\NoContentResponse; -use Illuminate\Http\Request; use Illuminate\Support\Facades\Auth; use Modules\Auth\Actions\Login; use Modules\Auth\DTOs\LoginDTO; @@ -38,11 +37,9 @@ final class AuthController extends Controller #[OA\Response(response: '403', description: 'Forbidden')] #[OA\Response(response: '422', description: 'Invalid Data')] #[OA\Response(response: '500', description: 'Server Error')] - public function login(Request $request, Login $action): ApiSuccessResponse + public function login(LoginDTO $dto, Login $action): ApiSuccessResponse { - return new ApiSuccessResponse( - new LoginResource($action->handle(LoginDTO::fromRequest($request))) - ); + return new ApiSuccessResponse(new LoginResource($action->handle($dto))); } #[OA\Post( diff --git a/modules/Auth/Controllers/UserController.php b/modules/Auth/Controllers/UserController.php index b90700b..fc3ab69 100644 --- a/modules/Auth/Controllers/UserController.php +++ b/modules/Auth/Controllers/UserController.php @@ -9,7 +9,6 @@ use Exa\Http\Responses\ApiSuccessResponse; use Exa\Http\Responses\NoContentResponse; use Illuminate\Http\JsonResponse; -use Illuminate\Http\Request; use Illuminate\Http\Response; use Modules\Auth\Actions\CreateUser; use Modules\Auth\Actions\DeleteUser; @@ -48,9 +47,9 @@ final class UserController extends Controller #[OA\Response(response: '401', description: 'Unauthorized')] #[OA\Response(response: '403', description: 'Forbidden')] #[OA\Response(response: '500', description: 'Server Error')] - public function index(Request $request, FetchUsersList $action): JsonResponse + public function index(DatatableDTO $dto, FetchUsersList $action): JsonResponse { - return UserResource::collection($action->handle(DatatableDTO::fromRequest($request)))->response(); + return UserResource::collection($action->handle($dto))->response(); } #[OA\Get( @@ -98,10 +97,10 @@ public function show(string $uuid, FetchUser $action): ApiSuccessResponse #[OA\Response(response: '403', description: 'Forbidden')] #[OA\Response(response: '422', description: 'Invalid Data')] #[OA\Response(response: '500', description: 'Server Error')] - public function store(Request $request, CreateUser $action): ApiSuccessResponse + public function store(CreateUserDTO $dto, CreateUser $action): ApiSuccessResponse { return new ApiSuccessResponse( - new UserResource($action->handle(CreateUserDTO::fromRequest($request))), + new UserResource($action->handle($dto)), Response::HTTP_CREATED ); } @@ -131,11 +130,9 @@ public function store(Request $request, CreateUser $action): ApiSuccessResponse #[OA\Response(response: '404', description: 'Not Found')] #[OA\Response(response: '422', description: 'Invalid Data')] #[OA\Response(response: '500', description: 'Server Error')] - public function update(Request $request, string $uuid, UpdateUser $action): ApiSuccessResponse + public function update(UpdateUserDTO $dto, string $uuid, UpdateUser $action): ApiSuccessResponse { - return new ApiSuccessResponse( - new UserResource($action->handle($uuid, UpdateUserDTO::fromRequest($request))) - ); + return new ApiSuccessResponse(new UserResource($action->handle($uuid, $dto))); } #[OA\Delete(