Fix
dyb-tech.com/LaLiga-BackEnd/pipeline/head This commit looks good Details

This commit is contained in:
Daniel Guzman 2024-08-11 02:29:03 +02:00
parent e2a4c6f3bd
commit 5c4e088c0b
1 changed files with 6 additions and 8 deletions

View File

@ -23,9 +23,13 @@ class LeagueController extends AbstractController
{ {
return $handleCreateLeague($request); return $handleCreateLeague($request);
} }
#[Route('/api/league/{$leagueId}', name: 'app_update_league', methods: ['PUT'])] #[Route('/api/league/{leagueId}', name: 'app_get_put_league', methods: ['GET, PUT'])]
public function updateLeague(Request $request, HandleUpdateLeague $handleUpdateLeague, int $leagueId): JsonResponse public function getOrUpdateLeagueById(Request $request, HandleGetLeagueById $handleGetLeagueById, HandleUpdateLeague $handleUpdateLeague, int $leagueId): JsonResponse
{ {
if ($request->getMethod() == 'GET')
{
return $handleGetLeagueById($request, $leagueId);
}
return $handleUpdateLeague($request, $leagueId); return $handleUpdateLeague($request, $leagueId);
} }
@ -44,12 +48,6 @@ class LeagueController extends AbstractController
return $handleCaptainRequest($request, $leagueId, $teamId); return $handleCaptainRequest($request, $leagueId, $teamId);
} }
#[Route('/api/league/{leagueId}', name: 'app_get_league', methods: ['GET'])]
public function getLeagueById(Request $request, HandleGetLeagueById $handleGetLeagueById, int $leagueId): JsonResponse
{
return $handleGetLeagueById($request, $leagueId);
}
#[Route('/api/public/league', name: 'app_get_all_leagues', methods: ['GET'])] #[Route('/api/public/league', name: 'app_get_all_leagues', methods: ['GET'])]
public function getAllLeagues(HandleGetAllLeagues $handleGetAllLeagues): JsonResponse public function getAllLeagues(HandleGetAllLeagues $handleGetAllLeagues): JsonResponse
{ {