Files
contracts/gen/account.ts
2026-04-10 18:29:20 +00:00

361 lines
9.0 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
// versions:
// protoc-gen-ts_proto v2.11.6
// protoc v3.21.12
// source: account.proto
/* eslint-disable */
import type { Metadata } from "@grpc/grpc-js";
import { GrpcMethod, GrpcStreamMethod } from "@nestjs/microservices";
import { Observable } from "rxjs";
export const protobufPackage = "account.v1";
export interface GetAccountRequest {
id: string;
}
export interface GetAccountResponse {
id: string;
username: string;
email: string;
phone: string;
fullName: string;
isLdap: boolean;
status: string;
roles: string[];
avatarUrl: string;
employeeId?: string | undefined;
presence: string;
lastActive: string;
customStatusText: string;
customStatusEmoji: string;
timezone: string;
language: string;
twoFaEnabled: boolean;
hasPin: boolean;
}
export interface ChangePasswordRequest {
userId: string;
oldPassword: string;
newPassword: string;
code?: string | undefined;
sessionId: string;
}
export interface ChangePasswordResponse {
success: boolean;
message: string;
}
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 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 AdminResetPasswordRequest {
userId: string;
newPassword: string;
}
export interface AdminResetPasswordResponse {
success: boolean;
message: string;
}
export interface SetPinRequest {
userId: string;
sessionId: string;
pin: string;
}
export interface SetPinResponse {
success: boolean;
message: string;
}
export interface UnlockPinRequest {
userId: string;
sessionId: string;
pin: string;
}
export interface UnlockPinResponse {
success: boolean;
message: string;
}
export interface GetPinStatusRequest {
userId: string;
sessionId: string;
}
export interface GetPinStatusResponse {
hasPin: boolean;
isLocked: boolean;
lockUntil: string;
}
export interface RemovePinRequest {
pin: string;
userId: string;
sessionId: string;
}
export interface RemovePinResponse {
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 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 const ACCOUNT_V1_PACKAGE_NAME = "account.v1";
export interface AccountServiceClient {
getAccount(request: GetAccountRequest, metadata?: Metadata): Observable<GetAccountResponse>;
changePassword(request: ChangePasswordRequest, metadata?: Metadata): Observable<ChangePasswordResponse>;
adminResetPassword(request: AdminResetPasswordRequest, metadata?: Metadata): Observable<AdminResetPasswordResponse>;
createUser(request: CreateUserRequest, metadata?: Metadata): Observable<CreateUserResponse>;
deleteUser(request: DeleteUserRequest, metadata?: Metadata): Observable<DeleteUserResponse>;
changeData(request: ChangeDataRequest, metadata?: Metadata): Observable<ChangeDataResponse>;
assignRole(request: AssignRoleRequest, metadata?: Metadata): Observable<AssignRoleResponse>;
revokeRole(request: RevokeRoleRequest, metadata?: Metadata): Observable<RevokeRoleResponse>;
setPin(request: SetPinRequest, metadata?: Metadata): Observable<SetPinResponse>;
unlockPin(request: UnlockPinRequest, metadata?: Metadata): Observable<UnlockPinResponse>;
getPinStatus(request: GetPinStatusRequest, metadata?: Metadata): Observable<GetPinStatusResponse>;
removePin(request: RemovePinRequest, metadata?: Metadata): Observable<RemovePinResponse>;
blockUser(request: BlockUserRequest, metadata?: Metadata): Observable<BlockUserResponse>;
unblockUser(request: UnblockUserRequest, metadata?: Metadata): Observable<UnblockUserResponse>;
blockIp(request: BlockIpRequest, metadata?: Metadata): Observable<BlockIpResponse>;
unblockIp(request: UnblockIpRequest, metadata?: Metadata): Observable<UnblockIpResponse>;
}
export interface AccountServiceController {
getAccount(
request: GetAccountRequest,
metadata?: Metadata,
): Promise<GetAccountResponse> | Observable<GetAccountResponse> | GetAccountResponse;
changePassword(
request: ChangePasswordRequest,
metadata?: Metadata,
): Promise<ChangePasswordResponse> | Observable<ChangePasswordResponse> | ChangePasswordResponse;
adminResetPassword(
request: AdminResetPasswordRequest,
metadata?: Metadata,
): Promise<AdminResetPasswordResponse> | Observable<AdminResetPasswordResponse> | AdminResetPasswordResponse;
createUser(
request: CreateUserRequest,
metadata?: Metadata,
): Promise<CreateUserResponse> | Observable<CreateUserResponse> | CreateUserResponse;
deleteUser(
request: DeleteUserRequest,
metadata?: Metadata,
): Promise<DeleteUserResponse> | Observable<DeleteUserResponse> | DeleteUserResponse;
changeData(
request: ChangeDataRequest,
metadata?: Metadata,
): Promise<ChangeDataResponse> | Observable<ChangeDataResponse> | ChangeDataResponse;
assignRole(
request: AssignRoleRequest,
metadata?: Metadata,
): Promise<AssignRoleResponse> | Observable<AssignRoleResponse> | AssignRoleResponse;
revokeRole(
request: RevokeRoleRequest,
metadata?: Metadata,
): Promise<RevokeRoleResponse> | Observable<RevokeRoleResponse> | RevokeRoleResponse;
setPin(
request: SetPinRequest,
metadata?: Metadata,
): Promise<SetPinResponse> | Observable<SetPinResponse> | SetPinResponse;
unlockPin(
request: UnlockPinRequest,
metadata?: Metadata,
): Promise<UnlockPinResponse> | Observable<UnlockPinResponse> | UnlockPinResponse;
getPinStatus(
request: GetPinStatusRequest,
metadata?: Metadata,
): Promise<GetPinStatusResponse> | Observable<GetPinStatusResponse> | GetPinStatusResponse;
removePin(
request: RemovePinRequest,
metadata?: Metadata,
): Promise<RemovePinResponse> | Observable<RemovePinResponse> | RemovePinResponse;
blockUser(
request: BlockUserRequest,
metadata?: Metadata,
): Promise<BlockUserResponse> | Observable<BlockUserResponse> | BlockUserResponse;
unblockUser(
request: UnblockUserRequest,
metadata?: Metadata,
): Promise<UnblockUserResponse> | Observable<UnblockUserResponse> | UnblockUserResponse;
blockIp(
request: BlockIpRequest,
metadata?: Metadata,
): Promise<BlockIpResponse> | Observable<BlockIpResponse> | BlockIpResponse;
unblockIp(
request: UnblockIpRequest,
metadata?: Metadata,
): Promise<UnblockIpResponse> | Observable<UnblockIpResponse> | UnblockIpResponse;
}
export function AccountServiceControllerMethods() {
return function (constructor: Function) {
const grpcMethods: string[] = [
"getAccount",
"changePassword",
"adminResetPassword",
"createUser",
"deleteUser",
"changeData",
"assignRole",
"revokeRole",
"setPin",
"unlockPin",
"getPinStatus",
"removePin",
"blockUser",
"unblockUser",
"blockIp",
"unblockIp",
];
for (const method of grpcMethods) {
const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
GrpcMethod("AccountService", method)(constructor.prototype[method], method, descriptor);
}
const grpcStreamMethods: string[] = [];
for (const method of grpcStreamMethods) {
const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
GrpcStreamMethod("AccountService", method)(constructor.prototype[method], method, descriptor);
}
};
}
export const ACCOUNT_SERVICE_NAME = "AccountService";