diff --git a/gen/account.ts b/gen/account.ts index af72b02..d1dfa9d 100644 --- a/gen/account.ts +++ b/gen/account.ts @@ -36,10 +36,25 @@ export interface GetAccountResponse { hasPin: boolean; } +export interface ChangePasswordRequest { + userId: string; + oldPassword: string; + newPassword: string; + code?: string | undefined; + pin?: string | undefined; +} + +export interface ChangePasswordResponse { + success: boolean; + message: string; +} + export const ACCOUNT_V1_PACKAGE_NAME = "account.v1"; export interface AccountServiceClient { getAccount(request: GetAccountRequest, metadata?: Metadata): Observable; + + changePassword(request: ChangePasswordRequest, metadata?: Metadata): Observable; } export interface AccountServiceController { @@ -47,11 +62,16 @@ export interface AccountServiceController { request: GetAccountRequest, metadata?: Metadata, ): Promise | Observable | GetAccountResponse; + + changePassword( + request: ChangePasswordRequest, + metadata?: Metadata, + ): Promise | Observable | ChangePasswordResponse; } export function AccountServiceControllerMethods() { return function (constructor: Function) { - const grpcMethods: string[] = ["getAccount"]; + const grpcMethods: string[] = ["getAccount", "changePassword"]; for (const method of grpcMethods) { const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method); GrpcMethod("AccountService", method)(constructor.prototype[method], method, descriptor); diff --git a/gen/go/account.pb.go b/gen/go/account.pb.go index 9569501..68f213e 100644 --- a/gen/go/account.pb.go +++ b/gen/go/account.pb.go @@ -245,6 +245,134 @@ func (x *GetAccountResponse) GetHasPin() bool { return false } +type ChangePasswordRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + UserId string `protobuf:"bytes,1,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty"` + OldPassword string `protobuf:"bytes,2,opt,name=old_password,json=oldPassword,proto3" json:"old_password,omitempty"` + NewPassword string `protobuf:"bytes,3,opt,name=new_password,json=newPassword,proto3" json:"new_password,omitempty"` + Code *string `protobuf:"bytes,4,opt,name=code,proto3,oneof" json:"code,omitempty"` + Pin *string `protobuf:"bytes,5,opt,name=pin,proto3,oneof" json:"pin,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ChangePasswordRequest) Reset() { + *x = ChangePasswordRequest{} + mi := &file_account_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ChangePasswordRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ChangePasswordRequest) ProtoMessage() {} + +func (x *ChangePasswordRequest) ProtoReflect() protoreflect.Message { + mi := &file_account_proto_msgTypes[2] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ChangePasswordRequest.ProtoReflect.Descriptor instead. +func (*ChangePasswordRequest) Descriptor() ([]byte, []int) { + return file_account_proto_rawDescGZIP(), []int{2} +} + +func (x *ChangePasswordRequest) GetUserId() string { + if x != nil { + return x.UserId + } + return "" +} + +func (x *ChangePasswordRequest) GetOldPassword() string { + if x != nil { + return x.OldPassword + } + return "" +} + +func (x *ChangePasswordRequest) GetNewPassword() string { + if x != nil { + return x.NewPassword + } + return "" +} + +func (x *ChangePasswordRequest) GetCode() string { + if x != nil && x.Code != nil { + return *x.Code + } + return "" +} + +func (x *ChangePasswordRequest) GetPin() string { + if x != nil && x.Pin != nil { + return *x.Pin + } + return "" +} + +type ChangePasswordResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"` + Message string `protobuf:"bytes,2,opt,name=message,proto3" json:"message,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ChangePasswordResponse) Reset() { + *x = ChangePasswordResponse{} + mi := &file_account_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ChangePasswordResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ChangePasswordResponse) ProtoMessage() {} + +func (x *ChangePasswordResponse) ProtoReflect() protoreflect.Message { + mi := &file_account_proto_msgTypes[3] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ChangePasswordResponse.ProtoReflect.Descriptor instead. +func (*ChangePasswordResponse) Descriptor() ([]byte, []int) { + return file_account_proto_rawDescGZIP(), []int{3} +} + +func (x *ChangePasswordResponse) GetSuccess() bool { + if x != nil { + return x.Success + } + return false +} + +func (x *ChangePasswordResponse) GetMessage() string { + if x != nil { + return x.Message + } + return "" +} + var File_account_proto protoreflect.FileDescriptor const file_account_proto_rawDesc = "" + @@ -276,10 +404,22 @@ const file_account_proto_rawDesc = "" + "\blanguage\x18\x10 \x01(\tR\blanguage\x12$\n" + "\x0etwo_fa_enabled\x18\x11 \x01(\bR\ftwoFaEnabled\x12\x17\n" + "\ahas_pin\x18\x12 \x01(\bR\x06hasPinB\x0e\n" + - "\f_employee_id2]\n" + + "\f_employee_id\"\xb7\x01\n" + + "\x15ChangePasswordRequest\x12\x17\n" + + "\auser_id\x18\x01 \x01(\tR\x06userId\x12!\n" + + "\fold_password\x18\x02 \x01(\tR\voldPassword\x12!\n" + + "\fnew_password\x18\x03 \x01(\tR\vnewPassword\x12\x17\n" + + "\x04code\x18\x04 \x01(\tH\x00R\x04code\x88\x01\x01\x12\x15\n" + + "\x03pin\x18\x05 \x01(\tH\x01R\x03pin\x88\x01\x01B\a\n" + + "\x05_codeB\x06\n" + + "\x04_pin\"L\n" + + "\x16ChangePasswordResponse\x12\x18\n" + + "\asuccess\x18\x01 \x01(\bR\asuccess\x12\x18\n" + + "\amessage\x18\x02 \x01(\tR\amessage2\xb6\x01\n" + "\x0eAccountService\x12K\n" + "\n" + - "GetAccount\x12\x1d.account.v1.GetAccountRequest\x1a\x1e.account.v1.GetAccountResponseB*Z(git.lendry.ru/lendry-erp/proto.git/go;pbb\x06proto3" + "GetAccount\x12\x1d.account.v1.GetAccountRequest\x1a\x1e.account.v1.GetAccountResponse\x12W\n" + + "\x0eChangePassword\x12!.account.v1.ChangePasswordRequest\x1a\".account.v1.ChangePasswordResponseB*Z(git.lendry.ru/lendry-erp/proto.git/go;pbb\x06proto3" var ( file_account_proto_rawDescOnce sync.Once @@ -293,16 +433,20 @@ func file_account_proto_rawDescGZIP() []byte { return file_account_proto_rawDescData } -var file_account_proto_msgTypes = make([]protoimpl.MessageInfo, 2) +var file_account_proto_msgTypes = make([]protoimpl.MessageInfo, 4) var file_account_proto_goTypes = []any{ - (*GetAccountRequest)(nil), // 0: account.v1.GetAccountRequest - (*GetAccountResponse)(nil), // 1: account.v1.GetAccountResponse + (*GetAccountRequest)(nil), // 0: account.v1.GetAccountRequest + (*GetAccountResponse)(nil), // 1: account.v1.GetAccountResponse + (*ChangePasswordRequest)(nil), // 2: account.v1.ChangePasswordRequest + (*ChangePasswordResponse)(nil), // 3: account.v1.ChangePasswordResponse } var file_account_proto_depIdxs = []int32{ 0, // 0: account.v1.AccountService.GetAccount:input_type -> account.v1.GetAccountRequest - 1, // 1: account.v1.AccountService.GetAccount:output_type -> account.v1.GetAccountResponse - 1, // [1:2] is the sub-list for method output_type - 0, // [0:1] is the sub-list for method input_type + 2, // 1: account.v1.AccountService.ChangePassword:input_type -> account.v1.ChangePasswordRequest + 1, // 2: account.v1.AccountService.GetAccount:output_type -> account.v1.GetAccountResponse + 3, // 3: account.v1.AccountService.ChangePassword:output_type -> account.v1.ChangePasswordResponse + 2, // [2:4] is the sub-list for method output_type + 0, // [0:2] is the sub-list for method input_type 0, // [0:0] is the sub-list for extension type_name 0, // [0:0] is the sub-list for extension extendee 0, // [0:0] is the sub-list for field type_name @@ -314,13 +458,14 @@ func file_account_proto_init() { return } file_account_proto_msgTypes[1].OneofWrappers = []any{} + file_account_proto_msgTypes[2].OneofWrappers = []any{} type x struct{} out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: unsafe.Slice(unsafe.StringData(file_account_proto_rawDesc), len(file_account_proto_rawDesc)), NumEnums: 0, - NumMessages: 2, + NumMessages: 4, NumExtensions: 0, NumServices: 1, }, diff --git a/gen/go/account_grpc.pb.go b/gen/go/account_grpc.pb.go index 6fe6054..8544f7a 100644 --- a/gen/go/account_grpc.pb.go +++ b/gen/go/account_grpc.pb.go @@ -19,7 +19,8 @@ import ( const _ = grpc.SupportPackageIsVersion9 const ( - AccountService_GetAccount_FullMethodName = "/account.v1.AccountService/GetAccount" + AccountService_GetAccount_FullMethodName = "/account.v1.AccountService/GetAccount" + AccountService_ChangePassword_FullMethodName = "/account.v1.AccountService/ChangePassword" ) // AccountServiceClient is the client API for AccountService service. @@ -27,6 +28,7 @@ const ( // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. type AccountServiceClient interface { GetAccount(ctx context.Context, in *GetAccountRequest, opts ...grpc.CallOption) (*GetAccountResponse, error) + ChangePassword(ctx context.Context, in *ChangePasswordRequest, opts ...grpc.CallOption) (*ChangePasswordResponse, error) } type accountServiceClient struct { @@ -47,11 +49,22 @@ func (c *accountServiceClient) GetAccount(ctx context.Context, in *GetAccountReq return out, nil } +func (c *accountServiceClient) ChangePassword(ctx context.Context, in *ChangePasswordRequest, opts ...grpc.CallOption) (*ChangePasswordResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(ChangePasswordResponse) + err := c.cc.Invoke(ctx, AccountService_ChangePassword_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + // AccountServiceServer is the server API for AccountService service. // All implementations must embed UnimplementedAccountServiceServer // for forward compatibility. type AccountServiceServer interface { GetAccount(context.Context, *GetAccountRequest) (*GetAccountResponse, error) + ChangePassword(context.Context, *ChangePasswordRequest) (*ChangePasswordResponse, error) mustEmbedUnimplementedAccountServiceServer() } @@ -65,6 +78,9 @@ type UnimplementedAccountServiceServer struct{} func (UnimplementedAccountServiceServer) GetAccount(context.Context, *GetAccountRequest) (*GetAccountResponse, error) { return nil, status.Error(codes.Unimplemented, "method GetAccount not implemented") } +func (UnimplementedAccountServiceServer) ChangePassword(context.Context, *ChangePasswordRequest) (*ChangePasswordResponse, error) { + return nil, status.Error(codes.Unimplemented, "method ChangePassword not implemented") +} func (UnimplementedAccountServiceServer) mustEmbedUnimplementedAccountServiceServer() {} func (UnimplementedAccountServiceServer) testEmbeddedByValue() {} @@ -104,6 +120,24 @@ func _AccountService_GetAccount_Handler(srv interface{}, ctx context.Context, de return interceptor(ctx, in, info, handler) } +func _AccountService_ChangePassword_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ChangePasswordRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(AccountServiceServer).ChangePassword(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: AccountService_ChangePassword_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(AccountServiceServer).ChangePassword(ctx, req.(*ChangePasswordRequest)) + } + return interceptor(ctx, in, info, handler) +} + // AccountService_ServiceDesc is the grpc.ServiceDesc for AccountService service. // It's only intended for direct use with grpc.RegisterService, // and not to be introspected or modified (even as a copy) @@ -115,6 +149,10 @@ var AccountService_ServiceDesc = grpc.ServiceDesc{ MethodName: "GetAccount", Handler: _AccountService_GetAccount_Handler, }, + { + MethodName: "ChangePassword", + Handler: _AccountService_ChangePassword_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "account.proto",