diff --git a/controller/auth.go b/controller/auth.go index 8473d0f..f841d5c 100644 --- a/controller/auth.go +++ b/controller/auth.go @@ -121,7 +121,7 @@ func (a Auth) Login(ctx context.Context, authRequest domain.LoginRequest) (*doma // @Produce json // @Param body body domain.LoginSudirRequest true "Тело запроса" // @Success 200 {object} domain.LoginResponse -// @Failure 401 {object} domain.GrpcError "Некорректный код для авторизации" +// @Failure 401 {object} domain.GrpcError "Некорректный код для авторизации или неизвестное название клиента" // @Failure 412 {object} domain.GrpcError "Авторизация СУДИР не настроена на сервере" // @Failure 500 {object} domain.GrpcError // @Router /auth/login_with_sudir [POST] diff --git a/controller/customization.go b/controller/customization.go index 954c555..8f86c33 100644 --- a/controller/customization.go +++ b/controller/customization.go @@ -2,15 +2,19 @@ package controller import ( "msp-admin-service/conf" + "msp-admin-service/domain" ) type Customization struct { - uiCfg conf.UIDesign + uiCfg domain.UIDesign } func NewCustomization(uiCfg conf.UIDesign) Customization { return Customization{ - uiCfg: uiCfg, + uiCfg: domain.UIDesign{ + Name: uiCfg.Name, + PrimaryColor: uiCfg.PrimaryColor, + }, } } @@ -21,10 +25,10 @@ func NewCustomization(uiCfg conf.UIDesign) Customization { // @Accept json // @Produce json // @Param X-AUTH-ADMIN header string true "Токен администратора" -// @Success 200 {object} conf.UIDesign +// @Success 200 {object} domain.UIDesign // @Failure 400 {object} domain.GrpcError "Невалидный токен" // @Failure 500 {object} domain.GrpcError // @Router /user/get_design [POST] -func (c Customization) GetUIDesign() (conf.UIDesign, error) { +func (c Customization) GetUIDesign() (domain.UIDesign, error) { return c.uiCfg, nil } diff --git a/docs/swagger.json b/docs/swagger.json index 23d259c..2fd6ebb 100644 --- a/docs/swagger.json +++ b/docs/swagger.json @@ -96,7 +96,7 @@ } }, "401": { - "description": "Некорректный код для авторизации", + "description": "Некорректный код для авторизации или неизвестное название клиента", "schema": { "$ref": "#/definitions/domain.GrpcError" } @@ -1086,7 +1086,7 @@ "200": { "description": "OK", "schema": { - "$ref": "#/definitions/conf.UIDesign" + "$ref": "#/definitions/domain.UIDesign" } }, "400": { @@ -1315,17 +1315,6 @@ } } }, - "conf.UIDesign": { - "type": "object", - "properties": { - "name": { - "type": "string" - }, - "primaryColor": { - "type": "string" - } - } - }, "domain.AdminUserShort": { "type": "object", "required": [ @@ -1333,36 +1322,45 @@ ], "properties": { "email": { + "description": "Электронный адрес", "type": "string" }, "firstName": { + "description": "Имя", "type": "string" }, "fullName": { + "description": "ФИО", "type": "string" }, "idleTimeoutMs": { + "description": "Время бездействия пользователя в мс", "type": "integer" }, "lastName": { + "description": "Фамилия", "type": "string" }, "permissions": { + "description": "Список прав", "type": "array", "items": { "type": "string" } }, "role": { + "description": "Название роли", "type": "string" }, "roleNames": { + "description": "Список названия ролей", "type": "array", "items": { "type": "string" } }, "roles": { + "description": "Список идентификаторов ролей", "type": "array", "items": { "type": "integer" @@ -1374,15 +1372,19 @@ "type": "object", "properties": { "createdAt": { + "description": "Дата события", "type": "string" }, "id": { + "description": "Идентификатор audit'а", "type": "integer" }, "message": { + "description": "Сообщение", "type": "string" }, "userId": { + "description": "Идентификатор пользователя", "type": "integer" } } @@ -1394,6 +1396,7 @@ "type": "boolean" }, "event": { + "description": "Название события", "type": "string" }, "name": { @@ -1408,17 +1411,29 @@ ], "properties": { "limit": { + "description": "Максимальное количество записей", "type": "integer" }, "offset": { + "description": "Отступ для выборки", "type": "integer", "format": "int64" }, "order": { - "$ref": "#/definitions/domain.OrderParams" + "description": "Параметры сортировки", + "allOf": [ + { + "$ref": "#/definitions/domain.OrderParams" + } + ] }, "query": { - "$ref": "#/definitions/domain.AuditQuery" + "description": "Параметры выборки", + "allOf": [ + { + "$ref": "#/definitions/domain.AuditQuery" + } + ] } } }, @@ -1426,15 +1441,23 @@ "type": "object", "properties": { "createdAt": { - "$ref": "#/definitions/domain.DateFromToParams" + "description": "Фильтр по дате", + "allOf": [ + { + "$ref": "#/definitions/domain.DateFromToParams" + } + ] }, "id": { + "description": "Фильтр по идентификатору audit", "type": "integer" }, "message": { + "description": "Фильтр по сообщению", "type": "string" }, "userId": { + "description": "Фильтр по идентификатору пользователей", "type": "array", "items": { "type": "integer" @@ -1446,12 +1469,14 @@ "type": "object", "properties": { "items": { + "description": "Список audit'ов", "type": "array", "items": { "$ref": "#/definitions/domain.Audit" } }, "totalCount": { + "description": "Количество audit'ов", "type": "integer" } } @@ -1464,9 +1489,11 @@ ], "properties": { "newPassword": { + "description": "Новый пароль", "type": "string" }, "oldPassword": { + "description": "Старый пароль", "type": "string" } } @@ -1475,15 +1502,19 @@ "type": "object", "properties": { "changeMessage": { + "description": "Причина изменений", "type": "string" }, "externalGroup": { + "description": "Внешнее название группы", "type": "string" }, "name": { + "description": "Название роли", "type": "string" }, "permissions": { + "description": "Набор прав", "type": "array", "items": { "type": "string" @@ -1499,21 +1530,27 @@ ], "properties": { "description": { + "description": "Описание", "type": "string" }, "email": { + "description": "Электронный адрес", "type": "string" }, "firstName": { + "description": "Имя", "type": "string" }, "lastName": { + "description": "Фамилия", "type": "string" }, "password": { + "description": "Пароль", "type": "string" }, "roles": { + "description": "Список идентификаторов ролей", "type": "array", "items": { "type": "integer" @@ -1529,9 +1566,11 @@ ], "properties": { "from": { + "description": "Дата с", "type": "string" }, "to": { + "description": "Дата до", "type": "string" } } @@ -1540,6 +1579,7 @@ "type": "object", "properties": { "deleted": { + "description": "Количество удалённых УЗ", "type": "integer" } } @@ -1548,6 +1588,7 @@ "type": "object", "properties": { "id": { + "description": "Идентификатор роли", "type": "integer" } } @@ -1574,6 +1615,7 @@ ], "properties": { "userId": { + "description": "Идентификато пользователя", "type": "integer" } } @@ -1585,6 +1627,7 @@ ], "properties": { "ids": { + "description": "Список идентификаторов", "type": "array", "items": { "type": "integer" @@ -1600,9 +1643,11 @@ ], "properties": { "email": { + "description": "Электронная почта", "type": "string" }, "password": { + "description": "Пароль", "type": "string" } } @@ -1611,12 +1656,15 @@ "type": "object", "properties": { "expired": { + "description": "Дата истечения токена", "type": "string" }, "headerName": { + "description": "Названия заголовка для передачи токена", "type": "string" }, "token": { + "description": "Токен", "type": "string" } } @@ -1629,9 +1677,11 @@ ], "properties": { "authCode": { + "description": "Код для авторизации в СУДИР", "type": "string" }, "clientName": { + "description": "Уникальное имя конфигурации клиента", "type": "string" } } @@ -1640,6 +1690,7 @@ "type": "object", "properties": { "reason": { + "description": "Причина выхода", "type": "string" } } @@ -1648,9 +1699,11 @@ "type": "object", "properties": { "field": { + "description": "Поле сортировки", "type": "string" }, "type": { + "description": "Порядок сортировки", "type": "string", "enum": [ "asc", @@ -1665,9 +1718,11 @@ "type": "object", "properties": { "key": { + "description": "Ключ прав", "type": "string" }, "name": { + "description": "Пользовательское название", "type": "string" } } @@ -1679,6 +1734,7 @@ ], "properties": { "id": { + "description": "Идентификатор сессии", "type": "integer" } } @@ -1687,33 +1743,40 @@ "type": "object", "properties": { "changeMessage": { + "description": "Причина изменений", "type": "string" }, "createdAt": { + "description": "Дата создания", "type": "string" }, "exclusive": { "type": "boolean" }, "externalGroup": { + "description": "Внешнее название группы", "type": "string" }, "id": { + "description": "Идентификатор роли", "type": "integer" }, "immutable": { "type": "boolean" }, "name": { + "description": "Название роли", "type": "string" }, "permissions": { + "description": "Набор прав", "type": "array", "items": { "type": "string" } }, "updatedAt": { + "description": "Дата обновления", "type": "string" } } @@ -1722,6 +1785,7 @@ "type": "object", "properties": { "token": { + "description": "Токен", "type": "string" } } @@ -1730,13 +1794,16 @@ "type": "object", "properties": { "adminId": { + "description": "Идентификатор администратора", "type": "integer", "format": "int64" }, "authenticated": { + "description": "Флаг успешной аутентикации", "type": "boolean" }, "errorReason": { + "description": "Причина ошибки", "type": "string" } } @@ -1745,9 +1812,11 @@ "type": "object", "properties": { "adminId": { + "description": "Идентификатор администратора", "type": "integer" }, "permission": { + "description": "Роль", "type": "string" } } @@ -1756,6 +1825,7 @@ "type": "object", "properties": { "authorized": { + "description": "Флаг успешноЙ авторизации", "type": "boolean" } } @@ -1764,18 +1834,23 @@ "type": "object", "properties": { "createdAt": { + "description": "Дата создания сессии", "type": "string" }, "expiredAt": { + "description": "Дата протухания сессии", "type": "string" }, "id": { + "description": "Идентификатор сессии", "type": "integer" }, "status": { + "description": "Статус сессии", "type": "string" }, "userId": { + "description": "Идентификатор пользоватеккля", "type": "integer" } } @@ -1787,17 +1862,29 @@ ], "properties": { "limit": { + "description": "Максимальное количество записей", "type": "integer" }, "offset": { + "description": "Отступ для выборки", "type": "integer", "format": "int64" }, "order": { - "$ref": "#/definitions/domain.OrderParams" + "description": "Параметры сортировки", + "allOf": [ + { + "$ref": "#/definitions/domain.OrderParams" + } + ] }, "query": { - "$ref": "#/definitions/domain.SessionQuery" + "description": "Параметры выборки", + "allOf": [ + { + "$ref": "#/definitions/domain.SessionQuery" + } + ] } } }, @@ -1805,21 +1892,34 @@ "type": "object", "properties": { "createdAt": { - "$ref": "#/definitions/domain.DateFromToParams" + "description": "Фильтр по дате создания", + "allOf": [ + { + "$ref": "#/definitions/domain.DateFromToParams" + } + ] }, "expiredAt": { - "$ref": "#/definitions/domain.DateFromToParams" + "description": "Фильтр по дате протухания", + "allOf": [ + { + "$ref": "#/definitions/domain.DateFromToParams" + } + ] }, "id": { + "description": "Фильтр по идентификатору сессии", "type": "integer" }, "status": { + "description": "Фильтр по статусам", "type": "array", "items": { "type": "string" } }, "userId": { + "description": "Фильтр по идентификаторам пользователей", "type": "array", "items": { "type": "integer" @@ -1831,12 +1931,14 @@ "type": "object", "properties": { "items": { + "description": "Список сессий", "type": "array", "items": { "$ref": "#/definitions/domain.Session" } }, "totalCount": { + "description": "Количество сессий", "type": "integer" } } @@ -1845,29 +1947,50 @@ "type": "object", "properties": { "enabled": { + "description": "Включено/выключено", "type": "boolean" }, "event": { + "description": "Название события", "type": "string" } } }, + "domain.UIDesign": { + "type": "object", + "properties": { + "name": { + "description": "Название ui", + "type": "string" + }, + "primaryColor": { + "description": "Цвет в HEX", + "type": "string", + "example": "#ff4d4f,#fa8c16,#a0d911,#1890ff,#722ed1,#d4b106,#e91e63,#ff5722,#795548,#abb8c3,#525252,#689f38" + } + } + }, "domain.UpdateRoleRequest": { "type": "object", "properties": { "changeMessage": { + "description": "Причина изменений", "type": "string" }, "externalGroup": { + "description": "Внешнее название группы", "type": "string" }, "id": { + "description": "Идентификатор роли", "type": "integer" }, "name": { + "description": "Название роли", "type": "string" }, "permissions": { + "description": "Набор прав", "type": "array", "items": { "type": "string" @@ -1882,24 +2005,31 @@ ], "properties": { "blocked": { + "description": "Флаг блокировки", "type": "boolean" }, "description": { + "description": "Описание", "type": "string" }, "email": { + "description": "Электронный адрес", "type": "string" }, "firstName": { + "description": "Имя", "type": "string" }, "id": { + "description": "Идентификатор пользователя", "type": "integer" }, "lastName": { + "description": "Фамилия", "type": "string" }, "roles": { + "description": "Список идентификаторов ролей", "type": "array", "items": { "type": "integer" @@ -1911,40 +2041,51 @@ "type": "object", "properties": { "blocked": { + "description": "Флаг блокировки", "type": "boolean" }, "createdAt": { + "description": "Дата создания", "type": "string" }, "description": { + "description": "Описание", "type": "string" }, "email": { + "description": "Электронная почта", "type": "string" }, "firstName": { + "description": "Имя", "type": "string" }, "fullName": { + "description": "ФИО", "type": "string" }, "id": { + "description": "Идентификатор пользователя", "type": "integer", "format": "int64" }, "lastName": { + "description": "Фамилия", "type": "string" }, "lastSessionCreatedAt": { + "description": "Дата создания последней сессии", "type": "string" }, "roles": { + "description": "Список идентификаторов ролей", "type": "array", "items": { "type": "integer" } }, "updatedAt": { + "description": "Дата обновлёния", "type": "string" } } @@ -1953,24 +2094,34 @@ "type": "object", "properties": { "description": { + "description": "Фильтр по описанию", "type": "string" }, "email": { + "description": "Фильтр по электроннйо почты", "type": "string" }, "id": { + "description": "Фильтр по идентификатору пользователя", "type": "integer" }, "lastSessionCreatedAt": { - "$ref": "#/definitions/domain.DateFromToParams" + "description": "Фильтр по дате создания последней сессии", + "allOf": [ + { + "$ref": "#/definitions/domain.DateFromToParams" + } + ] }, "roles": { + "description": "Фильтр по ролям", "type": "array", "items": { "type": "integer" } }, "userId": { + "description": "Фильтр по идентификаторам пользователя", "type": "array", "items": { "type": "integer" @@ -1985,17 +2136,29 @@ ], "properties": { "limit": { + "description": "Максимальное количество записей", "type": "integer" }, "offset": { + "description": "Отступ для выборки", "type": "integer", "format": "int64" }, "order": { - "$ref": "#/definitions/domain.OrderParams" + "description": "Параметры сортировки", + "allOf": [ + { + "$ref": "#/definitions/domain.OrderParams" + } + ] }, "query": { - "$ref": "#/definitions/domain.UserQuery" + "description": "Параметры выборки", + "allOf": [ + { + "$ref": "#/definitions/domain.UserQuery" + } + ] } } }, @@ -2003,6 +2166,7 @@ "type": "object", "properties": { "items": { + "description": "Список пользователей", "type": "array", "items": { "$ref": "#/definitions/domain.User" diff --git a/domain/audit.go b/domain/audit.go index 9a4150e..85fdd77 100644 --- a/domain/audit.go +++ b/domain/audit.go @@ -5,38 +5,38 @@ import ( ) type Audit struct { - Id int - UserId int - Message string - CreatedAt time.Time + Id int // Идентификатор audit'а + UserId int // Идентификатор пользователя + Message string // Сообщение + CreatedAt time.Time // Дата события } type AuditResponse struct { - TotalCount int - Items []Audit + TotalCount int // Количество audit'ов + Items []Audit // Список audit'ов } type AuditPageRequest struct { LimitOffestParams - Order *OrderParams - Query *AuditQuery + Order *OrderParams // Параметры сортировки + Query *AuditQuery // Параметры выборки } type AuditQuery struct { - Id *int - UserId []int - Message *string - CreatedAt *DateFromToParams + Id *int // Фильтр по идентификатору audit + UserId []int // Фильтр по идентификатору пользователей + Message *string // Фильтр по сообщению + CreatedAt *DateFromToParams // Фильтр по дате } type SetAuditEvent struct { - Event string - Enabled bool + Event string // Название события + Enabled bool // Включено/выключено } type AuditEvent struct { - Event string - Name string + Event string // Название события + Name string // Enabled bool } diff --git a/domain/login.go b/domain/login.go index 6de0bde..7311f28 100644 --- a/domain/login.go +++ b/domain/login.go @@ -6,22 +6,22 @@ const ( ) type LogoutRequest struct { - Reason string + Reason string // Причина выхода } type LoginRequest struct { - Email string `validate:"required"` - Password string ` validate:"required"` + Email string `validate:"required"` // Электронная почта + Password string ` validate:"required"` // Пароль } type LoginSudirRequest struct { - AuthCode string `validate:"required"` - ClientName string `validate:"required"` + AuthCode string `validate:"required"` // Код для авторизации в СУДИР + ClientName string `validate:"required"` // Уникальное имя конфигурации клиента } // nolint:tagliatelle,godoclint type LoginResponse struct { - Token string - Expired string `json:",omitempty"` - HeaderName string + Token string // Токен + Expired string `json:",omitempty"` // Дата истечения токена + HeaderName string // Названия заголовка для передачи токена } diff --git a/domain/params.go b/domain/params.go index 4336376..6bc7d2f 100644 --- a/domain/params.go +++ b/domain/params.go @@ -8,16 +8,16 @@ const ( ) type LimitOffestParams struct { - Limit uint64 `validate:"required"` - Offset uint64 + Limit uint64 `validate:"required"` // Максимальное количество записей + Offset uint64 // Отступ для выборки } type OrderParams struct { - Field string - Type string `validate:"oneof=asc desc ASC DESC"` + Field string // Поле сортировки + Type string `validate:"oneof=asc desc ASC DESC"` // Порядок сортировки } type DateFromToParams struct { - From time.Time `validate:"required"` - To time.Time `validate:"required"` + From time.Time `validate:"required"` // Дата с + To time.Time `validate:"required"` // Дата до } diff --git a/domain/permission.go b/domain/permission.go index 64e5c16..d5dd232 100644 --- a/domain/permission.go +++ b/domain/permission.go @@ -1,6 +1,6 @@ package domain type Permission struct { - Key string - Name string + Key string // Ключ прав + Name string // Пользовательское название } diff --git a/domain/role.go b/domain/role.go index 3233a77..b45a821 100644 --- a/domain/role.go +++ b/domain/role.go @@ -5,32 +5,32 @@ import ( ) type Role struct { - Id int - Name string - ExternalGroup string - ChangeMessage string - Permissions []string + Id int // Идентификатор роли + Name string // Название роли + ExternalGroup string // Внешнее название группы + ChangeMessage string // Причина изменений + Permissions []string // Набор прав Immutable bool Exclusive bool - CreatedAt time.Time - UpdatedAt time.Time + CreatedAt time.Time // Дата создания + UpdatedAt time.Time // Дата обновления } type CreateRoleRequest struct { - Name string - ExternalGroup string - ChangeMessage string - Permissions []string + Name string // Название роли + ExternalGroup string // Внешнее название группы + ChangeMessage string // Причина изменений + Permissions []string // Набор прав } type UpdateRoleRequest struct { - Id int - Name string - ExternalGroup string - ChangeMessage string - Permissions []string + Id int // Идентификатор роли + Name string // Название роли + ExternalGroup string // Внешнее название группы + ChangeMessage string // Причина изменений + Permissions []string // Набор прав } type DeleteRoleRequest struct { - Id int + Id int // Идентификатор роли } diff --git a/domain/secure.go b/domain/secure.go index 3417866..ad1ea05 100644 --- a/domain/secure.go +++ b/domain/secure.go @@ -1,20 +1,20 @@ package domain type SecureAuthRequest struct { - Token string + Token string // Токен } type SecureAuthResponse struct { - Authenticated bool - ErrorReason string - AdminId int64 + Authenticated bool // Флаг успешной аутентикации + ErrorReason string // Причина ошибки + AdminId int64 // Идентификатор администратора } type SecureAuthzRequest struct { - AdminId int - Permission string + AdminId int // Идентификатор администратора + Permission string // Роль } type SecureAuthzResponse struct { - Authorized bool + Authorized bool // Флаг успешноЙ авторизации } diff --git a/domain/session.go b/domain/session.go index 549fb28..97248e0 100644 --- a/domain/session.go +++ b/domain/session.go @@ -5,33 +5,33 @@ import ( ) type Session struct { - Id int - UserId int - Status string - ExpiredAt time.Time - CreatedAt time.Time + Id int // Идентификатор сессии + UserId int // Идентификатор пользоватеккля + Status string // Статус сессии + ExpiredAt time.Time // Дата протухания сессии + CreatedAt time.Time // Дата создания сессии } type SessionPageRequest struct { LimitOffestParams - Order *OrderParams - Query *SessionQuery + Order *OrderParams // Параметры сортировки + Query *SessionQuery // Параметры выборки } type SessionQuery struct { - Id *int - UserId []int - Status []string - CreatedAt *DateFromToParams - ExpiredAt *DateFromToParams + Id *int // Фильтр по идентификатору сессии + UserId []int // Фильтр по идентификаторам пользователей + Status []string // Фильтр по статусам + CreatedAt *DateFromToParams // Фильтр по дате создания + ExpiredAt *DateFromToParams // Фильтр по дате протухания } type SessionResponse struct { - TotalCount int - Items []Session + TotalCount int // Количество сессий + Items []Session // Список сессий } type RevokeRequest struct { - Id int `validate:"required"` + Id int `validate:"required"` // Идентификатор сессии } diff --git a/domain/ui_design.go b/domain/ui_design.go index 1059426..5b6967d 100644 --- a/domain/ui_design.go +++ b/domain/ui_design.go @@ -3,5 +3,5 @@ package domain //nolint:lll type UIDesign struct { Name string // Название ui - PrimaryColor string `example:"#ff4d4f,#fa8c16,#a0d911,#1890ff,#722ed1,#d4b106,#e91e63,#ff5722,#795548,#abb8c3,#525252,#689f38"`// Цвет в HEX + PrimaryColor string `example:"#ff4d4f,#fa8c16,#a0d911,#1890ff,#722ed1,#d4b106,#e91e63,#ff5722,#795548,#abb8c3,#525252,#689f38"` // Цвет в HEX } diff --git a/domain/user.go b/domain/user.go index 23ed0d6..d3d20d1 100644 --- a/domain/user.go +++ b/domain/user.go @@ -5,83 +5,83 @@ import ( ) type User struct { - Id int64 - Roles []int - FirstName string - LastName string - FullName string - Email string - Description string - Blocked bool - LastSessionCreatedAt *time.Time - UpdatedAt time.Time - CreatedAt time.Time + Id int64 // Идентификатор пользователя + Roles []int // Список идентификаторов ролей + FirstName string // Имя + LastName string // Фамилия + FullName string // ФИО + Email string // Электронная почта + Description string // Описание + Blocked bool // Флаг блокировки + LastSessionCreatedAt *time.Time // Дата создания последней сессии + UpdatedAt time.Time // Дата обновлёния + CreatedAt time.Time // Дата создания } type UsersResponse struct { - Items []User + Items []User // Список пользователей } type UserQuery struct { - Id *int - UserId []int - Description *string - Email *string - Roles []int - LastSessionCreatedAt *DateFromToParams + Id *int // Фильтр по идентификатору пользователя + UserId []int // Фильтр по идентификаторам пользователя + Description *string // Фильтр по описанию + Email *string // Фильтр по электроннйо почты + Roles []int // Фильтр по ролям + LastSessionCreatedAt *DateFromToParams // Фильтр по дате создания последней сессии } type UsersPageRequest struct { LimitOffestParams - Order *OrderParams - Query *UserQuery + Order *OrderParams // Параметры сортировки + Query *UserQuery // Параметры выборки } type AdminUserShort struct { - FirstName string - LastName string - FullName string - Email string `validate:"required"` - Role string - Roles []int - RoleNames []string - Permissions []string - IdleTimeoutMs int + FirstName string // Имя + LastName string // Фамилия + FullName string // ФИО + Email string `validate:"required"` // Электронный адрес + Role string // Название роли + Roles []int // Список идентификаторов ролей + RoleNames []string // Список названия ролей + Permissions []string // Список прав + IdleTimeoutMs int // Время бездействия пользователя в мс } type CreateUserRequest struct { - Roles []int - FirstName string - LastName string - Email string `validate:"required"` - Password string `validate:"required"` - Description string + Roles []int // Список идентификаторов ролей + FirstName string // Имя + LastName string // Фамилия + Email string `validate:"required"` // Электронный адрес + Password string `validate:"required"` // Пароль + Description string // Описание } type UpdateUserRequest struct { - Id int64 `validate:"required"` - Roles []int - FirstName string - LastName string - Email string - Description string - Blocked bool + Id int64 `validate:"required"` // Идентификатор пользователя + Roles []int // Список идентификаторов ролей + FirstName string // Имя + LastName string // Фамилия + Email string // Электронный адрес + Description string // Описание + Blocked bool // Флаг блокировки } type DeleteResponse struct { - Deleted int + Deleted int // Количество удалённых УЗ } type IdentitiesRequest struct { - Ids []int64 `validate:"required"` + Ids []int64 `validate:"required"` // Список идентификаторов } type IdRequest struct { - UserId int `validate:"required"` + UserId int `validate:"required"` // Идентификато пользователя } type ChangePasswordRequest struct { - OldPassword string `validate:"required"` - NewPassword string `validate:"required"` + OldPassword string `validate:"required"` // Старый пароль + NewPassword string `validate:"required"` // Новый пароль }