From da97a677971ed8d86ad820bcf72c9c6915168f9c Mon Sep 17 00:00:00 2001 From: iIronside Date: Wed, 1 Nov 2023 14:59:52 +0300 Subject: [PATCH] change url rule for userTgBotController --- frontend/config/main.php | 28 ------------------- .../api/controllers/UserTgBotController.php | 14 +++++----- 2 files changed, 7 insertions(+), 35 deletions(-) diff --git a/frontend/config/main.php b/frontend/config/main.php index 3c6ec8f..49c31ea 100755 --- a/frontend/config/main.php +++ b/frontend/config/main.php @@ -50,23 +50,6 @@ return [ ], ], ], - 'corsFilter' => [ - 'class' => GsCors::class, - 'cors' => [ - 'Origin' => ['*'], - //'Access-Control-Allow-Credentials' => true, - 'Access-Control-Allow-Headers' => [ - 'Access-Control-Allow-Origin', - 'Access-Control-Allow-Methods', - 'Content-Type', - 'Access-Control-Allow-Headers', - 'Authorization', - 'X-Requested-With' - ], - 'Access-Control-Allow-Methods' => ['POST', 'GET', 'PUT', 'PATCH', 'DELETE', 'OPTIONS'], - 'Access-Control-Request-Method' => ['POST', 'GET', 'PUT', 'PATCH', 'DELETE', 'OPTIONS'], - ] - ], 'request' => [ 'csrfParam' => '_csrf-frontend', 'baseUrl' => '', @@ -106,17 +89,6 @@ return [ 'api/reports/' => 'api/reports/view', '' => 'card/user-card/index', - - 'GET api/tg-bot/token' => 'api/user-tg-bot/get-token', - 'GET api/tg-bot/user' => 'api/user-tg-bot/get-user', - - 'POST api/tg-bot/dialog/create' => 'api/user-tg-bot/set-dialog', - 'GET api/tg-bot/dialog/user/id' => 'api/user-tg-bot/get-user-id-by-dialog-id', - 'GET api/tg-bot/dialog/dialog/id' => 'api/user-tg-bot/get-dialog-id-by-user-id', - - 'GET api/tg-bot/auth' => 'api/user-tg-bot/auth', - - ['class' => 'yii\rest\UrlRule', 'controller' => 'skills'], ], ], diff --git a/frontend/modules/api/controllers/UserTgBotController.php b/frontend/modules/api/controllers/UserTgBotController.php index f17d19b..7ab2b31 100644 --- a/frontend/modules/api/controllers/UserTgBotController.php +++ b/frontend/modules/api/controllers/UserTgBotController.php @@ -29,7 +29,7 @@ class UserTgBotController extends ApiController } /** - * @OA\Get(path="/tg-bot/token", + * @OA\Get(path="/user-tg-bot/get-token", * summary="Токен ТГ бота", * description="Метод для возвращает токен для ТГ бота", * security={ @@ -56,7 +56,7 @@ class UserTgBotController extends ApiController /** * - * @OA\Get(path="/tg-bot/user", + * @OA\Get(path="/user-tg-bot/get-user", * summary="Получить данные пользователя", * description="Метод для получения данныех пользователя по токену ТГ бота", * security={ @@ -93,7 +93,7 @@ class UserTgBotController extends ApiController /** * - * @OA\Post(path="/tg-bot/dialog/create", + * @OA\Post(path="/user-tg-bot/set-dialog", * summary="Сохранить новый id диалога", * description="Метод создает новую запись с id пользователя и id диалога", * security={ @@ -139,7 +139,7 @@ class UserTgBotController extends ApiController /** * - * @OA\Get(path="/tg-bot/dialog/dialog/id", + * @OA\Get(path="/user-tg-bot/dialog/get-dialog-id", * summary="Получить id диалога по id пользователя", * description="Метод для получения id пользователя по id пользователя", * security={ @@ -169,14 +169,14 @@ class UserTgBotController extends ApiController * @return array * @throws Exception */ - public function actionGetDialogIdByUserId(string $userId): array + public function actionGetDialogId(string $userId): array { return $this->userTgBotTokenService->getDialogIdByUserId($userId); } /** * - * @OA\Get(path="/tg-bot/dialog/user/id", + * @OA\Get(path="/user-tg-bot/get-user-id", * summary="Получить id пользователя по id диалога", * description="Метод для получения id пользователя по id диалога", * security={ @@ -206,7 +206,7 @@ class UserTgBotController extends ApiController * @return array * @throws Exception */ - public function actionGetUserIdByDialogId(string $dialogId): array + public function actionGetUserId(string $dialogId): array { return $this->userTgBotTokenService->getUserIdByDialogId($dialogId); }