MSP-8974 fix

This commit is contained in:
chashintv committed 2026-11-23 13:00:25 +03:00
1 parent ebc99c6ae4
commit 24a8ea2578
15 files changed
+362 -333

No files matched your search

+20 -18
View File
@@ -25,15 +25,16 @@ func NewSecure(service SecureService) Secure {
}
// Authenticate
// @Tags secure
// @Summary Метод аутентификации токена
// @Description Проверяет токен и возвращает идентификатор администратора
// @Accept json
// @Produce json
// @Param body body domain.SecureAuthRequest true "Тело запроса"
// @Success 200 {object} domain.SecureAuthResponse
// @Failure 500 {object} apierrors.Error
// @Router /secure/authenticate [POST]
//
// @Tags secure
// @Summary Метод аутентификации токена
// @Description Проверяет токен и возвращает идентификатор администратора
// @Accept json
// @Produce json
// @Param body body domain.SecureAuthRequest true "Тело запроса"
// @Success 200 {object} domain.SecureAuthResponse
// @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)
switch {
@@ -61,15 +62,16 @@ func (s Secure) Authenticate(ctx context.Context, req domain.SecureAuthRequest)
}
// Authorize
// @Tags secure
// @Summary Метод авторизации для администратора
// @Description Проверяет наличие у администратора необходимого разрешения
// @Accept json
// @Produce json
// @Param body body domain.SecureAuthzRequest true "Тело запроса"
// @Success 200 {object} domain.SecureAuthzResponse
// @Failure 500 {object} apierrors.Error
// @Router /secure/authorize [POST]
//
// @Tags secure
// @Summary Метод авторизации для администратора
// @Description Проверяет наличие у администратора необходимого разрешения
// @Accept json
// @Produce json
// @Param body body domain.SecureAuthzRequest true "Тело запроса"
// @Success 200 {object} domain.SecureAuthzResponse
// @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)
if err != nil {