chore: auto-generate protobuf files [skip ci]

This commit is contained in:
github-actions[bot]
2026-04-11 18:13:04 +00:00
parent 284059d19d
commit bc8923b1f7
6 changed files with 1494 additions and 787 deletions

View File

@@ -9,17 +9,7 @@ import type { Metadata } from "@grpc/grpc-js";
import { GrpcMethod, GrpcStreamMethod } from "@nestjs/microservices";
import { Observable } from "rxjs";
export const protobufPackage = "admin.account.v1";
export interface AdminResetPasswordRequest {
userId: string;
newPassword: string;
}
export interface AdminResetPasswordResponse {
success: boolean;
message: string;
}
export const protobufPackage = "admin.v1";
export interface CreateUserRequest {
username: string;
@@ -41,46 +31,6 @@ export interface DeleteUserResponse {
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 AssignRoleRequest {
userId: string;
/** В gRPC передаем как 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 BlockUserRequest {
/** Кого блокируем */
userId: string;
@@ -104,6 +54,56 @@ export interface UnblockUserResponse {
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;
@@ -125,7 +125,7 @@ export interface UnblockIpResponse {
message: string;
}
/** Можно оставить пустым, так как нам не нужны входные данные */
/** Пустой запрос, так как параметры не требуются */
export interface SyncUsersToSearchRequest {
}
@@ -134,37 +134,48 @@ export interface SyncUsersToSearchResponse {
message: string;
}
export const ADMIN_ACCOUNT_V1_PACKAGE_NAME = "admin.account.v1";
export const ADMIN_V1_PACKAGE_NAME = "admin.v1";
export interface AdminAccountServiceClient {
adminResetPassword(request: AdminResetPasswordRequest, metadata?: Metadata): Observable<AdminResetPasswordResponse>;
/** Единый сервис для всех административных операций */
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>;
blockUser(request: BlockUserRequest, metadata?: Metadata): Observable<BlockUserResponse>;
unblockUser(request: UnblockUserRequest, metadata?: Metadata): Observable<UnblockUserResponse>;
/** Управление черным списком IP */
blockIp(request: BlockIpRequest, metadata?: Metadata): Observable<BlockIpResponse>;
unblockIp(request: UnblockIpRequest, metadata?: Metadata): Observable<UnblockIpResponse>;
/** Синхронизация с поисковым движком (Elasticsearch) */
syncUsersToSearch(request: SyncUsersToSearchRequest, metadata?: Metadata): Observable<SyncUsersToSearchResponse>;
}
export interface AdminAccountServiceController {
adminResetPassword(
request: AdminResetPasswordRequest,
metadata?: Metadata,
): Promise<AdminResetPasswordResponse> | Observable<AdminResetPasswordResponse> | AdminResetPasswordResponse;
/** Единый сервис для всех административных операций */
export interface AdminServiceController {
/** Управление учетными записями */
createUser(
request: CreateUserRequest,
@@ -176,11 +187,30 @@ export interface AdminAccountServiceController {
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,
@@ -191,15 +221,7 @@ export interface AdminAccountServiceController {
metadata?: Metadata,
): Promise<RevokeRoleResponse> | Observable<RevokeRoleResponse> | RevokeRoleResponse;
blockUser(
request: BlockUserRequest,
metadata?: Metadata,
): Promise<BlockUserResponse> | Observable<BlockUserResponse> | BlockUserResponse;
unblockUser(
request: UnblockUserRequest,
metadata?: Metadata,
): Promise<UnblockUserResponse> | Observable<UnblockUserResponse> | UnblockUserResponse;
/** Управление черным списком IP */
blockIp(
request: BlockIpRequest,
@@ -211,37 +233,39 @@ export interface AdminAccountServiceController {
metadata?: Metadata,
): Promise<UnblockIpResponse> | Observable<UnblockIpResponse> | UnblockIpResponse;
/** Синхронизация с поисковым движком (Elasticsearch) */
syncUsersToSearch(
request: SyncUsersToSearchRequest,
metadata?: Metadata,
): Promise<SyncUsersToSearchResponse> | Observable<SyncUsersToSearchResponse> | SyncUsersToSearchResponse;
}
export function AdminAccountServiceControllerMethods() {
export function AdminServiceControllerMethods() {
return function (constructor: Function) {
const grpcMethods: string[] = [
"adminResetPassword",
"createUser",
"deleteUser",
"changeData",
"assignRole",
"revokeRole",
"blockUser",
"unblockUser",
"changeData",
"adminResetPassword",
"assignRole",
"revokeRole",
"blockIp",
"unblockIp",
"syncUsersToSearch",
];
for (const method of grpcMethods) {
const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
GrpcMethod("AdminAccountService", method)(constructor.prototype[method], method, descriptor);
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("AdminAccountService", method)(constructor.prototype[method], method, descriptor);
GrpcStreamMethod("AdminService", method)(constructor.prototype[method], method, descriptor);
}
};
}
export const ADMIN_ACCOUNT_SERVICE_NAME = "AdminAccountService";
export const ADMIN_SERVICE_NAME = "AdminService";