Commit 8de9bf6c authored by i.vasilenko@iq-adv.ru's avatar i.vasilenko@iq-adv.ru
Browse files

new autowire

parent 53020f82
Loading
Loading
Loading
Loading
+15 −0
Original line number Diff line number Diff line
@@ -41,6 +41,21 @@

## Инструкция

## Kafka
<details>
<summary>Инструкция</summary>

1. Создание топика
   1. Запустить команду - `make create-kafka-topic`
2. Запуск воркера
   1. Перейти в командную строку php - `make shell`
   2. Запустить команду - `bin/console messenger:consume send_transport`
3. Остановка воркера
   1. Перейти в командную строку php - `make shell`
   2. Запустить команду - `bin/console messenger:stop-workers`

</details>

## Настройка Xdebug (PHPStorm)
<details>
<summary>Инструкция</summary>
+1 −1
Original line number Diff line number Diff line
@@ -49,9 +49,9 @@ security:
        - { path: ^/api/register/send, roles: ROLE_USER }
        - { path: ^/api/register/check, roles: ROLE_USER }

        - { path: ^/api/password/reset/check, roles: PUBLIC_ACCESS }
        - { path: ^/api/password/reset, roles: ROLE_USER }
        - { path: ^/api/password/send, roles: PUBLIC_ACCESS }
        - { path: ^/api/password/reset/check, roles: PUBLIC_ACCESS }

        - { path: ^/api/profile/recovery, roles: PUBLIC_ACCESS }
        - { path: ^/api/profile/recovery/check, roles: PUBLIC_ACCESS }
+3 −64
Original line number Diff line number Diff line
@@ -25,67 +25,10 @@ services:
            - '../src/Entity/'
            - '../src/Kernel.php'

    # Сервисы действий
    App\Service\Action\ActionServiceInterface $registerService: '@App\Service\Action\Classes\Register'

    App\Service\Action\ActionServiceInterface $profileService: '@App\Service\Action\Classes\GetProfile'

    App\Service\Action\ActionServiceInterface $deleteProfileService: '@App\Service\Action\Classes\DeleteProfile'

    App\Service\Action\ActionServiceInterface $recoveryProfileService: '@App\Service\Action\Classes\RecoveryProfile'

    App\Service\Action\ActionServiceInterface $checkRegisterService: '@App\Service\Action\Classes\CheckRegisterCode'

    App\Service\Action\ActionServiceInterface $checkRecoveryService: '@App\Service\Action\Classes\CheckRecoveryCode'

    App\Service\Action\ActionServiceInterface $sendRegisterService: '@App\Service\Action\Classes\SendRegisterCode'

    App\Service\Action\ActionServiceInterface $sendPasswordCodeService: '@App\Service\Action\Classes\SendResetPasswordCode'

    App\Service\Action\ActionServiceInterface $resetPasswordCodeService: '@App\Service\Action\Classes\ResetPasswordCode'

    App\Service\Action\ActionServiceInterface $resetPasswordService: '@App\Service\Action\Classes\ResetPassword'

    App\Service\Action\ActionServiceInterface $profileChangeService: '@App\Service\Action\Classes\ChangeProfile'

    App\Service\Action\ActionServiceInterface $resetEmailService: '@App\Service\Action\Classes\ResetEmail'

    App\Service\Action\ActionServiceInterface $deleteImageService: '@App\Service\Action\Classes\DeleteImage'

    App\Service\Action\ActionServiceInterface $saveImageService: '@App\Service\Action\Classes\SaveImage'

    App\Service\Action\Classes\SaveImage:
        arguments:
            $targetDirectory: '%images_directory%'

    App\Service\Action\ActionServiceInterface: '@App\Service\Action\Classes\None'


    # Сервисы Dto
    App\Service\Dto\DtoServiceInterface $registerDto: '@App\Service\Dto\Classes\RegisterDto'

    App\Service\Dto\DtoServiceInterface $registerCodeDto: '@App\Service\Dto\Classes\RegisterCodeDto'

    App\Service\Dto\DtoServiceInterface $recoveryCodeDto: '@App\Service\Dto\Classes\RecoveryCodeDto'

    App\Service\Dto\DtoServiceInterface $passwordResetDto: '@App\Service\Dto\Classes\ResetPasswordCodeDto'

    App\Service\Dto\DtoServiceInterface $passwordDto: '@App\Service\Dto\Classes\ChangePasswordDto'

    App\Service\Dto\DtoServiceInterface $profileDto: '@App\Service\Dto\Classes\ChangeProfileDto'

    App\Service\Dto\DtoServiceInterface $recoveryDto: '@App\Service\Dto\Classes\RecoveryDto'

    App\Service\Dto\DtoServiceInterface $imageDto: '@App\Service\Dto\Classes\ImageDto'

    App\Service\Dto\DtoServiceInterface: '@App\Service\Dto\Classes\NoneDto'


    # Сервисы ответа
    App\Service\Response\ResponseServiceInterface $profileResponse: '@App\Service\Response\Classes\ProfileResponse'

    App\Service\Response\ResponseServiceInterface: '@App\Service\Response\Classes\Response'


    # Сервис отправки
    App\Service\Send\SendService:
