MSP-8959 update linter

This commit is contained in:
ziminis committed 2026-11-13 12:39:00 +07:00
1 parent dbdae4ed47
commit b819687470
13 files changed
+81 -55

No files matched your search

+18 -12
View File
@@ -11,6 +11,12 @@ import (
"github.com/txix-open/isp-kit/errors"
)
const (
roleNameLabel = "Название"
roleGroupLabel = "Группа ЕСК"
rolePermissionsLabel = "Разрешения"
)
type roleRoleRepo interface {
All(ctx context.Context) ([]entity.Role, error)
InsertRole(ctx context.Context, role entity.Role) (*entity.Role, error)
@@ -69,13 +75,13 @@ func (u Role) Create(ctx context.Context, req domain.CreateRoleRequest, adminId
slices.Sort(role.Permissions)
diff := diffToString(map[string]any{
"Название": "",
"Группа ЕСК": "",
"Разрешения": []int{},
roleNameLabel: "",
roleGroupLabel: "",
rolePermissionsLabel: []int{},
}, map[string]any{
"Название": role.Name,
"Группа ЕСК": role.ExternalGroup,
"Разрешения": role.Permissions,
roleNameLabel: role.Name,
roleGroupLabel: role.ExternalGroup,
rolePermissionsLabel: role.Permissions,
})
u.auditService.SaveAuditAsync(ctx, adminId,
fmt.Sprintf("Роль. Создание новой роли %s. Причина: %s. \n %s", req.Name, req.ChangeMessage, diff),
@@ -119,13 +125,13 @@ func (u Role) Update(ctx context.Context, req domain.UpdateRoleRequest, adminId
slices.Sort(oldRole.Permissions)
slices.Sort(role.Permissions)
diff := diffToString(map[string]any{
"Название": oldRole.Name,
"Группа ЕСК": oldRole.ExternalGroup,
"Разрешения": oldRole.Permissions,
roleNameLabel: oldRole.Name,
roleGroupLabel: oldRole.ExternalGroup,
rolePermissionsLabel: oldRole.Permissions,
}, map[string]any{
"Название": role.Name,
"Группа ЕСК": role.ExternalGroup,
"Разрешения": role.Permissions,
roleNameLabel: role.Name,
roleGroupLabel: role.ExternalGroup,
rolePermissionsLabel: role.Permissions,
})
u.auditService.SaveAuditAsync(ctx, adminId,
fmt.Sprintf("Роль. Изменение роли %s. Причина: %s. \n %s", req.Name, req.ChangeMessage, diff),
+23 -16
View File
@@ -16,6 +16,13 @@ import (
"golang.org/x/crypto/bcrypt"
)
const (
userFullNameLabel = "ФИО"
userDescriptionLabel = "Описание"
userEmailLabel = "Email"
userRolesLabel = "Роли (ID)"
)
type UserTransaction interface {
UserRepo
UserRoleRepo
@@ -253,15 +260,15 @@ func (u User) CreateUser(ctx context.Context, req domain.CreateUserRequest, admi
slices.Sort(req.Roles)
diff := diffToString(map[string]any{
"ФИО": "",
"Описание": "",
"Email": "",
"Роли (ID)": []int{},
userFullNameLabel: "",
userDescriptionLabel: "",
userEmailLabel: "",
userRolesLabel: []int{},
}, map[string]any{
"ФИО": usr.FullName,
"Описание": req.Description,
"Email": req.Email,
"Роли (ID)": req.Roles,
userFullNameLabel: usr.FullName,
userDescriptionLabel: req.Description,
userEmailLabel: req.Email,
userRolesLabel: req.Roles,
})
u.auditService.SaveAuditAsync(ctx, adminId,
fmt.Sprintf("Пользователь. Создание пользователя %d. \n %s", usr.Id, diff),
@@ -342,15 +349,15 @@ func (u User) UpdateUser(ctx context.Context, req domain.UpdateUserRequest, admi
slices.Sort(req.Roles)
diff := diffToString(map[string]any{
"ФИО": user.FullName,
"Описание": user.Description,
"Email": user.Email,
"Роли (ID)": RolesIds(oldRoles),
userFullNameLabel: user.FullName,
userDescriptionLabel: user.Description,
userEmailLabel: user.Email,
userRolesLabel: RolesIds(oldRoles),
}, map[string]any{
"ФИО": updatedUser.FullName,
"Описание": req.Description,
"Email": req.Email,
"Роли (ID)": req.Roles,
userFullNameLabel: updatedUser.FullName,
userDescriptionLabel: req.Description,
userEmailLabel: req.Email,
userRolesLabel: req.Roles,
})
u.auditService.SaveAuditAsync(ctx, adminId,
fmt.Sprintf("Пользователь. Изменение пользователя %d.\n %s", updatedUser.Id, diff),