71
Some checks failed
Deploy Production / Deploy to Staging (push) Has been skipped
Go Linter / Run golangci-lint (api_gateway) (push) Failing after 2m31s
Go Linter / Build golang services (api_gateway) (push) Has been skipped
Go Linter / Tag Commit (push) Has been skipped
Go Linter / Push Docker Images (api_gateway) (push) Has been skipped
Some checks failed
Deploy Production / Deploy to Staging (push) Has been skipped
Go Linter / Run golangci-lint (api_gateway) (push) Failing after 2m31s
Go Linter / Build golang services (api_gateway) (push) Has been skipped
Go Linter / Tag Commit (push) Has been skipped
Go Linter / Push Docker Images (api_gateway) (push) Has been skipped
This commit is contained in:
@@ -26,6 +26,17 @@ import (
|
||||
// LOGIN USER
|
||||
// ------------------------------
|
||||
|
||||
// @Summary Вход пользователя
|
||||
// @Description Аутентификация пользователя по email и паролю
|
||||
// @Tags auth
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param request body rmodel.LoginUserRequest true "Данные для входа"
|
||||
// @Success 200 {object} rmodel.LoginUserResponse "Успешная аутентификация"
|
||||
// @Failure 400 {object} map[string]string "Неверные данные запроса"
|
||||
// @Failure 401 {object} map[string]string "Неверные учетные данные"
|
||||
// @Failure 500 {object} map[string]string "Внутренняя ошибка сервера"
|
||||
// @Router /api/v1/login [post]
|
||||
func (h *handler) loginHandler(w http.ResponseWriter, r *http.Request) {
|
||||
const handlerName = "loginHandler"
|
||||
|
||||
@@ -110,6 +121,17 @@ func (h *handler) loginHandler(w http.ResponseWriter, r *http.Request) {
|
||||
// REGISTER USER
|
||||
// ------------------------------
|
||||
|
||||
// @Summary Регистрация пользователя
|
||||
// @Description Создание нового пользователя в системе
|
||||
// @Tags auth
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param request body rmodel.UserCredentials true "Данные для регистрации"
|
||||
// @Success 201 {object} rmodel.RegisterResponse "Пользователь успешно создан"
|
||||
// @Failure 400 {object} map[string]string "Неверные данные запроса"
|
||||
// @Failure 409 {object} map[string]string "Пользователь уже существует"
|
||||
// @Failure 500 {object} map[string]string "Внутренняя ошибка сервера"
|
||||
// @Router /api/v1/register [post]
|
||||
func (h *handler) registerHandler(w http.ResponseWriter, r *http.Request) {
|
||||
const handlerName = "registerHandler"
|
||||
|
||||
@@ -301,6 +323,17 @@ func (h *handler) saveUser(ctx context.Context, uid string, creds rmodel.UserCre
|
||||
// LOGOUT USER
|
||||
// ------------------------------
|
||||
|
||||
// @Summary Выход пользователя
|
||||
// @Description Завершение сессии пользователя
|
||||
// @Tags auth
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param request body rmodel.LogoutUserRequest true "Токен для выхода"
|
||||
// @Success 200 "Успешный выход"
|
||||
// @Failure 400 {object} map[string]string "Неверные данные запроса"
|
||||
// @Failure 401 {object} map[string]string "Неверный токен"
|
||||
// @Failure 500 {object} map[string]string "Внутренняя ошибка сервера"
|
||||
// @Router /api/v1/logout [post]
|
||||
func (h *handler) logoutHandler(w http.ResponseWriter, r *http.Request) {
|
||||
const handlerName = "logoutHandler"
|
||||
|
||||
@@ -327,6 +360,17 @@ func (h *handler) logoutHandler(w http.ResponseWriter, r *http.Request) {
|
||||
// REFRESH USER TOKEN
|
||||
// ------------------------------
|
||||
|
||||
// @Summary Обновление токена доступа
|
||||
// @Description Получение нового access token по refresh token
|
||||
// @Tags auth
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param request body rmodel.RefreshTokenRequest true "Refresh token"
|
||||
// @Success 200 {object} rmodel.RefreshTokenResponse "Новые токены"
|
||||
// @Failure 400 {object} map[string]string "Неверные данные запроса"
|
||||
// @Failure 401 {object} map[string]string "Неверный refresh token"
|
||||
// @Failure 500 {object} map[string]string "Внутренняя ошибка сервера"
|
||||
// @Router /api/v1/refresh-token [post]
|
||||
func (h *handler) refreshTokenHandler(w http.ResponseWriter, r *http.Request) {
|
||||
const handlerName = "refreshTokenHandler"
|
||||
|
||||
@@ -362,6 +406,17 @@ func (h *handler) refreshTokenHandler(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
}
|
||||
|
||||
// @Summary Страница подтверждения email
|
||||
// @Description HTML страница для подтверждения email адреса пользователя
|
||||
// @Tags auth
|
||||
// @Accept html
|
||||
// @Produce html
|
||||
// @Param uid query string true "ID пользователя"
|
||||
// @Param token query string true "Токен подтверждения"
|
||||
// @Success 200 {string} string "HTML страница подтверждения"
|
||||
// @Failure 400 {object} map[string]string "Неверные параметры запроса"
|
||||
// @Failure 500 {object} map[string]string "Внутренняя ошибка сервера"
|
||||
// @Router /api/v1/confirm_email [get]
|
||||
func (h *handler) confirmEmailPageHandler(w http.ResponseWriter, r *http.Request) {
|
||||
const handlerName = "confirmEmailPageHandler"
|
||||
|
||||
@@ -418,6 +473,16 @@ func (h *handler) confirmEmailPageHandler(w http.ResponseWriter, r *http.Request
|
||||
// RESET PASSWORD
|
||||
// ------------------------------
|
||||
|
||||
// @Summary Запрос восстановления пароля
|
||||
// @Description Отправка OTP кода на email для восстановления пароля
|
||||
// @Tags auth
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param request body rmodel.ForgotPasswordRequest true "Данные для восстановления пароля"
|
||||
// @Success 200 {object} map[string]string "OTP код отправлен"
|
||||
// @Failure 400 {object} map[string]string "Неверные данные запроса"
|
||||
// @Failure 500 {object} map[string]string "Внутренняя ошибка сервера"
|
||||
// @Router /api/v1/forgot_password [post]
|
||||
func (h *handler) forgotPasswordHandler(w http.ResponseWriter, r *http.Request) {
|
||||
const handlerName = "forgotPasswordHandler"
|
||||
|
||||
@@ -475,6 +540,17 @@ func (h *handler) forgotPasswordHandler(w http.ResponseWriter, r *http.Request)
|
||||
w.WriteHeader(http.StatusCreated)
|
||||
}
|
||||
|
||||
// @Summary Валидация OTP кода
|
||||
// @Description Проверка OTP кода для восстановления пароля
|
||||
// @Tags auth
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param otp query string true "OTP код"
|
||||
// @Param email query string true "Email пользователя"
|
||||
// @Success 200 {object} map[string]string "OTP код валиден"
|
||||
// @Failure 400 {object} map[string]string "Неверные параметры запроса"
|
||||
// @Failure 500 {object} map[string]string "Внутренняя ошибка сервера"
|
||||
// @Router /api/v1/validate_otp [get]
|
||||
func (h *handler) validateOTPHandler(w http.ResponseWriter, r *http.Request) {
|
||||
const handlerName = "validateOTPHandler"
|
||||
|
||||
@@ -519,6 +595,16 @@ func (h *handler) validateOTPHandler(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
}
|
||||
|
||||
// @Summary Сброс пароля
|
||||
// @Description Установка нового пароля после валидации OTP кода
|
||||
// @Tags auth
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param request body rmodel.ResetPasswordRequest true "Данные для сброса пароля"
|
||||
// @Success 200 {object} map[string]string "Пароль успешно изменен"
|
||||
// @Failure 400 {object} map[string]string "Неверные данные запроса"
|
||||
// @Failure 500 {object} map[string]string "Внутренняя ошибка сервера"
|
||||
// @Router /api/v1/reset_password [put]
|
||||
func (h *handler) resetPasswordHandler(w http.ResponseWriter, r *http.Request) {
|
||||
const handlerName = "resetPasswordHandler"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user