442 lines
12 KiB
TypeScript
442 lines
12 KiB
TypeScript
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
||
// versions:
|
||
// protoc-gen-ts_proto v2.11.6
|
||
// protoc v4.25.9
|
||
// source: admin/admin-account.proto
|
||
|
||
/* eslint-disable */
|
||
import type { Metadata } from "@grpc/grpc-js";
|
||
import { GrpcMethod, GrpcStreamMethod } from "@nestjs/microservices";
|
||
import { Observable } from "rxjs";
|
||
|
||
export const protobufPackage = "admin.v1";
|
||
|
||
export interface CreateUserRequest {
|
||
username: string;
|
||
password: string;
|
||
roles: string[];
|
||
}
|
||
|
||
export interface CreateUserResponse {
|
||
success: boolean;
|
||
message: string;
|
||
}
|
||
|
||
export interface DeleteUserRequest {
|
||
userId: string;
|
||
}
|
||
|
||
export interface DeleteUserResponse {
|
||
success: boolean;
|
||
message: string;
|
||
}
|
||
|
||
export interface BlockUserRequest {
|
||
/** Кого блокируем */
|
||
userId: string;
|
||
/** Кто блокирует */
|
||
adminId: string;
|
||
reason?: string | undefined;
|
||
}
|
||
|
||
export interface BlockUserResponse {
|
||
success: boolean;
|
||
message: string;
|
||
}
|
||
|
||
export interface UnblockUserRequest {
|
||
userId: string;
|
||
adminId: string;
|
||
}
|
||
|
||
export interface UnblockUserResponse {
|
||
success: boolean;
|
||
message: string;
|
||
}
|
||
|
||
export interface ChangeDataRequest {
|
||
userId: string;
|
||
sessionId: string;
|
||
email?: string | undefined;
|
||
phone?: string | undefined;
|
||
fullName?: string | undefined;
|
||
avatarUrl?: string | undefined;
|
||
customStatusText?: string | undefined;
|
||
customStatusEmoji?: string | undefined;
|
||
timezone?: string | undefined;
|
||
language?: string | undefined;
|
||
isPublic?: boolean | undefined;
|
||
}
|
||
|
||
export interface ChangeDataResponse {
|
||
success: boolean;
|
||
message: string;
|
||
}
|
||
|
||
export interface AdminResetPasswordRequest {
|
||
userId: string;
|
||
newPassword: string;
|
||
}
|
||
|
||
export interface AdminResetPasswordResponse {
|
||
success: boolean;
|
||
message: string;
|
||
}
|
||
|
||
export interface AssignRoleRequest {
|
||
userId: string;
|
||
/** Передаем как string, внутри парсим в Int */
|
||
roleId: string;
|
||
}
|
||
|
||
export interface AssignRoleResponse {
|
||
success: boolean;
|
||
message: string;
|
||
}
|
||
|
||
export interface RevokeRoleRequest {
|
||
userId: string;
|
||
roleId: string;
|
||
}
|
||
|
||
export interface RevokeRoleResponse {
|
||
success: boolean;
|
||
message: string;
|
||
}
|
||
|
||
export interface BlockIpRequest {
|
||
ipAddress: string;
|
||
adminId: string;
|
||
reason?: string | undefined;
|
||
}
|
||
|
||
export interface BlockIpResponse {
|
||
success: boolean;
|
||
message: string;
|
||
}
|
||
|
||
export interface UnblockIpRequest {
|
||
ipAddress: string;
|
||
adminId: string;
|
||
}
|
||
|
||
export interface UnblockIpResponse {
|
||
success: boolean;
|
||
message: string;
|
||
}
|
||
|
||
/** Пустой запрос, так как параметры не требуются */
|
||
export interface SyncUsersToSearchRequest {
|
||
}
|
||
|
||
export interface SyncUsersToSearchResponse {
|
||
success: boolean;
|
||
message: string;
|
||
}
|
||
|
||
export interface GetAllPermissionsAdminRequest {
|
||
userId: string;
|
||
sessionId: string;
|
||
}
|
||
|
||
export interface PermissionAdmin {
|
||
id: string;
|
||
code: string;
|
||
description: string;
|
||
module: string;
|
||
roles: string[];
|
||
}
|
||
|
||
export interface GetAllPermissionsAdminResponse {
|
||
permissions: PermissionAdmin[];
|
||
}
|
||
|
||
export interface GetAllRolesAdminRequest {
|
||
userId: string;
|
||
sessionId: string;
|
||
}
|
||
|
||
export interface RolesAdmin {
|
||
id: string;
|
||
name: string;
|
||
level: number;
|
||
permissions: string[];
|
||
ldapMapping: string[];
|
||
accounts: string[];
|
||
}
|
||
|
||
export interface GetAllRolesAdminResponse {
|
||
roles: RolesAdmin[];
|
||
}
|
||
|
||
export interface CreateRoleAdminRequest {
|
||
name: string;
|
||
level: number;
|
||
permissionCodes: string[];
|
||
}
|
||
|
||
export interface UpdateRoleAdminRequest {
|
||
id: string;
|
||
name?: string | undefined;
|
||
level?: number | undefined;
|
||
permissionCodes: string[];
|
||
}
|
||
|
||
export interface ModifyRoleAdminResponse {
|
||
success: boolean;
|
||
message: string;
|
||
}
|
||
|
||
export interface DeleteRoleAdminRequest {
|
||
id: string;
|
||
}
|
||
|
||
export interface DeleteRoleAdminResponse {
|
||
success: boolean;
|
||
message: string;
|
||
fallbackRoleName?: string | undefined;
|
||
}
|
||
|
||
export interface CreatePermissionAdminRequest {
|
||
code: string;
|
||
description: string;
|
||
module: string;
|
||
}
|
||
|
||
export interface UpdatePermissionAdminRequest {
|
||
id: string;
|
||
roleIds: string[];
|
||
}
|
||
|
||
export interface ModifyPermissionAdminResponse {
|
||
success: boolean;
|
||
message: string;
|
||
}
|
||
|
||
export interface GrafanaAlertRequest {
|
||
payload: string;
|
||
userId: string;
|
||
sessionId: string;
|
||
}
|
||
|
||
/** Успешно ли обработан алерт */
|
||
export interface GrafanaAlertResponse {
|
||
success: boolean;
|
||
}
|
||
|
||
export const ADMIN_V1_PACKAGE_NAME = "admin.v1";
|
||
|
||
/** Единый сервис для всех административных операций */
|
||
|
||
export interface AdminServiceClient {
|
||
/** Управление учетными записями */
|
||
|
||
createUser(request: CreateUserRequest, metadata?: Metadata): Observable<CreateUserResponse>;
|
||
|
||
deleteUser(request: DeleteUserRequest, metadata?: Metadata): Observable<DeleteUserResponse>;
|
||
|
||
blockUser(request: BlockUserRequest, metadata?: Metadata): Observable<BlockUserResponse>;
|
||
|
||
unblockUser(request: UnblockUserRequest, metadata?: Metadata): Observable<UnblockUserResponse>;
|
||
|
||
/** Управление данными и безопасностью */
|
||
|
||
changeData(request: ChangeDataRequest, metadata?: Metadata): Observable<ChangeDataResponse>;
|
||
|
||
adminResetPassword(request: AdminResetPasswordRequest, metadata?: Metadata): Observable<AdminResetPasswordResponse>;
|
||
|
||
/** Управление ролями (RBAC) */
|
||
|
||
assignRole(request: AssignRoleRequest, metadata?: Metadata): Observable<AssignRoleResponse>;
|
||
|
||
revokeRole(request: RevokeRoleRequest, metadata?: Metadata): Observable<RevokeRoleResponse>;
|
||
|
||
/** Управление черным списком IP */
|
||
|
||
blockIp(request: BlockIpRequest, metadata?: Metadata): Observable<BlockIpResponse>;
|
||
|
||
unblockIp(request: UnblockIpRequest, metadata?: Metadata): Observable<UnblockIpResponse>;
|
||
|
||
/** Синхронизация с поисковым движком (Elasticsearch) */
|
||
|
||
syncUsersToSearch(request: SyncUsersToSearchRequest, metadata?: Metadata): Observable<SyncUsersToSearchResponse>;
|
||
|
||
handleGrafanaAlert(request: GrafanaAlertRequest, metadata?: Metadata): Observable<GrafanaAlertResponse>;
|
||
|
||
/** RBAC */
|
||
|
||
getAllPermissions(
|
||
request: GetAllPermissionsAdminRequest,
|
||
metadata?: Metadata,
|
||
): Observable<GetAllPermissionsAdminResponse>;
|
||
|
||
getAllRoles(request: GetAllRolesAdminRequest, metadata?: Metadata): Observable<GetAllRolesAdminResponse>;
|
||
|
||
createRole(request: CreateRoleAdminRequest, metadata?: Metadata): Observable<ModifyRoleAdminResponse>;
|
||
|
||
updateRole(request: UpdateRoleAdminRequest, metadata?: Metadata): Observable<ModifyRoleAdminResponse>;
|
||
|
||
deleteRole(request: DeleteRoleAdminRequest, metadata?: Metadata): Observable<DeleteRoleAdminResponse>;
|
||
|
||
createPermission(
|
||
request: CreatePermissionAdminRequest,
|
||
metadata?: Metadata,
|
||
): Observable<ModifyPermissionAdminResponse>;
|
||
|
||
updatePermission(
|
||
request: UpdatePermissionAdminRequest,
|
||
metadata?: Metadata,
|
||
): Observable<ModifyPermissionAdminResponse>;
|
||
}
|
||
|
||
/** Единый сервис для всех административных операций */
|
||
|
||
export interface AdminServiceController {
|
||
/** Управление учетными записями */
|
||
|
||
createUser(
|
||
request: CreateUserRequest,
|
||
metadata?: Metadata,
|
||
): Promise<CreateUserResponse> | Observable<CreateUserResponse> | CreateUserResponse;
|
||
|
||
deleteUser(
|
||
request: DeleteUserRequest,
|
||
metadata?: Metadata,
|
||
): Promise<DeleteUserResponse> | Observable<DeleteUserResponse> | DeleteUserResponse;
|
||
|
||
blockUser(
|
||
request: BlockUserRequest,
|
||
metadata?: Metadata,
|
||
): Promise<BlockUserResponse> | Observable<BlockUserResponse> | BlockUserResponse;
|
||
|
||
unblockUser(
|
||
request: UnblockUserRequest,
|
||
metadata?: Metadata,
|
||
): Promise<UnblockUserResponse> | Observable<UnblockUserResponse> | UnblockUserResponse;
|
||
|
||
/** Управление данными и безопасностью */
|
||
|
||
changeData(
|
||
request: ChangeDataRequest,
|
||
metadata?: Metadata,
|
||
): Promise<ChangeDataResponse> | Observable<ChangeDataResponse> | ChangeDataResponse;
|
||
|
||
adminResetPassword(
|
||
request: AdminResetPasswordRequest,
|
||
metadata?: Metadata,
|
||
): Promise<AdminResetPasswordResponse> | Observable<AdminResetPasswordResponse> | AdminResetPasswordResponse;
|
||
|
||
/** Управление ролями (RBAC) */
|
||
|
||
assignRole(
|
||
request: AssignRoleRequest,
|
||
metadata?: Metadata,
|
||
): Promise<AssignRoleResponse> | Observable<AssignRoleResponse> | AssignRoleResponse;
|
||
|
||
revokeRole(
|
||
request: RevokeRoleRequest,
|
||
metadata?: Metadata,
|
||
): Promise<RevokeRoleResponse> | Observable<RevokeRoleResponse> | RevokeRoleResponse;
|
||
|
||
/** Управление черным списком IP */
|
||
|
||
blockIp(
|
||
request: BlockIpRequest,
|
||
metadata?: Metadata,
|
||
): Promise<BlockIpResponse> | Observable<BlockIpResponse> | BlockIpResponse;
|
||
|
||
unblockIp(
|
||
request: UnblockIpRequest,
|
||
metadata?: Metadata,
|
||
): Promise<UnblockIpResponse> | Observable<UnblockIpResponse> | UnblockIpResponse;
|
||
|
||
/** Синхронизация с поисковым движком (Elasticsearch) */
|
||
|
||
syncUsersToSearch(
|
||
request: SyncUsersToSearchRequest,
|
||
metadata?: Metadata,
|
||
): Promise<SyncUsersToSearchResponse> | Observable<SyncUsersToSearchResponse> | SyncUsersToSearchResponse;
|
||
|
||
handleGrafanaAlert(
|
||
request: GrafanaAlertRequest,
|
||
metadata?: Metadata,
|
||
): Promise<GrafanaAlertResponse> | Observable<GrafanaAlertResponse> | GrafanaAlertResponse;
|
||
|
||
/** RBAC */
|
||
|
||
getAllPermissions(
|
||
request: GetAllPermissionsAdminRequest,
|
||
metadata?: Metadata,
|
||
):
|
||
| Promise<GetAllPermissionsAdminResponse>
|
||
| Observable<GetAllPermissionsAdminResponse>
|
||
| GetAllPermissionsAdminResponse;
|
||
|
||
getAllRoles(
|
||
request: GetAllRolesAdminRequest,
|
||
metadata?: Metadata,
|
||
): Promise<GetAllRolesAdminResponse> | Observable<GetAllRolesAdminResponse> | GetAllRolesAdminResponse;
|
||
|
||
createRole(
|
||
request: CreateRoleAdminRequest,
|
||
metadata?: Metadata,
|
||
): Promise<ModifyRoleAdminResponse> | Observable<ModifyRoleAdminResponse> | ModifyRoleAdminResponse;
|
||
|
||
updateRole(
|
||
request: UpdateRoleAdminRequest,
|
||
metadata?: Metadata,
|
||
): Promise<ModifyRoleAdminResponse> | Observable<ModifyRoleAdminResponse> | ModifyRoleAdminResponse;
|
||
|
||
deleteRole(
|
||
request: DeleteRoleAdminRequest,
|
||
metadata?: Metadata,
|
||
): Promise<DeleteRoleAdminResponse> | Observable<DeleteRoleAdminResponse> | DeleteRoleAdminResponse;
|
||
|
||
createPermission(
|
||
request: CreatePermissionAdminRequest,
|
||
metadata?: Metadata,
|
||
): Promise<ModifyPermissionAdminResponse> | Observable<ModifyPermissionAdminResponse> | ModifyPermissionAdminResponse;
|
||
|
||
updatePermission(
|
||
request: UpdatePermissionAdminRequest,
|
||
metadata?: Metadata,
|
||
): Promise<ModifyPermissionAdminResponse> | Observable<ModifyPermissionAdminResponse> | ModifyPermissionAdminResponse;
|
||
}
|
||
|
||
export function AdminServiceControllerMethods() {
|
||
return function (constructor: Function) {
|
||
const grpcMethods: string[] = [
|
||
"createUser",
|
||
"deleteUser",
|
||
"blockUser",
|
||
"unblockUser",
|
||
"changeData",
|
||
"adminResetPassword",
|
||
"assignRole",
|
||
"revokeRole",
|
||
"blockIp",
|
||
"unblockIp",
|
||
"syncUsersToSearch",
|
||
"handleGrafanaAlert",
|
||
"getAllPermissions",
|
||
"getAllRoles",
|
||
"createRole",
|
||
"updateRole",
|
||
"deleteRole",
|
||
"createPermission",
|
||
"updatePermission",
|
||
];
|
||
for (const method of grpcMethods) {
|
||
const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
||
GrpcMethod("AdminService", method)(constructor.prototype[method], method, descriptor);
|
||
}
|
||
const grpcStreamMethods: string[] = [];
|
||
for (const method of grpcStreamMethods) {
|
||
const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
||
GrpcStreamMethod("AdminService", method)(constructor.prototype[method], method, descriptor);
|
||
}
|
||
};
|
||
}
|
||
|
||
export const ADMIN_SERVICE_NAME = "AdminService";
|