mirror of
https://github.com/MarijnDoeve/TijdVoorDeTest.git
synced 2026-03-06 12:44:20 +01:00
Refactor routes for consistency, update season codes, and add Justfile for Docker commands
This commit is contained in:
@@ -21,7 +21,7 @@ final class BackofficeController extends AbstractController
|
||||
private readonly CandidateRepository $candidateRepository,
|
||||
) {}
|
||||
|
||||
#[Route('/backoffice/', name: 'index')]
|
||||
#[Route('/backoffice/', name: 'app_backoffice_index')]
|
||||
public function index(): Response
|
||||
{
|
||||
$seasons = $this->seasonRepository->findAll();
|
||||
@@ -31,7 +31,7 @@ final class BackofficeController extends AbstractController
|
||||
]);
|
||||
}
|
||||
|
||||
#[Route('/backoffice/{seasonCode}', name: 'season')]
|
||||
#[Route('/backoffice/{seasonCode}', name: 'app_backoffice_season')]
|
||||
public function season(Season $season): Response
|
||||
{
|
||||
return $this->render('backoffice/season.html.twig', [
|
||||
@@ -39,7 +39,7 @@ final class BackofficeController extends AbstractController
|
||||
]);
|
||||
}
|
||||
|
||||
#[Route('/backoffice/{seasonCode}/{quiz}', name: 'quiz')]
|
||||
#[Route('/backoffice/{seasonCode}/{quiz}', name: 'app_backoffice_quiz')]
|
||||
public function quiz(Season $season, Quiz $quiz): Response
|
||||
{
|
||||
return $this->render('backoffice/quiz.html.twig', [
|
||||
|
||||
@@ -11,7 +11,7 @@ use Symfony\Component\Security\Http\Authentication\AuthenticationUtils;
|
||||
|
||||
class LoginController extends AbstractController
|
||||
{
|
||||
#[Route(path: '/login', name: 'app_login')]
|
||||
#[Route(path: '/login', name: 'app_login_login')]
|
||||
public function login(AuthenticationUtils $authenticationUtils): Response
|
||||
{
|
||||
// get the login error if there is one
|
||||
@@ -26,7 +26,7 @@ class LoginController extends AbstractController
|
||||
]);
|
||||
}
|
||||
|
||||
#[Route(path: '/logout', name: 'app_logout')]
|
||||
#[Route(path: '/logout', name: 'app_login_logout')]
|
||||
public function logout(): void
|
||||
{
|
||||
throw new \LogicException('This method can be blank - it will be intercepted by the logout key on your firewall.');
|
||||
|
||||
@@ -31,7 +31,7 @@ final class QuizController extends AbstractController
|
||||
|
||||
private const string CANDIDATE_HASH_REGEX = '[\w\-=]+';
|
||||
|
||||
#[Route(path: '/', name: 'select_season', methods: ['GET', 'POST'])]
|
||||
#[Route(path: '/', name: 'app_quiz_selectseason', methods: ['GET', 'POST'])]
|
||||
public function selectSeason(Request $request): Response
|
||||
{
|
||||
$form = $this->createForm(SelectSeasonType::class);
|
||||
@@ -40,13 +40,13 @@ final class QuizController extends AbstractController
|
||||
if ($form->isSubmitted() && $form->isValid()) {
|
||||
$data = $form->getData();
|
||||
|
||||
return $this->redirectToRoute('enter_name', ['seasonCode' => $data['season_code']]);
|
||||
return $this->redirectToRoute('app_quiz_entername', ['seasonCode' => $data['season_code']]);
|
||||
}
|
||||
|
||||
return $this->render('quiz/select_season.html.twig', ['form' => $form]);
|
||||
}
|
||||
|
||||
#[Route(path: '/{seasonCode}', name: 'enter_name', requirements: ['seasonCode' => self::SEASON_CODE_REGEX])]
|
||||
#[Route(path: '/{seasonCode}', name: 'app_quiz_entername', requirements: ['seasonCode' => self::SEASON_CODE_REGEX])]
|
||||
public function enterName(
|
||||
Request $request,
|
||||
#[MapEntity(mapping: ['seasonCode' => 'seasonCode'])]
|
||||
@@ -60,7 +60,7 @@ final class QuizController extends AbstractController
|
||||
$data = $form->getData();
|
||||
$name = $data['name'];
|
||||
|
||||
return $this->redirectToRoute('quiz_page', ['seasonCode' => $season->getSeasonCode(), 'nameHash' => Base64::base64_url_encode($name)]);
|
||||
return $this->redirectToRoute('app_quiz_quizpage', ['seasonCode' => $season->getSeasonCode(), 'nameHash' => Base64::base64_url_encode($name)]);
|
||||
}
|
||||
|
||||
return $this->render('quiz/enter_name.twig', ['season' => $season, 'form' => $form]);
|
||||
@@ -68,7 +68,7 @@ final class QuizController extends AbstractController
|
||||
|
||||
#[Route(
|
||||
path: '/{seasonCode}/{nameHash}',
|
||||
name: 'quiz_page',
|
||||
name: 'app_quiz_quizpage',
|
||||
requirements: ['seasonCode' => self::SEASON_CODE_REGEX, 'nameHash' => self::CANDIDATE_HASH_REGEX],
|
||||
)]
|
||||
public function quizPage(
|
||||
@@ -87,7 +87,7 @@ final class QuizController extends AbstractController
|
||||
if ($season->isPreregisterCandidates()) {
|
||||
$this->addFlash(FlashType::Danger, 'Candidate not found');
|
||||
|
||||
return $this->redirectToRoute('enter_name', ['seasonCode' => $season->getSeasonCode()]);
|
||||
return $this->redirectToRoute('app_quiz_entername', ['seasonCode' => $season->getSeasonCode()]);
|
||||
}
|
||||
|
||||
$candidate = new Candidate(Base64::base64_url_decode($nameHash));
|
||||
@@ -113,7 +113,7 @@ final class QuizController extends AbstractController
|
||||
if (!$question instanceof Question) {
|
||||
$this->addFlash(FlashType::Success, 'Quiz completed');
|
||||
|
||||
return $this->redirectToRoute('enter_name', ['seasonCode' => $season->getSeasonCode()]);
|
||||
return $this->redirectToRoute('app_quiz_entername', ['seasonCode' => $season->getSeasonCode()]);
|
||||
}
|
||||
|
||||
// TODO One first question record time
|
||||
|
||||
Reference in New Issue
Block a user