mirror of
https://forge.chapril.org/tykayn/caisse-bliss
synced 2025-10-09 17:02:47 +02:00
up schema
This commit is contained in:
parent
17e7fce7f8
commit
8e2da4f159
20 changed files with 879 additions and 4 deletions
27
src/Controller/AccountController.php
Normal file
27
src/Controller/AccountController.php
Normal 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', [
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
|
@ -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(),
|
||||
]);
|
||||
}
|
||||
|
||||
|
|
|
|||
32
src/Controller/SecurityController.php
Normal file
32
src/Controller/SecurityController.php
Normal 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.');
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue