Newer
Older
<?php
namespace App\Controller;
use App\Service\Action\ActionServiceInterface;
use App\Service\Dto\Classes\RecoveryCodeDto;
use App\Service\Dto\Classes\RecoveryDto;
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;
class ProfileController extends AbstractController
{
#[Route('/profile', name: 'profile', methods: ['GET'])]
#[OA\Response(
response: 200,
description: 'Ответ',
content: new OA\JsonContent(
ref: new Model(type: ProfileResponse::class, groups: ["message", "data", "profile"])
)
)]
#[Autowire(service: 'action.profile')]
ActionServiceInterface $actionService
}
#[Route('/profile/delete', name: 'profile_delete', methods: ['GET'])]
#[OA\Response(
response: 200,
description: 'Ответ',
content: new OA\JsonContent(
ref: new Model(type: Response::class, groups: ["message"])
)
)]
#[Autowire(service: 'action.profile.delete')]
ActionServiceInterface $actionService,
}
#[Route('/profile/recovery', name: 'profile_recovery', methods: ['POST'])]
#[OA\RequestBody(
content: new OA\JsonContent(ref: new Model(type: RecoveryDto::class))
)]
#[OA\Response(
response: 200,
description: 'Ответ',
content: new OA\JsonContent(
ref: new Model(type: Response::class, groups: ["message"])
)
)]
#[Autowire(service: 'action.recovery.send')]
ActionServiceInterface $actionService,
}
#[Route('/profile/recovery/check', name: 'profile_recovery_check', methods: ['POST'])]
#[OA\RequestBody(
content: new OA\JsonContent(ref: new Model(type: RecoveryCodeDto::class))
)]
#[OA\Response(
response: 200,
description: 'Ответ',
content: new OA\JsonContent(
ref: new Model(type: Response::class, groups: ["message"])
)
)]
#[Autowire(service: 'action.recovery.code')]
ActionServiceInterface $actionService,
#[Route('/profile/change', name: 'profile_change', methods: ['POST'])]
#[OA\RequestBody(
content: new OA\JsonContent(ref: new Model(type: ChangeProfileDto::class))
)]
#[OA\Response(
response: 200,
description: 'Ответ',
content: new OA\JsonContent(
ref: new Model(type: ProfileResponse::class, groups: ["message", "data", "profile"])
)
)]
public function changeProfile(
#[Autowire(service: 'action.profile.change')]
ActionServiceInterface $actionService,
}
#[Route('/profile/reset/email', name: 'profile_reset_email', methods: ['GET'])]
#[OA\Response(
response: 200,
description: 'Ответ',
content: new OA\JsonContent(
ref: new Model(type: Response::class, groups: ["message"])
)
)]
public function resetLastConfirmEmail(
#[Autowire(service: 'action.reset.email')]
ActionServiceInterface $actionService,
#[Route('/profile/image', name: 'profile_image', methods: ['POST'])]
#[OA\RequestBody(
content: new OA\JsonContent(ref: new Model(type: ImageDto::class))
)]
#[OA\Response(
response: 200,
description: 'Ответ',
content: new OA\JsonContent(
ref: new Model(type: Response::class, groups: ["message"])
)
)]
public function saveImage(
#[Autowire(service: 'action.profile.image.save')]
ActionServiceInterface $actionService,
}
#[Route('/profile/image/delete', name: 'profile_image_delete', methods: ['GET'])]
#[OA\Response(
response: 200,
description: 'Ответ',
content: new OA\JsonContent(
ref: new Model(type: Response::class, groups: ["message"])
)
)]
public function deleteImage(
#[Autowire(service: 'action.profile.image.delete')]
ActionServiceInterface $actionService,