@@ -93,13 +36,9 @@ services:
            $confirmType: '%confirm_type%'
            $fromEmail: '%from_email%'

    App\Service\Send\SendServiceInterface $codeSendService: '@App\Service\Send\Classes\CodeSendService'

    App\Service\Send\SendServiceInterface $registerCodeSendService: '@App\Service\Send\Classes\Code\RegisterCodeSendService'

    App\Service\Send\SendServiceInterface $recoveryCodeSendService: '@App\Service\Send\Classes\Code\RecoveryCodeSendService'

    App\Service\Send\SendServiceInterface $passwordCodeSendService: '@App\Service\Send\Classes\Code\PasswordCodeSendService'
    App\Listeners\KernelExceptionListener:
        tags:
            - { name: kernel.event_listener, event: kernel.exception }

    # События JWT авторизации
    acme_api.event.authentication_success_listener:
+25 −12
Original line number Diff line number Diff line
@@ -11,6 +11,7 @@ use App\Service\Dto\Classes\ResetPasswordCodeDto;
use App\Service\Response\Classes\Response;
use Nelmio\ApiDocBundle\Annotation\Model;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\DependencyInjection\Attribute\Autowire;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\Routing\Attribute\Route;
use OpenApi\Attributes as OA;
@@ -31,18 +32,20 @@ class AuthController extends AbstractController
        content: new OA\JsonContent(ref: new Model(type: RegisterDto::class))
    )]
    public function register(
        ActionServiceInterface $registerService
        #[Autowire(service: 'action.register')]
        ActionServiceInterface $actionService
    ): JsonResponse
    {
        return $registerService->getResponse();
        return $actionService->getResponse();
    }

    #[Route('/register/send', name: 'register_send', methods: ['GET'])]
    public function sendRegisterCode(
        ActionServiceInterface $sendRegisterService,
        #[Autowire(service: 'action.register.send')]
        ActionServiceInterface $actionService,
    ): JsonResponse
    {
        return $sendRegisterService->getResponse();
        return $actionService->getResponse();
    }

    #[Route('/register/check', name: 'register_check', methods: ['POST'])]
@@ -50,36 +53,46 @@ class AuthController extends AbstractController
        content: new OA\JsonContent(ref: new Model(type: RegisterCodeDto::class))
    )]
    public function checkRegisterCode(
        ActionServiceInterface $checkRegisterService
        #[Autowire(service: 'action.register.code')]
        ActionServiceInterface $actionService
    ): JsonResponse
    {
        return $checkRegisterService->getResponse();
        return $actionService->getResponse();
    }

    #[Route('/password/reset', name: 'password_reset', methods: ['POST'])]
    #[OA\RequestBody(
        content: new OA\JsonContent(ref: new Model(type: ChangePasswordDto::class))
    )]
    public function resetPassword(ActionServiceInterface $resetPasswordService): JsonResponse
    public function resetPassword(
        #[Autowire(service: 'action.reset.password.change')]
        ActionServiceInterface $actionService
    ): JsonResponse
    {
        return $resetPasswordService->getResponse();
        return $actionService->getResponse();
    }

    #[Route('/password/send', name: 'password_send', methods: ['POST'])]
    #[OA\RequestBody(
        content: new OA\JsonContent(ref: new Model(type: RecoveryDto::class))
    )]
    public function sendResetPassword(ActionServiceInterface $sendPasswordCodeService): JsonResponse
    public function sendResetPassword(
        #[Autowire(service: 'action.reset.password.send')]
        ActionServiceInterface $actionService
    ): JsonResponse
    {
        return $sendPasswordCodeService->getResponse();
        return $actionService->getResponse();
    }

    #[Route('/password/reset/check', name: 'password_reset_check', methods: ['POST'])]
    #[OA\RequestBody(
        content: new OA\JsonContent(ref: new Model(type: ResetPasswordCodeDto::class))
    )]
    public function resetCheckPassword(ActionServiceInterface $resetPasswordCodeService): JsonResponse
    public function resetCheckPassword(
        #[Autowire(service: 'action.reset.password.code')]
        ActionServiceInterface $actionService
    ): JsonResponse
    {
        return $resetPasswordCodeService->getResponse();
        return $actionService->getResponse();
    }
}
+25 −16
Original line number Diff line number Diff line
@@ -11,6 +11,7 @@ use App\Service\Response\Classes\ProfileResponse;
use App\Service\Response\Classes\Response;
use Nelmio\ApiDocBundle\Annotation\Model;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\DependencyInjection\Attribute\Autowire;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\Routing\Attribute\Route;
use OpenApi\Attributes as OA;
@@ -28,10 +29,11 @@ class ProfileController extends AbstractController
        )
    )]
    public function profile(
        ActionServiceInterface $profileService
        #[Autowire(service: 'action.profile')]
        ActionServiceInterface $actionService
    ): JsonResponse
    {
        return $profileService->getResponse();
        return $actionService->getResponse();
    }

    #[Route('/profile/delete', name: 'profile_delete', methods: ['GET'])]
@@ -43,10 +45,11 @@ class ProfileController extends AbstractController
        )
    )]
    public function deleteProfile(
        ActionServiceInterface $deleteProfileService,
        #[Autowire(service: 'action.profile.delete')]
        ActionServiceInterface $actionService,
    ): JsonResponse
    {
        return $deleteProfileService->getResponse();
        return $actionService->getResponse();
    }

    #[Route('/profile/recovery', name: 'profile_recovery', methods: ['POST'])]
@@ -61,10 +64,11 @@ class ProfileController extends AbstractController
        )
    )]
    public function recoveryProfile(
        ActionServiceInterface $recoveryProfileService,
        #[Autowire(service: 'action.recovery.send')]
        ActionServiceInterface $actionService,
    ): JsonResponse
    {
        return $recoveryProfileService->getResponse();
        return $actionService->getResponse();
    }

    #[Route('/profile/recovery/check', name: 'profile_recovery_check', methods: ['POST'])]
@@ -79,10 +83,11 @@ class ProfileController extends AbstractController
        )
    )]
    public function recoveryCodeProfile(
        ActionServiceInterface $checkRecoveryService,
        #[Autowire(service: 'action.recovery.code')]
        ActionServiceInterface $actionService,
    ): JsonResponse
    {
        return $checkRecoveryService->getResponse();
        return $actionService->getResponse();
    }

    #[Route('/profile/change', name: 'profile_change', methods: ['POST'])]
@@ -97,10 +102,11 @@ class ProfileController extends AbstractController
        )
    )]
    public function changeProfile(
        ActionServiceInterface $profileChangeService,
        #[Autowire(service: 'action.profile.change')]
        ActionServiceInterface $actionService,
    ): JsonResponse
    {
        return $profileChangeService->getResponse();
        return $actionService->getResponse();
    }

    #[Route('/profile/reset/email', name: 'profile_reset_email', methods: ['GET'])]
@@ -112,10 +118,11 @@ class ProfileController extends AbstractController
        )
    )]
    public function resetLastConfirmEmail(
        ActionServiceInterface $resetEmailService,
        #[Autowire(service: 'action.reset.email')]
        ActionServiceInterface $actionService,
    ): JsonResponse
    {
        return $resetEmailService->getResponse();
        return $actionService->getResponse();
    }

    #[Route('/profile/image', name: 'profile_image', methods: ['POST'])]
@@ -130,10 +137,11 @@ class ProfileController extends AbstractController
        )
    )]
    public function saveImage(
        ActionServiceInterface $saveImageService,
        #[Autowire(service: 'action.profile.image.save')]
        ActionServiceInterface $actionService,
    ): JsonResponse
    {
        return $saveImageService->getResponse();
        return $actionService->getResponse();
    }

    #[Route('/profile/image/delete', name: 'profile_image_delete', methods: ['GET'])]
@@ -145,9 +153,10 @@ class ProfileController extends AbstractController
        )
    )]
    public function deleteImage(
        ActionServiceInterface $deleteImageService,
        #[Autowire(service: 'action.profile.image.delete')]
        ActionServiceInterface $actionService,
    ): JsonResponse
    {
        return $deleteImageService->getResponse();
        return $actionService->getResponse();
    }
}
Loading