MSP-8974 update doc
This commit is contained in:
1 parent
3e707244dd
commit
2f29af5e76
11 files changed
+395
-194
No files matched your search
+12
-13
@@ -29,13 +29,14 @@ func NewAudit(service AuditService) Audit {
|
||||
// All
|
||||
// @Tags log
|
||||
// @Summary Получение списка логов
|
||||
// @Description `errorCode: 400` - если тело запроса невалидно
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param X-AUTH-ADMIN header string true "Токен администратора"
|
||||
// @Param body body domain.AuditPageRequest true "Тело запроса"
|
||||
// @Param body body domain.AuditPageRequest true "Тело запроса (пагинация, сортировка, фильтры)"
|
||||
// @Success 200 {object} domain.AuditResponse
|
||||
// @Failure 400 {object} domain.GrpcError "Невалидное тело запроса"
|
||||
// @Failure 500 {object} domain.GrpcError
|
||||
// @Failure 400 {object} apierrors.Error "Невалидное тело запроса"
|
||||
// @Failure 500 {object} apierrors.Error
|
||||
// @Router /log/all [POST]
|
||||
func (c Audit) All(ctx context.Context, req domain.AuditPageRequest) (*domain.AuditResponse, error) {
|
||||
if req.Order == nil {
|
||||
@@ -50,15 +51,13 @@ func (c Audit) All(ctx context.Context, req domain.AuditPageRequest) (*domain.Au
|
||||
|
||||
// Events
|
||||
// @Tags log
|
||||
// @Summary Получение списка логов
|
||||
// @Summary Получение списка событий аудита
|
||||
// @Description Возвращает полный список доступных событий аудита
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param X-AUTH-ADMIN header string true "Токен администратора"
|
||||
// @Param body body domain.AuditResponse true "Тело запроса"
|
||||
// @Success 200 {array} domain.AuditEvent
|
||||
// @Failure 400 {object} domain.GrpcError "Невалидное тело запроса"
|
||||
// @Failure 500 {object} domain.GrpcError
|
||||
// @Failure 500 {object} apierrors.Error
|
||||
// @Router /log/events [POST]
|
||||
func (c Audit) Events(ctx context.Context) ([]domain.AuditEvent, error) {
|
||||
return c.service.Events(ctx)
|
||||
@@ -66,15 +65,15 @@ func (c Audit) Events(ctx context.Context) ([]domain.AuditEvent, error) {
|
||||
|
||||
// SetEvents
|
||||
// @Tags log
|
||||
// @Summary Получение списка логов
|
||||
// @Description Всегда возвращает полный список доступных событий аудита
|
||||
// @Summary Установить события аудита
|
||||
// @Description Устанавливает (обновляет) набор активных событий аудита. `errorCode: <UnknownAuditEventErrorCode>` - если передано неизвестное событие аудита
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param X-AUTH-ADMIN header string true "Токен администратора"
|
||||
// @Param body body domain.SetAuditEvent true "Тело запроса"
|
||||
// @Success 200
|
||||
// @Failure 400 {object} domain.GrpcError "Невалидное тело запроса"
|
||||
// @Failure 500 {object} domain.GrpcError
|
||||
// @Param body body []domain.SetAuditEvent true "Список событий аудита для установки"
|
||||
// @Success 200 {object} map[string]interface{} "События успешно установлены"
|
||||
// @Failure 400 {object} apierrors.Error "Неизвестное событие аудита"
|
||||
// @Failure 500 {object} apierrors.Error
|
||||
// @Router /log/set_events [POST]
|
||||
func (c Audit) SetEvents(ctx context.Context, req []domain.SetAuditEvent) error {
|
||||
err := c.service.SetEvents(ctx, req)
|
||||
|
||||
+15
-14
@@ -38,9 +38,9 @@ func NewAuth(authService authService, logger log.Logger) Auth {
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param X-AUTH-ADMIN header string true "Токен администратора"
|
||||
// @Success 200
|
||||
// @Failure 400 {object} domain.GrpcError "Невалидный токен"
|
||||
// @Failure 500 {object} domain.GrpcError
|
||||
// @Success 200 {object} map[string]interface{} "Успешный выход"
|
||||
// @Failure 400 {object} apierrors.Error "Невалидный токен"
|
||||
// @Failure 500 {object} apierrors.Error
|
||||
// @Router /auth/logout [POST]
|
||||
func (a Auth) Logout(ctx context.Context, r *http.Request) error {
|
||||
adminId, err := getAdminId(r)
|
||||
@@ -62,11 +62,11 @@ func (a Auth) Logout(ctx context.Context, r *http.Request) error {
|
||||
// @Description Выход по бездействию из авторизованной сессии администрирования
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param body body domain.LogoutRequest true "Тело запроса"
|
||||
// @Param X-AUTH-ADMIN header string true "Токен администратора"
|
||||
// @Success 200
|
||||
// @Failure 400 {object} domain.GrpcError "Невалидный токен"
|
||||
// @Failure 500 {object} domain.GrpcError
|
||||
// @Param body body domain.LogoutRequest true "Тело запроса"
|
||||
// @Success 200 {object} map[string]interface{} "Успешный выход"
|
||||
// @Failure 400 {object} apierrors.Error "Невалидный токен"
|
||||
// @Failure 500 {object} apierrors.Error
|
||||
// @Router /auth/logout_with_reason [POST]
|
||||
func (a Auth) LogoutWithReason(ctx context.Context, logoutRequest domain.LogoutRequest, r *http.Request) error {
|
||||
adminId, err := getAdminId(r)
|
||||
@@ -90,9 +90,10 @@ func (a Auth) LogoutWithReason(ctx context.Context, logoutRequest domain.LogoutR
|
||||
// @Produce json
|
||||
// @Param body body domain.LoginRequest true "Тело запроса"
|
||||
// @Success 200 {object} domain.LoginResponse
|
||||
// @Failure 400 {object} domain.GrpcError
|
||||
// @Failure 401 {object} domain.GrpcError "Данные для авторизации не верны"
|
||||
// @Failure 500 {object} domain.GrpcError
|
||||
// @Failure 400 {object} apierrors.Error
|
||||
// @Failure 401 {object} apierrors.Error "Данные для авторизации не верны"
|
||||
// @Failure 429 {object} apierrors.Error "Слишком много запросов на авторизацию"
|
||||
// @Failure 500 {object} apierrors.Error
|
||||
// @Router /auth/login [POST]
|
||||
func (a Auth) Login(ctx context.Context, authRequest domain.LoginRequest) (*domain.LoginResponse, error) {
|
||||
auth, err := a.authService.Login(ctx, authRequest)
|
||||
@@ -115,14 +116,14 @@ func (a Auth) Login(ctx context.Context, authRequest domain.LoginRequest) (*doma
|
||||
// LoginWithOauth
|
||||
// @Tags auth
|
||||
// @Summary Авторизация по авторизационному коду от OAuth
|
||||
// @Description Авторизация с получением токена администратора
|
||||
// @Description Авторизация с получением токена администратора. `errorCode: <ErrOauthIsMissedCode>` - OAuth не настроен, `<ErrUnauthenticatedCode>` - неверный код или неизвестный клиент
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param body body domain.LoginOauthRequest true "Тело запроса"
|
||||
// @Success 200 {object} domain.LoginResponse
|
||||
// @Failure 401 {object} domain.GrpcError "Некорректный код для авторизации или неизвестное название клиента"
|
||||
// @Failure 412 {object} domain.GrpcError "Авторизация OAuth не настроена на сервере"
|
||||
// @Failure 500 {object} domain.GrpcError
|
||||
// @Failure 400 {object} apierrors.Error "Авторизация OAuth не настроена на сервере"
|
||||
// @Failure 401 {object} apierrors.Error "Некорректный код для авторизации или неизвестное название клиента"
|
||||
// @Failure 500 {object} apierrors.Error
|
||||
// @Router /auth/login_with_oauth [POST]
|
||||
func (a Auth) LoginWithOauth(ctx context.Context, request domain.LoginOauthRequest) (*domain.LoginResponse, error) {
|
||||
auth, err := a.authService.LoginWithOauth(ctx, request)
|
||||
|
||||
@@ -26,8 +26,8 @@ func NewCustomization(uiCfg conf.UIDesign) Customization {
|
||||
// @Produce json
|
||||
// @Param X-AUTH-ADMIN header string true "Токен администратора"
|
||||
// @Success 200 {object} domain.UIDesign
|
||||
// @Failure 400 {object} domain.GrpcError "Невалидный токен"
|
||||
// @Failure 500 {object} domain.GrpcError
|
||||
// @Failure 400 {object} apierrors.Error "Невалидный токен"
|
||||
// @Failure 500 {object} apierrors.Error
|
||||
// @Router /user/get_design [POST]
|
||||
func (c Customization) GetUIDesign() (domain.UIDesign, error) {
|
||||
return c.uiCfg, nil
|
||||
|
||||
@@ -33,7 +33,7 @@ func NewDownload(service DownloadService) Download {
|
||||
// @Produce json
|
||||
// @Param body body domain.UsersDownloadRequest true "Тело запроса"
|
||||
// @Success 200
|
||||
// @Failure 500 {object} domain.BusinessError "Внутренняя ошибка сервиса ```{errorCode: -1}```"
|
||||
// @Failure 500 {object} apierrors.Error "Внутренняя ошибка сервиса ```{errorCode: -1}```"
|
||||
// @Router /user/download [POST]
|
||||
func (c Download) Users(ctx context.Context, req domain.UsersDownloadRequest, w http.ResponseWriter) error {
|
||||
err := c.service.DownloadUsers(ctx, req, w)
|
||||
@@ -51,7 +51,7 @@ func (c Download) Users(ctx context.Context, req domain.UsersDownloadRequest, w
|
||||
// @Produce json
|
||||
// @Param body body domain.SessionDownloadRequest true "Тело запроса"
|
||||
// @Success 200
|
||||
// @Failure 500 {object} domain.BusinessError "Внутренняя ошибка сервиса ```{errorCode: -1}```"
|
||||
// @Failure 500 {object} apierrors.Error "Внутренняя ошибка сервиса ```{errorCode: -1}```"
|
||||
// @Router /session/download [POST]
|
||||
func (c Download) Sessions(ctx context.Context, req domain.SessionDownloadRequest, w http.ResponseWriter) error {
|
||||
err := c.service.DownloadSessions(ctx, req, w)
|
||||
@@ -69,7 +69,7 @@ func (c Download) Sessions(ctx context.Context, req domain.SessionDownloadReques
|
||||
// @Produce json
|
||||
// @Param body body domain.AuditDownloadRequest true "Тело запроса"
|
||||
// @Success 200
|
||||
// @Failure 500 {object} domain.BusinessError "Внутренняя ошибка сервиса ```{errorCode: -1}```"
|
||||
// @Failure 500 {object} apierrors.Error "Внутренняя ошибка сервиса ```{errorCode: -1}```"
|
||||
// @Router /log/download [POST]
|
||||
func (c Download) Audit(ctx context.Context, req domain.AuditDownloadRequest, w http.ResponseWriter) error {
|
||||
err := c.service.DownloadAudit(ctx, req, w)
|
||||
@@ -86,7 +86,7 @@ func (c Download) Audit(ctx context.Context, req domain.AuditDownloadRequest, w
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Success 200
|
||||
// @Failure 500 {object} domain.BusinessError "Внутренняя ошибка сервиса ```{errorCode: -1}```"
|
||||
// @Failure 500 {object} apierrors.Error "Внутренняя ошибка сервиса ```{errorCode: -1}```"
|
||||
// @Router /role/download [POST]
|
||||
func (c Download) Roles(ctx context.Context, w http.ResponseWriter) error {
|
||||
err := c.service.DownloadRoles(ctx, w)
|
||||
|
||||
@@ -22,11 +22,12 @@ func NewPermissions(permissionsService permissionsService) Permissions {
|
||||
|
||||
// GetPermissions
|
||||
// @Tags user
|
||||
// @Summary Получить все разрашения
|
||||
// @Description Получить все разрашения
|
||||
// @Summary Получить все разрешения
|
||||
// @Description Получить все разрешения
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Success 200 {array} domain.Permission
|
||||
// @Failure 500 {object} apierrors.Error
|
||||
// @Router /user/get_permissions [POST]
|
||||
func (u Permissions) GetPermissions(ctx context.Context) []domain.Permission {
|
||||
return u.permissionsService.All(ctx)
|
||||
|
||||
+12
-12
@@ -36,8 +36,8 @@ func NewRole(roleService roleService) Role {
|
||||
// @Param X-AUTH-ADMIN header string true "Токен администратора"
|
||||
// @Param body body domain.RoleAllRequest true "Тело запроса"
|
||||
// @Success 200 {array} domain.Role
|
||||
// @Failure 400 {object} domain.GrpcError
|
||||
// @Failure 500 {object} domain.GrpcError
|
||||
// @Failure 400 {object} apierrors.Error
|
||||
// @Failure 500 {object} apierrors.Error
|
||||
// @Router /role/all [POST]
|
||||
func (u Role) All(ctx context.Context, req domain.RoleAllRequest) ([]domain.Role, error) {
|
||||
users, err := u.roleService.All(ctx, req)
|
||||
@@ -49,17 +49,17 @@ func (u Role) All(ctx context.Context, req domain.RoleAllRequest) ([]domain.Role
|
||||
}
|
||||
|
||||
// CreateRole
|
||||
// @Tags user
|
||||
// @Tags role
|
||||
// @Summary Создать роль
|
||||
// @Description Создать роль
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param X-AUTH-ADMIN header string true "Токен администратора"
|
||||
// @Param body body domain.CreateRoleRequest true "Тело запроса"
|
||||
// @Success 200 {object} domain.User
|
||||
// @Failure 400 {object} domain.GrpcError "Невалидное тело запроса"
|
||||
// @Failure 409 {object} domain.GrpcError "Роль с указанным именем уже существует"
|
||||
// @Failure 500 {object} domain.GrpcError
|
||||
// @Success 200 {object} domain.Role
|
||||
// @Failure 400 {object} apierrors.Error "Невалидное тело запроса"
|
||||
// @Failure 409 {object} apierrors.Error "Роль с указанным именем уже существует"
|
||||
// @Failure 500 {object} apierrors.Error
|
||||
// @Router /role/create [POST]
|
||||
func (u Role) CreateRole(ctx context.Context, req domain.CreateRoleRequest, r *http.Request) (*domain.Role, error) {
|
||||
adminId, err := getAdminId(r)
|
||||
@@ -87,9 +87,9 @@ func (u Role) CreateRole(ctx context.Context, req domain.CreateRoleRequest, r *h
|
||||
// @Param X-AUTH-ADMIN header string true "Токен администратора"
|
||||
// @Param body body domain.UpdateRoleRequest true "Тело запроса"
|
||||
// @Success 200 {object} domain.Role
|
||||
// @Failure 404 {object} domain.GrpcError "Роль с указанным id не существует"
|
||||
// @Failure 409 {object} domain.GrpcError "Роль с указанным именем уже существует"
|
||||
// @Failure 500 {object} domain.GrpcError
|
||||
// @Failure 404 {object} apierrors.Error "Роль с указанным id не существует"
|
||||
// @Failure 409 {object} apierrors.Error "Роль с указанным именем уже существует"
|
||||
// @Failure 500 {object} apierrors.Error
|
||||
// @Router /role/update [POST]
|
||||
func (u Role) UpdateRole(ctx context.Context, req domain.UpdateRoleRequest, r *http.Request) (*domain.Role, error) {
|
||||
adminId, err := getAdminId(r)
|
||||
@@ -119,8 +119,8 @@ func (u Role) UpdateRole(ctx context.Context, req domain.UpdateRoleRequest, r *h
|
||||
// @Param X-AUTH-ADMIN header string true "Токен администратора"
|
||||
// @Param body body domain.DeleteRoleRequest true "Тело запроса"
|
||||
// @Success 200
|
||||
// @Failure 400 {object} domain.GrpcError "Невалидное тело запроса"
|
||||
// @Failure 500 {object} domain.GrpcError
|
||||
// @Failure 400 {object} apierrors.Error "Невалидное тело запроса"
|
||||
// @Failure 500 {object} apierrors.Error
|
||||
// @Router /role/delete [POST]
|
||||
func (u Role) DeleteRole(ctx context.Context, req domain.DeleteRoleRequest, r *http.Request) error {
|
||||
adminId, err := getAdminId(r)
|
||||
|
||||
@@ -32,7 +32,7 @@ func NewSecure(service SecureService) Secure {
|
||||
// @Produce json
|
||||
// @Param body body domain.SecureAuthRequest true "Тело запроса"
|
||||
// @Success 200 {object} domain.SecureAuthResponse
|
||||
// @Failure 500 {object} domain.GrpcError
|
||||
// @Failure 500 {object} apierrors.Error
|
||||
// @Router /secure/authenticate [POST]
|
||||
func (s Secure) Authenticate(ctx context.Context, req domain.SecureAuthRequest) (*domain.SecureAuthResponse, error) {
|
||||
adminId, err := s.service.Authenticate(ctx, req.Token)
|
||||
@@ -68,7 +68,7 @@ func (s Secure) Authenticate(ctx context.Context, req domain.SecureAuthRequest)
|
||||
// @Produce json
|
||||
// @Param body body domain.SecureAuthzRequest true "Тело запроса"
|
||||
// @Success 200 {object} domain.SecureAuthzResponse
|
||||
// @Failure 500 {object} domain.GrpcError
|
||||
// @Failure 500 {object} apierrors.Error
|
||||
// @Router /secure/authorize [POST]
|
||||
func (s Secure) Authorize(ctx context.Context, req domain.SecureAuthzRequest) (*domain.SecureAuthzResponse, error) {
|
||||
ok, err := s.service.Authorize(ctx, req.AdminId, req.Permission)
|
||||
|
||||
@@ -29,8 +29,8 @@ func NewSession(service SessionService) Session {
|
||||
// @Param X-AUTH-ADMIN header string true "Токен администратора"
|
||||
// @Param body body domain.SessionPageRequest true "Тело запроса"
|
||||
// @Success 200 {object} domain.SessionResponse
|
||||
// @Failure 400 {object} domain.GrpcError "Невалидное тело запроса"
|
||||
// @Failure 500 {object} domain.GrpcError
|
||||
// @Failure 400 {object} apierrors.Error "Невалидное тело запроса"
|
||||
// @Failure 500 {object} apierrors.Error
|
||||
// @Router /session/all [POST]
|
||||
func (c Session) All(ctx context.Context, req domain.SessionPageRequest) (*domain.SessionResponse, error) {
|
||||
if req.Order == nil {
|
||||
@@ -51,8 +51,8 @@ func (c Session) All(ctx context.Context, req domain.SessionPageRequest) (*domai
|
||||
// @Param X-AUTH-ADMIN header string true "Токен администратора"
|
||||
// @Param body body domain.RevokeRequest true "Тело запроса"
|
||||
// @Success 200
|
||||
// @Failure 400 {object} domain.GrpcError "Невалидное тело запроса"
|
||||
// @Failure 500 {object} domain.GrpcError
|
||||
// @Failure 400 {object} apierrors.Error "Невалидное тело запроса"
|
||||
// @Failure 500 {object} apierrors.Error
|
||||
// @Router /session/revoke [POST]
|
||||
func (c Session) Revoke(ctx context.Context, req domain.RevokeRequest) error {
|
||||
return c.service.Revoke(ctx, req.Id)
|
||||
|
||||
@@ -31,9 +31,9 @@ func NewUiSettings(service UiSettingsService) UiSettings {
|
||||
// @Produce json
|
||||
// @Param body body domain.ClientNameRequest true "Тело запроса"
|
||||
// @Success 200 {object} domain.UiOauthSetting
|
||||
// @Failure 400 {object} domain.GrpcError
|
||||
// @Failure 401 {object} domain.GrpcError "Неизвестное название клиента"
|
||||
// @Failure 500 {object} domain.GrpcError
|
||||
// @Failure 400 {object} apierrors.Error
|
||||
// @Failure 401 {object} apierrors.Error "Неизвестное название клиента"
|
||||
// @Failure 500 {object} apierrors.Error
|
||||
// @Router /ui_settings/oauth [POST]
|
||||
func (c UiSettings) OauthSettings(ctx context.Context, req domain.ClientNameRequest) (*domain.UiOauthSetting, error) {
|
||||
resp, err := c.service.OauthSettings(ctx, req)
|
||||
|
||||
+22
-22
@@ -41,9 +41,9 @@ func NewUser(userService userService) User {
|
||||
// @Produce json
|
||||
// @Param X-AUTH-ADMIN header string true "Токен администратора"
|
||||
// @Success 200 {object} domain.AdminUserShort
|
||||
// @Failure 400 {object} domain.GrpcError "Невалидный токен"
|
||||
// @Failure 404 {object} domain.GrpcError "Пользователя не существует"
|
||||
// @Failure 500 {object} domain.GrpcError
|
||||
// @Failure 401 {object} apierrors.Error "Невалидный токен"
|
||||
// @Failure 404 {object} apierrors.Error "Пользователя не существует"
|
||||
// @Failure 500 {object} apierrors.Error
|
||||
// @Router /user/get_profile [POST]
|
||||
func (u User) GetProfile(ctx context.Context, r *http.Request) (*domain.AdminUserShort, error) {
|
||||
adminId, err := getAdminId(r)
|
||||
@@ -73,8 +73,8 @@ func (u User) GetProfile(ctx context.Context, r *http.Request) (*domain.AdminUse
|
||||
// @Param X-AUTH-ADMIN header string true "Токен администратора"
|
||||
// @Param body body domain.UsersPageRequest true "Тело запроса"
|
||||
// @Success 200 {object} domain.UsersResponse
|
||||
// @Failure 400 {object} domain.GrpcError
|
||||
// @Failure 500 {object} domain.GrpcError
|
||||
// @Failure 400 {object} apierrors.Error
|
||||
// @Failure 500 {object} apierrors.Error
|
||||
// @Router /user/get_users [POST]
|
||||
func (u User) GetUsers(ctx context.Context, req domain.UsersPageRequest) (*domain.UsersResponse, error) {
|
||||
if req.Order == nil {
|
||||
@@ -100,8 +100,8 @@ func (u User) GetUsers(ctx context.Context, req domain.UsersPageRequest) (*domai
|
||||
// @Produce json
|
||||
// @Param X-AUTH-ADMIN header string true "Токен администратора"
|
||||
// @Success 200 {object} domain.UsersResponse
|
||||
// @Failure 400 {object} domain.GrpcError
|
||||
// @Failure 500 {object} domain.GrpcError
|
||||
// @Failure 400 {object} apierrors.Error
|
||||
// @Failure 500 {object} apierrors.Error
|
||||
// @Router /user/get_all_users [POST]
|
||||
func (u User) GetAllUsers(ctx context.Context) (*domain.UsersResponse, error) {
|
||||
users, err := u.userService.GetAllUsers(ctx)
|
||||
@@ -121,9 +121,9 @@ func (u User) GetAllUsers(ctx context.Context) (*domain.UsersResponse, error) {
|
||||
// @Param X-AUTH-ADMIN header string true "Токен администратора"
|
||||
// @Param body body domain.CreateUserRequest true "Тело запроса"
|
||||
// @Success 200 {object} domain.User
|
||||
// @Failure 400 {object} domain.GrpcError "Невалидное тело запроса"
|
||||
// @Failure 409 {object} domain.GrpcError "Пользователь с указанным email уже существует"
|
||||
// @Failure 500 {object} domain.GrpcError
|
||||
// @Failure 400 {object} apierrors.Error "Невалидное тело запроса"
|
||||
// @Failure 409 {object} apierrors.Error "Пользователь с указанным email уже существует"
|
||||
// @Failure 500 {object} apierrors.Error
|
||||
// @Router /user/create_user [POST]
|
||||
func (u User) CreateUser(ctx context.Context, req domain.CreateUserRequest, r *http.Request) (*domain.User, error) {
|
||||
adminId, err := getAdminId(r)
|
||||
@@ -151,10 +151,10 @@ func (u User) CreateUser(ctx context.Context, req domain.CreateUserRequest, r *h
|
||||
// @Param X-AUTH-ADMIN header string true "Токен администратора"
|
||||
// @Param body body domain.UpdateUserRequest true "Тело запроса"
|
||||
// @Success 200 {object} domain.User
|
||||
// @Failure 400 {object} domain.GrpcError "Невалидное тело запроса"
|
||||
// @Failure 404 {object} domain.GrpcError "Пользователь с указанным id не существует"
|
||||
// @Failure 409 {object} domain.GrpcError "Пользователь с указанным email уже существует"
|
||||
// @Failure 500 {object} domain.GrpcError
|
||||
// @Failure 400 {object} apierrors.Error "Невалидное тело запроса"
|
||||
// @Failure 404 {object} apierrors.Error "Пользователь с указанным id не существует"
|
||||
// @Failure 409 {object} apierrors.Error "Пользователь с указанным email уже существует"
|
||||
// @Failure 500 {object} apierrors.Error
|
||||
// @Router /user/update_user [POST]
|
||||
func (u User) UpdateUser(ctx context.Context, req domain.UpdateUserRequest, r *http.Request) (*domain.User, error) {
|
||||
adminId, err := getAdminId(r)
|
||||
@@ -186,8 +186,8 @@ func (u User) UpdateUser(ctx context.Context, req domain.UpdateUserRequest, r *h
|
||||
// @Param X-AUTH-ADMIN header string true "Токен администратора"
|
||||
// @Param body body domain.IdentitiesRequest true "Тело запроса"
|
||||
// @Success 200 {object} domain.DeleteResponse
|
||||
// @Failure 400 {object} domain.GrpcError "Невалидное тело запроса"
|
||||
// @Failure 500 {object} domain.GrpcError
|
||||
// @Failure 400 {object} apierrors.Error "Невалидное тело запроса"
|
||||
// @Failure 500 {object} apierrors.Error
|
||||
// @Router /user/delete_user [POST]
|
||||
func (u User) DeleteUser(ctx context.Context, identities domain.IdentitiesRequest, r *http.Request) (*domain.DeleteResponse, error) {
|
||||
adminId, err := getAdminId(r)
|
||||
@@ -211,8 +211,8 @@ func (u User) DeleteUser(ctx context.Context, identities domain.IdentitiesReques
|
||||
// @Param X-AUTH-ADMIN header string true "Токен администратора"
|
||||
// @Param body body domain.IdRequest true "Тело запроса"
|
||||
// @Success 200
|
||||
// @Failure 400 {object} domain.GrpcError "Невалидное тело запроса"
|
||||
// @Failure 500 {object} domain.GrpcError
|
||||
// @Failure 400 {object} apierrors.Error "Невалидное тело запроса"
|
||||
// @Failure 500 {object} apierrors.Error
|
||||
// @Router /user/block_user [POST]
|
||||
func (u User) Block(ctx context.Context, identities domain.IdRequest, r *http.Request) error {
|
||||
adminId, err := getAdminId(r)
|
||||
@@ -234,8 +234,8 @@ func (u User) Block(ctx context.Context, identities domain.IdRequest, r *http.Re
|
||||
// @Produce json
|
||||
// @Param body body domain.IdRequest true "Тело запроса"
|
||||
// @Success 200 {object} domain.User
|
||||
// @Failure 400 {object} domain.GrpcError "Невалидное тело запроса"
|
||||
// @Failure 500 {object} domain.GrpcError
|
||||
// @Failure 400 {object} apierrors.Error "Невалидное тело запроса"
|
||||
// @Failure 500 {object} apierrors.Error
|
||||
// @Router /user/get_by_id [POST]
|
||||
func (u User) GetById(ctx context.Context, identities domain.IdRequest) (*domain.User, error) {
|
||||
return u.userService.GetById(ctx, identities.UserId)
|
||||
@@ -249,8 +249,8 @@ func (u User) GetById(ctx context.Context, identities domain.IdRequest) (*domain
|
||||
// @Param X-AUTH-ADMIN header string true "Токен администратора"
|
||||
// @Param body body domain.ChangePasswordRequest true "Тело запроса"
|
||||
// @Success 200
|
||||
// @Failure 400 {object} apierrors.Error "Невалидное тело запроса"
|
||||
// @Failure 500 {object} apierrors.Error "внутренняя ошибка"
|
||||
// @Failure 400 {object} apierrors.Error "Невалидное тело запроса или неверный старый пароль"
|
||||
// @Failure 500 {object} apierrors.Error "Внутренняя ошибка"
|
||||
// @Router /user/change_password [POST]
|
||||
func (u User) ChangePassword(ctx context.Context, req domain.ChangePasswordRequest, r *http.Request) error {
|
||||
adminId, err := getAdminId(r)
|
||||
|
||||
Reference in new issue
Block a user