up schema

This commit is contained in:
Tykayn 2025-02-14 12:35:48 +01:00 committed by tykayn
parent 17e7fce7f8
commit 8e2da4f159
20 changed files with 879 additions and 4 deletions

View file

@ -0,0 +1,27 @@
<?php
namespace App\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
class AccountController extends AbstractController
{
#[Route('/account', name: 'app_account')]
public function index(): Response
{
return $this->render('account/index.html.twig', [
'controller_name' => 'AccountController',
]);
}
/***
page d'exemple
**/
#[Route('/account/history', name: 'app_account_history')]
public function history(): Response
{
return $this->render('account/history.html.twig', [
]);
}
}

View file

@ -5,6 +5,7 @@ namespace App\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Attribute\Route;
use Symfony\Component\HttpFoundation\JsonResponse;
final class DefaultController extends AbstractController
{
@ -94,12 +95,15 @@ final class DefaultController extends AbstractController
#[Route('/logged/get-my-products', name: 'get_my_products')]
public function get_my_products(): Response
public function get_my_products(): JsonResponse
{
// TODO: replace this with actual logic to get products of the logged user
// récupérer les produits de l'user connecté
$products = $this->getUser()->get_my_products();
return $this->json([
'mock_response' => 'TODO',
'products' => $products,
'user' => $this->getUser(),
]);
}

View file

@ -0,0 +1,32 @@
<?php
namespace App\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\Security\Http\Authentication\AuthenticationUtils;
class SecurityController extends AbstractController
{
#[Route(path: '/login', name: 'app_login')]
public function login(AuthenticationUtils $authenticationUtils): Response
{
// get the login error if there is one
$error = $authenticationUtils->getLastAuthenticationError();
// last username entered by the user
$lastUsername = $authenticationUtils->getLastUsername();
return $this->render('security/login.html.twig', [
'last_username' => $lastUsername,
'error' => $error,
]);
}
#[Route(path: '/logout', name: 'app_logout')]
public function logout(): void
{
throw new \LogicException('This method can be blank - it will be intercepted by the logout key on your firewall.');
}
}