Newer
Older
<?php
namespace App\Controller;
use App\Service\Action\ActionServiceInterface;
use App\Service\Dto\Classes\RegisterCodeDto;
use App\Service\Dto\Classes\RegisterDto;
use App\Service\Response\Classes\Response;
use Nelmio\ApiDocBundle\Annotation\Model;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\Routing\Attribute\Route;
#[OA\Tag(name: 'Авторизация')]
#[OA\Response(
response: 200,
description: 'Ответ',
content: new OA\JsonContent(
ref: new Model(type: Response::class, groups: ["message"])
)
)]
class AuthController extends AbstractController
{
#[Route('/register', name: 'register', methods: ['POST'])]
#[OA\RequestBody(
content: new OA\JsonContent(ref: new Model(type: RegisterDto::class))
)]
public function register(
ActionServiceInterface $registerService
): JsonResponse
{
return $registerService->getResponse();
}
#[Route('/register/send', name: 'register_send', methods: ['GET'])]
public function sendRegisterCode(
ActionServiceInterface $sendRegisterService,
): JsonResponse
{
return $sendRegisterService->getResponse();
}
#[Route('/register/check', name: 'register_check', methods: ['POST'])]
#[OA\RequestBody(
content: new OA\JsonContent(ref: new Model(type: RegisterCodeDto::class))
)]
public function checkRegisterCode(
ActionServiceInterface $checkRegisterService
): JsonResponse
{
return $checkRegisterService->getResponse();
}