Skip to content

Commit

Permalink
/api/company/listをGETに変更
Browse files Browse the repository at this point in the history
  • Loading branch information
kyoya0819 committed Aug 29, 2024
1 parent 8642e84 commit 34d7500
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 28 deletions.
15 changes: 10 additions & 5 deletions backend/app/Http/Controllers/Api/Company/ListController.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,26 @@
namespace App\Http\Controllers\Api\Company;

use App\Http\Controllers\Controller;
use App\Http\Requests\Api\Company\List\InvokeRequest;
use App\Models\Company;
use App\UseCases\Company\ListFilterByIndustryIds;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;

class ListController extends Controller
{
/**
* @param InvokeRequest $request
* @param Request $request
* @return JsonResponse
*/
public function __invoke(InvokeRequest $request): JsonResponse
public function __invoke(Request $request): JsonResponse
{
/* @var int[] $industry_ids */
$industry_ids = $request->validated()['industry_ids'];
$industry_ids_raw = $request->query("industry_ids");
if ($industry_ids_raw === null)
return response()->json();

$industry_ids = is_array($industry_ids_raw)
? array_map(fn ($industry_id) => (int) $industry_id, $industry_ids_raw)
: [(int) $industry_ids_raw];

$companies = ListFilterByIndustryIds::run($industry_ids);

Expand Down
22 changes: 0 additions & 22 deletions backend/app/Http/Requests/Api/Company/List/InvokeRequest.php

This file was deleted.

2 changes: 1 addition & 1 deletion backend/routes/api.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@
Route::post("/press-release/view", PressRelease\ViewController::class);
Route::get("/press-release/recommend", PressRelease\RecommendController::class);

Route::post("/company/list", Company\ListController::class);
Route::get("/company/list", Company\ListController::class);
});

0 comments on commit 34d7500

Please sign in to comment.