diff --git a/gen/go/users/users.pb.go b/gen/go/users/users.pb.go index a4d7b7f..af5feaa 100644 --- a/gen/go/users/users.pb.go +++ b/gen/go/users/users.pb.go @@ -21,27 +21,27 @@ const ( _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) ) -type GetMeRequest struct { +type GetProfileRequest struct { state protoimpl.MessageState `protogen:"open.v1"` - Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + UserId string `protobuf:"bytes,1,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty"` // Берется из access токена на API шлюзе unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache } -func (x *GetMeRequest) Reset() { - *x = GetMeRequest{} +func (x *GetProfileRequest) Reset() { + *x = GetProfileRequest{} mi := &file_users_users_proto_msgTypes[0] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } -func (x *GetMeRequest) String() string { +func (x *GetProfileRequest) String() string { return protoimpl.X.MessageStringOf(x) } -func (*GetMeRequest) ProtoMessage() {} +func (*GetProfileRequest) ProtoMessage() {} -func (x *GetMeRequest) ProtoReflect() protoreflect.Message { +func (x *GetProfileRequest) ProtoReflect() protoreflect.Message { mi := &file_users_users_proto_msgTypes[0] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -53,275 +53,251 @@ func (x *GetMeRequest) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use GetMeRequest.ProtoReflect.Descriptor instead. -func (*GetMeRequest) Descriptor() ([]byte, []int) { +// Deprecated: Use GetProfileRequest.ProtoReflect.Descriptor instead. +func (*GetProfileRequest) Descriptor() ([]byte, []int) { return file_users_users_proto_rawDescGZIP(), []int{0} } -func (x *GetMeRequest) GetId() string { - if x != nil { - return x.Id - } - return "" -} - -type GetMeResponse struct { - state protoimpl.MessageState `protogen:"open.v1"` - User *User `protobuf:"bytes,1,opt,name=user,proto3" json:"user,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *GetMeResponse) Reset() { - *x = GetMeResponse{} - mi := &file_users_users_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *GetMeResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*GetMeResponse) ProtoMessage() {} - -func (x *GetMeResponse) ProtoReflect() protoreflect.Message { - mi := &file_users_users_proto_msgTypes[1] - 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 GetMeResponse.ProtoReflect.Descriptor instead. -func (*GetMeResponse) Descriptor() ([]byte, []int) { - return file_users_users_proto_rawDescGZIP(), []int{1} -} - -func (x *GetMeResponse) GetUser() *User { - if x != nil { - return x.User - } - return nil -} - -type CreateUserRequest struct { - state protoimpl.MessageState `protogen:"open.v1"` - Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *CreateUserRequest) Reset() { - *x = CreateUserRequest{} - mi := &file_users_users_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *CreateUserRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*CreateUserRequest) ProtoMessage() {} - -func (x *CreateUserRequest) ProtoReflect() protoreflect.Message { - mi := &file_users_users_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 CreateUserRequest.ProtoReflect.Descriptor instead. -func (*CreateUserRequest) Descriptor() ([]byte, []int) { - return file_users_users_proto_rawDescGZIP(), []int{2} -} - -func (x *CreateUserRequest) GetId() string { - if x != nil { - return x.Id - } - return "" -} - -type CreateUserResponse struct { - state protoimpl.MessageState `protogen:"open.v1"` - Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *CreateUserResponse) Reset() { - *x = CreateUserResponse{} - mi := &file_users_users_proto_msgTypes[3] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *CreateUserResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*CreateUserResponse) ProtoMessage() {} - -func (x *CreateUserResponse) ProtoReflect() protoreflect.Message { - mi := &file_users_users_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 CreateUserResponse.ProtoReflect.Descriptor instead. -func (*CreateUserResponse) Descriptor() ([]byte, []int) { - return file_users_users_proto_rawDescGZIP(), []int{3} -} - -func (x *CreateUserResponse) GetSuccess() bool { - if x != nil { - return x.Success - } - return false -} - -type ChangeMeRequest struct { - state protoimpl.MessageState `protogen:"open.v1"` - UserId string `protobuf:"bytes,1,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty"` - SessionId string `protobuf:"bytes,2,opt,name=session_id,json=sessionId,proto3" json:"session_id,omitempty"` - Email *string `protobuf:"bytes,3,opt,name=email,proto3,oneof" json:"email,omitempty"` - Phone *string `protobuf:"bytes,4,opt,name=phone,proto3,oneof" json:"phone,omitempty"` - FullName *string `protobuf:"bytes,5,opt,name=full_name,json=fullName,proto3,oneof" json:"full_name,omitempty"` - AvatarUrl *string `protobuf:"bytes,6,opt,name=avatar_url,json=avatarUrl,proto3,oneof" json:"avatar_url,omitempty"` - CustomStatusText *string `protobuf:"bytes,7,opt,name=custom_status_text,json=customStatusText,proto3,oneof" json:"custom_status_text,omitempty"` - CustomStatusEmoji *string `protobuf:"bytes,8,opt,name=custom_status_emoji,json=customStatusEmoji,proto3,oneof" json:"custom_status_emoji,omitempty"` - Timezone *string `protobuf:"bytes,9,opt,name=timezone,proto3,oneof" json:"timezone,omitempty"` - Language *string `protobuf:"bytes,10,opt,name=language,proto3,oneof" json:"language,omitempty"` - IsPublic *bool `protobuf:"varint,11,opt,name=is_public,json=isPublic,proto3,oneof" json:"is_public,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *ChangeMeRequest) Reset() { - *x = ChangeMeRequest{} - mi := &file_users_users_proto_msgTypes[4] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *ChangeMeRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ChangeMeRequest) ProtoMessage() {} - -func (x *ChangeMeRequest) ProtoReflect() protoreflect.Message { - mi := &file_users_users_proto_msgTypes[4] - 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 ChangeMeRequest.ProtoReflect.Descriptor instead. -func (*ChangeMeRequest) Descriptor() ([]byte, []int) { - return file_users_users_proto_rawDescGZIP(), []int{4} -} - -func (x *ChangeMeRequest) GetUserId() string { +func (x *GetProfileRequest) GetUserId() string { if x != nil { return x.UserId } return "" } -func (x *ChangeMeRequest) GetSessionId() string { +type GetProfileResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + Email *string `protobuf:"bytes,2,opt,name=email,proto3,oneof" json:"email,omitempty"` + Phone *string `protobuf:"bytes,3,opt,name=phone,proto3,oneof" json:"phone,omitempty"` + FullName *string `protobuf:"bytes,4,opt,name=full_name,json=fullName,proto3,oneof" json:"full_name,omitempty"` + AvatarUrl *string `protobuf:"bytes,5,opt,name=avatar_url,json=avatarUrl,proto3,oneof" json:"avatar_url,omitempty"` + IsPublic bool `protobuf:"varint,6,opt,name=is_public,json=isPublic,proto3" json:"is_public,omitempty"` + Timezone string `protobuf:"bytes,7,opt,name=timezone,proto3" json:"timezone,omitempty"` + Language string `protobuf:"bytes,8,opt,name=language,proto3" json:"language,omitempty"` + CustomStatusText *string `protobuf:"bytes,9,opt,name=custom_status_text,json=customStatusText,proto3,oneof" json:"custom_status_text,omitempty"` + CustomStatusEmoji *string `protobuf:"bytes,10,opt,name=custom_status_emoji,json=customStatusEmoji,proto3,oneof" json:"custom_status_emoji,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetProfileResponse) Reset() { + *x = GetProfileResponse{} + mi := &file_users_users_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetProfileResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetProfileResponse) ProtoMessage() {} + +func (x *GetProfileResponse) ProtoReflect() protoreflect.Message { + mi := &file_users_users_proto_msgTypes[1] if x != nil { - return x.SessionId + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetProfileResponse.ProtoReflect.Descriptor instead. +func (*GetProfileResponse) Descriptor() ([]byte, []int) { + return file_users_users_proto_rawDescGZIP(), []int{1} +} + +func (x *GetProfileResponse) GetId() string { + if x != nil { + return x.Id } return "" } -func (x *ChangeMeRequest) GetEmail() string { +func (x *GetProfileResponse) GetEmail() string { if x != nil && x.Email != nil { return *x.Email } return "" } -func (x *ChangeMeRequest) GetPhone() string { +func (x *GetProfileResponse) GetPhone() string { if x != nil && x.Phone != nil { return *x.Phone } return "" } -func (x *ChangeMeRequest) GetFullName() string { +func (x *GetProfileResponse) GetFullName() string { if x != nil && x.FullName != nil { return *x.FullName } return "" } -func (x *ChangeMeRequest) GetAvatarUrl() string { +func (x *GetProfileResponse) GetAvatarUrl() string { if x != nil && x.AvatarUrl != nil { return *x.AvatarUrl } return "" } -func (x *ChangeMeRequest) GetCustomStatusText() string { +func (x *GetProfileResponse) GetIsPublic() bool { + if x != nil { + return x.IsPublic + } + return false +} + +func (x *GetProfileResponse) GetTimezone() string { + if x != nil { + return x.Timezone + } + return "" +} + +func (x *GetProfileResponse) GetLanguage() string { + if x != nil { + return x.Language + } + return "" +} + +func (x *GetProfileResponse) GetCustomStatusText() string { if x != nil && x.CustomStatusText != nil { return *x.CustomStatusText } return "" } -func (x *ChangeMeRequest) GetCustomStatusEmoji() string { +func (x *GetProfileResponse) GetCustomStatusEmoji() string { if x != nil && x.CustomStatusEmoji != nil { return *x.CustomStatusEmoji } return "" } -func (x *ChangeMeRequest) GetTimezone() string { +type UpdateProfileRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + UserId string `protobuf:"bytes,1,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty"` + Email *string `protobuf:"bytes,2,opt,name=email,proto3,oneof" json:"email,omitempty"` + Phone *string `protobuf:"bytes,3,opt,name=phone,proto3,oneof" json:"phone,omitempty"` + FullName *string `protobuf:"bytes,4,opt,name=full_name,json=fullName,proto3,oneof" json:"full_name,omitempty"` + AvatarUrl *string `protobuf:"bytes,5,opt,name=avatar_url,json=avatarUrl,proto3,oneof" json:"avatar_url,omitempty"` + CustomStatusText *string `protobuf:"bytes,6,opt,name=custom_status_text,json=customStatusText,proto3,oneof" json:"custom_status_text,omitempty"` + CustomStatusEmoji *string `protobuf:"bytes,7,opt,name=custom_status_emoji,json=customStatusEmoji,proto3,oneof" json:"custom_status_emoji,omitempty"` + Timezone *string `protobuf:"bytes,8,opt,name=timezone,proto3,oneof" json:"timezone,omitempty"` + Language *string `protobuf:"bytes,9,opt,name=language,proto3,oneof" json:"language,omitempty"` + IsPublic *bool `protobuf:"varint,10,opt,name=is_public,json=isPublic,proto3,oneof" json:"is_public,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *UpdateProfileRequest) Reset() { + *x = UpdateProfileRequest{} + mi := &file_users_users_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *UpdateProfileRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UpdateProfileRequest) ProtoMessage() {} + +func (x *UpdateProfileRequest) ProtoReflect() protoreflect.Message { + mi := &file_users_users_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 UpdateProfileRequest.ProtoReflect.Descriptor instead. +func (*UpdateProfileRequest) Descriptor() ([]byte, []int) { + return file_users_users_proto_rawDescGZIP(), []int{2} +} + +func (x *UpdateProfileRequest) GetUserId() string { + if x != nil { + return x.UserId + } + return "" +} + +func (x *UpdateProfileRequest) GetEmail() string { + if x != nil && x.Email != nil { + return *x.Email + } + return "" +} + +func (x *UpdateProfileRequest) GetPhone() string { + if x != nil && x.Phone != nil { + return *x.Phone + } + return "" +} + +func (x *UpdateProfileRequest) GetFullName() string { + if x != nil && x.FullName != nil { + return *x.FullName + } + return "" +} + +func (x *UpdateProfileRequest) GetAvatarUrl() string { + if x != nil && x.AvatarUrl != nil { + return *x.AvatarUrl + } + return "" +} + +func (x *UpdateProfileRequest) GetCustomStatusText() string { + if x != nil && x.CustomStatusText != nil { + return *x.CustomStatusText + } + return "" +} + +func (x *UpdateProfileRequest) GetCustomStatusEmoji() string { + if x != nil && x.CustomStatusEmoji != nil { + return *x.CustomStatusEmoji + } + return "" +} + +func (x *UpdateProfileRequest) GetTimezone() string { if x != nil && x.Timezone != nil { return *x.Timezone } return "" } -func (x *ChangeMeRequest) GetLanguage() string { +func (x *UpdateProfileRequest) GetLanguage() string { if x != nil && x.Language != nil { return *x.Language } return "" } -func (x *ChangeMeRequest) GetIsPublic() bool { +func (x *UpdateProfileRequest) GetIsPublic() bool { if x != nil && x.IsPublic != nil { return *x.IsPublic } return false } -type ChangeMeResponse struct { +type UpdateProfileResponse 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"` @@ -329,21 +305,21 @@ type ChangeMeResponse struct { sizeCache protoimpl.SizeCache } -func (x *ChangeMeResponse) Reset() { - *x = ChangeMeResponse{} - mi := &file_users_users_proto_msgTypes[5] +func (x *UpdateProfileResponse) Reset() { + *x = UpdateProfileResponse{} + mi := &file_users_users_proto_msgTypes[3] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } -func (x *ChangeMeResponse) String() string { +func (x *UpdateProfileResponse) String() string { return protoimpl.X.MessageStringOf(x) } -func (*ChangeMeResponse) ProtoMessage() {} +func (*UpdateProfileResponse) ProtoMessage() {} -func (x *ChangeMeResponse) ProtoReflect() protoreflect.Message { - mi := &file_users_users_proto_msgTypes[5] +func (x *UpdateProfileResponse) ProtoReflect() protoreflect.Message { + mi := &file_users_users_proto_msgTypes[3] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -354,64 +330,52 @@ func (x *ChangeMeResponse) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use ChangeMeResponse.ProtoReflect.Descriptor instead. -func (*ChangeMeResponse) Descriptor() ([]byte, []int) { - return file_users_users_proto_rawDescGZIP(), []int{5} +// Deprecated: Use UpdateProfileResponse.ProtoReflect.Descriptor instead. +func (*UpdateProfileResponse) Descriptor() ([]byte, []int) { + return file_users_users_proto_rawDescGZIP(), []int{3} } -func (x *ChangeMeResponse) GetSuccess() bool { +func (x *UpdateProfileResponse) GetSuccess() bool { if x != nil { return x.Success } return false } -func (x *ChangeMeResponse) GetMessage() string { +func (x *UpdateProfileResponse) GetMessage() string { if x != nil { return x.Message } return "" } -type User struct { - state protoimpl.MessageState `protogen:"open.v1"` - Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` - Username *string `protobuf:"bytes,2,opt,name=username,proto3,oneof" json:"username,omitempty"` - Email *string `protobuf:"bytes,3,opt,name=email,proto3,oneof" json:"email,omitempty"` - Phone *string `protobuf:"bytes,4,opt,name=phone,proto3,oneof" json:"phone,omitempty"` - FullName *string `protobuf:"bytes,5,opt,name=full_name,json=fullName,proto3,oneof" json:"full_name,omitempty"` - IsLdap bool `protobuf:"varint,6,opt,name=is_ldap,json=isLdap,proto3" json:"is_ldap,omitempty"` - Status *string `protobuf:"bytes,7,opt,name=status,proto3,oneof" json:"status,omitempty"` - Roles []string `protobuf:"bytes,8,rep,name=roles,proto3" json:"roles,omitempty"` - AvatarUrl *string `protobuf:"bytes,9,opt,name=avatar_url,json=avatarUrl,proto3,oneof" json:"avatar_url,omitempty"` - EmployeeId *string `protobuf:"bytes,10,opt,name=employee_id,json=employeeId,proto3,oneof" json:"employee_id,omitempty"` - Presence *string `protobuf:"bytes,11,opt,name=presence,proto3,oneof" json:"presence,omitempty"` - LastActive *string `protobuf:"bytes,12,opt,name=last_active,json=lastActive,proto3,oneof" json:"last_active,omitempty"` - CustomStatusText *string `protobuf:"bytes,13,opt,name=custom_status_text,json=customStatusText,proto3,oneof" json:"custom_status_text,omitempty"` - CustomStatusEmoji *string `protobuf:"bytes,14,opt,name=custom_status_emoji,json=customStatusEmoji,proto3,oneof" json:"custom_status_emoji,omitempty"` - Timezone *string `protobuf:"bytes,15,opt,name=timezone,proto3,oneof" json:"timezone,omitempty"` - Language *string `protobuf:"bytes,16,opt,name=language,proto3,oneof" json:"language,omitempty"` - TwoFaEnabled bool `protobuf:"varint,17,opt,name=two_fa_enabled,json=twoFaEnabled,proto3" json:"two_fa_enabled,omitempty"` - HasPin bool `protobuf:"varint,18,opt,name=has_pin,json=hasPin,proto3" json:"has_pin,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache +// Вызывается другими сервисами при создании аккаунта +type CreateProfileRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + UserId string `protobuf:"bytes,1,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty"` // Обязательно передаем ID созданного аккаунта! + Email *string `protobuf:"bytes,2,opt,name=email,proto3,oneof" json:"email,omitempty"` + FullName *string `protobuf:"bytes,3,opt,name=full_name,json=fullName,proto3,oneof" json:"full_name,omitempty"` + Phone *string `protobuf:"bytes,4,opt,name=phone,proto3,oneof" json:"phone,omitempty"` + AvatarUrl *string `protobuf:"bytes,5,opt,name=avatar_url,json=avatarUrl,proto3,oneof" json:"avatar_url,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } -func (x *User) Reset() { - *x = User{} - mi := &file_users_users_proto_msgTypes[6] +func (x *CreateProfileRequest) Reset() { + *x = CreateProfileRequest{} + mi := &file_users_users_proto_msgTypes[4] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } -func (x *User) String() string { +func (x *CreateProfileRequest) String() string { return protoimpl.X.MessageStringOf(x) } -func (*User) ProtoMessage() {} +func (*CreateProfileRequest) ProtoMessage() {} -func (x *User) ProtoReflect() protoreflect.Message { - mi := &file_users_users_proto_msgTypes[6] +func (x *CreateProfileRequest) ProtoReflect() protoreflect.Message { + mi := &file_users_users_proto_msgTypes[4] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -422,133 +386,86 @@ func (x *User) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use User.ProtoReflect.Descriptor instead. -func (*User) Descriptor() ([]byte, []int) { - return file_users_users_proto_rawDescGZIP(), []int{6} +// Deprecated: Use CreateProfileRequest.ProtoReflect.Descriptor instead. +func (*CreateProfileRequest) Descriptor() ([]byte, []int) { + return file_users_users_proto_rawDescGZIP(), []int{4} } -func (x *User) GetId() string { +func (x *CreateProfileRequest) GetUserId() string { if x != nil { - return x.Id + return x.UserId } return "" } -func (x *User) GetUsername() string { - if x != nil && x.Username != nil { - return *x.Username - } - return "" -} - -func (x *User) GetEmail() string { +func (x *CreateProfileRequest) GetEmail() string { if x != nil && x.Email != nil { return *x.Email } return "" } -func (x *User) GetPhone() string { - if x != nil && x.Phone != nil { - return *x.Phone - } - return "" -} - -func (x *User) GetFullName() string { +func (x *CreateProfileRequest) GetFullName() string { if x != nil && x.FullName != nil { return *x.FullName } return "" } -func (x *User) GetIsLdap() bool { - if x != nil { - return x.IsLdap - } - return false -} - -func (x *User) GetStatus() string { - if x != nil && x.Status != nil { - return *x.Status +func (x *CreateProfileRequest) GetPhone() string { + if x != nil && x.Phone != nil { + return *x.Phone } return "" } -func (x *User) GetRoles() []string { - if x != nil { - return x.Roles - } - return nil -} - -func (x *User) GetAvatarUrl() string { +func (x *CreateProfileRequest) GetAvatarUrl() string { if x != nil && x.AvatarUrl != nil { return *x.AvatarUrl } return "" } -func (x *User) GetEmployeeId() string { - if x != nil && x.EmployeeId != nil { - return *x.EmployeeId - } - return "" +type CreateProfileResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } -func (x *User) GetPresence() string { - if x != nil && x.Presence != nil { - return *x.Presence - } - return "" +func (x *CreateProfileResponse) Reset() { + *x = CreateProfileResponse{} + mi := &file_users_users_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } -func (x *User) GetLastActive() string { - if x != nil && x.LastActive != nil { - return *x.LastActive - } - return "" +func (x *CreateProfileResponse) String() string { + return protoimpl.X.MessageStringOf(x) } -func (x *User) GetCustomStatusText() string { - if x != nil && x.CustomStatusText != nil { - return *x.CustomStatusText - } - return "" -} +func (*CreateProfileResponse) ProtoMessage() {} -func (x *User) GetCustomStatusEmoji() string { - if x != nil && x.CustomStatusEmoji != nil { - return *x.CustomStatusEmoji - } - return "" -} - -func (x *User) GetTimezone() string { - if x != nil && x.Timezone != nil { - return *x.Timezone - } - return "" -} - -func (x *User) GetLanguage() string { - if x != nil && x.Language != nil { - return *x.Language - } - return "" -} - -func (x *User) GetTwoFaEnabled() bool { +func (x *CreateProfileResponse) ProtoReflect() protoreflect.Message { + mi := &file_users_users_proto_msgTypes[5] if x != nil { - return x.TwoFaEnabled + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms } - return false + return mi.MessageOf(x) } -func (x *User) GetHasPin() bool { +// Deprecated: Use CreateProfileResponse.ProtoReflect.Descriptor instead. +func (*CreateProfileResponse) Descriptor() ([]byte, []int) { + return file_users_users_proto_rawDescGZIP(), []int{5} +} + +func (x *CreateProfileResponse) GetSuccess() bool { if x != nil { - return x.HasPin + return x.Success } return false } @@ -557,30 +474,42 @@ var File_users_users_proto protoreflect.FileDescriptor const file_users_users_proto_rawDesc = "" + "\n" + - "\x11users/users.proto\x12\busers.v1\"\x1e\n" + - "\fGetMeRequest\x12\x0e\n" + - "\x02id\x18\x01 \x01(\tR\x02id\"3\n" + - "\rGetMeResponse\x12\"\n" + - "\x04user\x18\x01 \x01(\v2\x0e.users.v1.UserR\x04user\"#\n" + - "\x11CreateUserRequest\x12\x0e\n" + - "\x02id\x18\x01 \x01(\tR\x02id\".\n" + - "\x12CreateUserResponse\x12\x18\n" + - "\asuccess\x18\x01 \x01(\bR\asuccess\"\x99\x04\n" + - "\x0fChangeMeRequest\x12\x17\n" + - "\auser_id\x18\x01 \x01(\tR\x06userId\x12\x1d\n" + + "\x11users/users.proto\x12\busers.v1\",\n" + + "\x11GetProfileRequest\x12\x17\n" + + "\auser_id\x18\x01 \x01(\tR\x06userId\"\xbd\x03\n" + + "\x12GetProfileResponse\x12\x0e\n" + + "\x02id\x18\x01 \x01(\tR\x02id\x12\x19\n" + + "\x05email\x18\x02 \x01(\tH\x00R\x05email\x88\x01\x01\x12\x19\n" + + "\x05phone\x18\x03 \x01(\tH\x01R\x05phone\x88\x01\x01\x12 \n" + + "\tfull_name\x18\x04 \x01(\tH\x02R\bfullName\x88\x01\x01\x12\"\n" + "\n" + - "session_id\x18\x02 \x01(\tR\tsessionId\x12\x19\n" + - "\x05email\x18\x03 \x01(\tH\x00R\x05email\x88\x01\x01\x12\x19\n" + - "\x05phone\x18\x04 \x01(\tH\x01R\x05phone\x88\x01\x01\x12 \n" + - "\tfull_name\x18\x05 \x01(\tH\x02R\bfullName\x88\x01\x01\x12\"\n" + + "avatar_url\x18\x05 \x01(\tH\x03R\tavatarUrl\x88\x01\x01\x12\x1b\n" + + "\tis_public\x18\x06 \x01(\bR\bisPublic\x12\x1a\n" + + "\btimezone\x18\a \x01(\tR\btimezone\x12\x1a\n" + + "\blanguage\x18\b \x01(\tR\blanguage\x121\n" + + "\x12custom_status_text\x18\t \x01(\tH\x04R\x10customStatusText\x88\x01\x01\x123\n" + + "\x13custom_status_emoji\x18\n" + + " \x01(\tH\x05R\x11customStatusEmoji\x88\x01\x01B\b\n" + + "\x06_emailB\b\n" + + "\x06_phoneB\f\n" + "\n" + - "avatar_url\x18\x06 \x01(\tH\x03R\tavatarUrl\x88\x01\x01\x121\n" + - "\x12custom_status_text\x18\a \x01(\tH\x04R\x10customStatusText\x88\x01\x01\x123\n" + - "\x13custom_status_emoji\x18\b \x01(\tH\x05R\x11customStatusEmoji\x88\x01\x01\x12\x1f\n" + - "\btimezone\x18\t \x01(\tH\x06R\btimezone\x88\x01\x01\x12\x1f\n" + - "\blanguage\x18\n" + - " \x01(\tH\aR\blanguage\x88\x01\x01\x12 \n" + - "\tis_public\x18\v \x01(\bH\bR\bisPublic\x88\x01\x01B\b\n" + + "_full_nameB\r\n" + + "\v_avatar_urlB\x15\n" + + "\x13_custom_status_textB\x16\n" + + "\x14_custom_status_emoji\"\xff\x03\n" + + "\x14UpdateProfileRequest\x12\x17\n" + + "\auser_id\x18\x01 \x01(\tR\x06userId\x12\x19\n" + + "\x05email\x18\x02 \x01(\tH\x00R\x05email\x88\x01\x01\x12\x19\n" + + "\x05phone\x18\x03 \x01(\tH\x01R\x05phone\x88\x01\x01\x12 \n" + + "\tfull_name\x18\x04 \x01(\tH\x02R\bfullName\x88\x01\x01\x12\"\n" + + "\n" + + "avatar_url\x18\x05 \x01(\tH\x03R\tavatarUrl\x88\x01\x01\x121\n" + + "\x12custom_status_text\x18\x06 \x01(\tH\x04R\x10customStatusText\x88\x01\x01\x123\n" + + "\x13custom_status_emoji\x18\a \x01(\tH\x05R\x11customStatusEmoji\x88\x01\x01\x12\x1f\n" + + "\btimezone\x18\b \x01(\tH\x06R\btimezone\x88\x01\x01\x12\x1f\n" + + "\blanguage\x18\t \x01(\tH\aR\blanguage\x88\x01\x01\x12 \n" + + "\tis_public\x18\n" + + " \x01(\bH\bR\bisPublic\x88\x01\x01B\b\n" + "\x06_emailB\b\n" + "\x06_phoneB\f\n" + "\n" + @@ -591,53 +520,29 @@ const file_users_users_proto_rawDesc = "" + "\t_timezoneB\v\n" + "\t_languageB\f\n" + "\n" + - "_is_public\"F\n" + - "\x10ChangeMeResponse\x12\x18\n" + + "_is_public\"K\n" + + "\x15UpdateProfileResponse\x12\x18\n" + "\asuccess\x18\x01 \x01(\bR\asuccess\x12\x18\n" + - "\amessage\x18\x02 \x01(\tR\amessage\"\x94\x06\n" + - "\x04User\x12\x0e\n" + - "\x02id\x18\x01 \x01(\tR\x02id\x12\x1f\n" + - "\busername\x18\x02 \x01(\tH\x00R\busername\x88\x01\x01\x12\x19\n" + - "\x05email\x18\x03 \x01(\tH\x01R\x05email\x88\x01\x01\x12\x19\n" + - "\x05phone\x18\x04 \x01(\tH\x02R\x05phone\x88\x01\x01\x12 \n" + - "\tfull_name\x18\x05 \x01(\tH\x03R\bfullName\x88\x01\x01\x12\x17\n" + - "\ais_ldap\x18\x06 \x01(\bR\x06isLdap\x12\x1b\n" + - "\x06status\x18\a \x01(\tH\x04R\x06status\x88\x01\x01\x12\x14\n" + - "\x05roles\x18\b \x03(\tR\x05roles\x12\"\n" + + "\amessage\x18\x02 \x01(\tR\amessage\"\xdc\x01\n" + + "\x14CreateProfileRequest\x12\x17\n" + + "\auser_id\x18\x01 \x01(\tR\x06userId\x12\x19\n" + + "\x05email\x18\x02 \x01(\tH\x00R\x05email\x88\x01\x01\x12 \n" + + "\tfull_name\x18\x03 \x01(\tH\x01R\bfullName\x88\x01\x01\x12\x19\n" + + "\x05phone\x18\x04 \x01(\tH\x02R\x05phone\x88\x01\x01\x12\"\n" + "\n" + - "avatar_url\x18\t \x01(\tH\x05R\tavatarUrl\x88\x01\x01\x12$\n" + - "\vemployee_id\x18\n" + - " \x01(\tH\x06R\n" + - "employeeId\x88\x01\x01\x12\x1f\n" + - "\bpresence\x18\v \x01(\tH\aR\bpresence\x88\x01\x01\x12$\n" + - "\vlast_active\x18\f \x01(\tH\bR\n" + - "lastActive\x88\x01\x01\x121\n" + - "\x12custom_status_text\x18\r \x01(\tH\tR\x10customStatusText\x88\x01\x01\x123\n" + - "\x13custom_status_emoji\x18\x0e \x01(\tH\n" + - "R\x11customStatusEmoji\x88\x01\x01\x12\x1f\n" + - "\btimezone\x18\x0f \x01(\tH\vR\btimezone\x88\x01\x01\x12\x1f\n" + - "\blanguage\x18\x10 \x01(\tH\fR\blanguage\x88\x01\x01\x12$\n" + - "\x0etwo_fa_enabled\x18\x11 \x01(\bR\ftwoFaEnabled\x12\x17\n" + - "\ahas_pin\x18\x12 \x01(\bR\x06hasPinB\v\n" + - "\t_usernameB\b\n" + - "\x06_emailB\b\n" + - "\x06_phoneB\f\n" + + "avatar_url\x18\x05 \x01(\tH\x03R\tavatarUrl\x88\x01\x01B\b\n" + + "\x06_emailB\f\n" + "\n" + - "_full_nameB\t\n" + - "\a_statusB\r\n" + - "\v_avatar_urlB\x0e\n" + - "\f_employee_idB\v\n" + - "\t_presenceB\x0e\n" + - "\f_last_activeB\x15\n" + - "\x13_custom_status_textB\x16\n" + - "\x14_custom_status_emojiB\v\n" + - "\t_timezoneB\v\n" + - "\t_language2\xd4\x01\n" + - "\fUsersService\x128\n" + - "\x05GetMe\x12\x16.users.v1.GetMeRequest\x1a\x17.users.v1.GetMeResponse\x12A\n" + - "\bChangeMe\x12\x19.users.v1.ChangeMeRequest\x1a\x1a.users.v1.ChangeMeResponse\x12G\n" + + "_full_nameB\b\n" + + "\x06_phoneB\r\n" + + "\v_avatar_url\"1\n" + + "\x15CreateProfileResponse\x12\x18\n" + + "\asuccess\x18\x01 \x01(\bR\asuccess2\xfb\x01\n" + + "\fUsersService\x12G\n" + "\n" + - "CreateUser\x12\x1b.users.v1.CreateUserRequest\x1a\x1c.users.v1.CreateUserResponseB*Z(git.lendry.ru/lendry-erp/proto.git/go;pbb\x06proto3" + "GetProfile\x12\x1b.users.v1.GetProfileRequest\x1a\x1c.users.v1.GetProfileResponse\x12P\n" + + "\rUpdateProfile\x12\x1e.users.v1.UpdateProfileRequest\x1a\x1f.users.v1.UpdateProfileResponse\x12P\n" + + "\rCreateProfile\x12\x1e.users.v1.CreateProfileRequest\x1a\x1f.users.v1.CreateProfileResponseB*Z(git.lendry.ru/lendry-erp/proto.git/go;pbb\x06proto3" var ( file_users_users_proto_rawDescOnce sync.Once @@ -651,29 +556,27 @@ func file_users_users_proto_rawDescGZIP() []byte { return file_users_users_proto_rawDescData } -var file_users_users_proto_msgTypes = make([]protoimpl.MessageInfo, 7) +var file_users_users_proto_msgTypes = make([]protoimpl.MessageInfo, 6) var file_users_users_proto_goTypes = []any{ - (*GetMeRequest)(nil), // 0: users.v1.GetMeRequest - (*GetMeResponse)(nil), // 1: users.v1.GetMeResponse - (*CreateUserRequest)(nil), // 2: users.v1.CreateUserRequest - (*CreateUserResponse)(nil), // 3: users.v1.CreateUserResponse - (*ChangeMeRequest)(nil), // 4: users.v1.ChangeMeRequest - (*ChangeMeResponse)(nil), // 5: users.v1.ChangeMeResponse - (*User)(nil), // 6: users.v1.User + (*GetProfileRequest)(nil), // 0: users.v1.GetProfileRequest + (*GetProfileResponse)(nil), // 1: users.v1.GetProfileResponse + (*UpdateProfileRequest)(nil), // 2: users.v1.UpdateProfileRequest + (*UpdateProfileResponse)(nil), // 3: users.v1.UpdateProfileResponse + (*CreateProfileRequest)(nil), // 4: users.v1.CreateProfileRequest + (*CreateProfileResponse)(nil), // 5: users.v1.CreateProfileResponse } var file_users_users_proto_depIdxs = []int32{ - 6, // 0: users.v1.GetMeResponse.user:type_name -> users.v1.User - 0, // 1: users.v1.UsersService.GetMe:input_type -> users.v1.GetMeRequest - 4, // 2: users.v1.UsersService.ChangeMe:input_type -> users.v1.ChangeMeRequest - 2, // 3: users.v1.UsersService.CreateUser:input_type -> users.v1.CreateUserRequest - 1, // 4: users.v1.UsersService.GetMe:output_type -> users.v1.GetMeResponse - 5, // 5: users.v1.UsersService.ChangeMe:output_type -> users.v1.ChangeMeResponse - 3, // 6: users.v1.UsersService.CreateUser:output_type -> users.v1.CreateUserResponse - 4, // [4:7] is the sub-list for method output_type - 1, // [1:4] is the sub-list for method input_type - 1, // [1:1] is the sub-list for extension type_name - 1, // [1:1] is the sub-list for extension extendee - 0, // [0:1] is the sub-list for field type_name + 0, // 0: users.v1.UsersService.GetProfile:input_type -> users.v1.GetProfileRequest + 2, // 1: users.v1.UsersService.UpdateProfile:input_type -> users.v1.UpdateProfileRequest + 4, // 2: users.v1.UsersService.CreateProfile:input_type -> users.v1.CreateProfileRequest + 1, // 3: users.v1.UsersService.GetProfile:output_type -> users.v1.GetProfileResponse + 3, // 4: users.v1.UsersService.UpdateProfile:output_type -> users.v1.UpdateProfileResponse + 5, // 5: users.v1.UsersService.CreateProfile:output_type -> users.v1.CreateProfileResponse + 3, // [3:6] is the sub-list for method output_type + 0, // [0:3] 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 } func init() { file_users_users_proto_init() } @@ -681,15 +584,16 @@ func file_users_users_proto_init() { if File_users_users_proto != nil { return } + file_users_users_proto_msgTypes[1].OneofWrappers = []any{} + file_users_users_proto_msgTypes[2].OneofWrappers = []any{} file_users_users_proto_msgTypes[4].OneofWrappers = []any{} - file_users_users_proto_msgTypes[6].OneofWrappers = []any{} type x struct{} out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: unsafe.Slice(unsafe.StringData(file_users_users_proto_rawDesc), len(file_users_users_proto_rawDesc)), NumEnums: 0, - NumMessages: 7, + NumMessages: 6, NumExtensions: 0, NumServices: 1, }, diff --git a/gen/go/users/users_grpc.pb.go b/gen/go/users/users_grpc.pb.go index 63c6519..cd4cdc2 100644 --- a/gen/go/users/users_grpc.pb.go +++ b/gen/go/users/users_grpc.pb.go @@ -19,18 +19,19 @@ import ( const _ = grpc.SupportPackageIsVersion9 const ( - UsersService_GetMe_FullMethodName = "/users.v1.UsersService/GetMe" - UsersService_ChangeMe_FullMethodName = "/users.v1.UsersService/ChangeMe" - UsersService_CreateUser_FullMethodName = "/users.v1.UsersService/CreateUser" + UsersService_GetProfile_FullMethodName = "/users.v1.UsersService/GetProfile" + UsersService_UpdateProfile_FullMethodName = "/users.v1.UsersService/UpdateProfile" + UsersService_CreateProfile_FullMethodName = "/users.v1.UsersService/CreateProfile" ) // UsersServiceClient is the client API for UsersService service. // // 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 UsersServiceClient interface { - GetMe(ctx context.Context, in *GetMeRequest, opts ...grpc.CallOption) (*GetMeResponse, error) - ChangeMe(ctx context.Context, in *ChangeMeRequest, opts ...grpc.CallOption) (*ChangeMeResponse, error) - CreateUser(ctx context.Context, in *CreateUserRequest, opts ...grpc.CallOption) (*CreateUserResponse, error) + GetProfile(ctx context.Context, in *GetProfileRequest, opts ...grpc.CallOption) (*GetProfileResponse, error) + UpdateProfile(ctx context.Context, in *UpdateProfileRequest, opts ...grpc.CallOption) (*UpdateProfileResponse, error) + // Для системного использования (вызывается из Auth/Admin) + CreateProfile(ctx context.Context, in *CreateProfileRequest, opts ...grpc.CallOption) (*CreateProfileResponse, error) } type usersServiceClient struct { @@ -41,30 +42,30 @@ func NewUsersServiceClient(cc grpc.ClientConnInterface) UsersServiceClient { return &usersServiceClient{cc} } -func (c *usersServiceClient) GetMe(ctx context.Context, in *GetMeRequest, opts ...grpc.CallOption) (*GetMeResponse, error) { +func (c *usersServiceClient) GetProfile(ctx context.Context, in *GetProfileRequest, opts ...grpc.CallOption) (*GetProfileResponse, error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) - out := new(GetMeResponse) - err := c.cc.Invoke(ctx, UsersService_GetMe_FullMethodName, in, out, cOpts...) + out := new(GetProfileResponse) + err := c.cc.Invoke(ctx, UsersService_GetProfile_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } return out, nil } -func (c *usersServiceClient) ChangeMe(ctx context.Context, in *ChangeMeRequest, opts ...grpc.CallOption) (*ChangeMeResponse, error) { +func (c *usersServiceClient) UpdateProfile(ctx context.Context, in *UpdateProfileRequest, opts ...grpc.CallOption) (*UpdateProfileResponse, error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) - out := new(ChangeMeResponse) - err := c.cc.Invoke(ctx, UsersService_ChangeMe_FullMethodName, in, out, cOpts...) + out := new(UpdateProfileResponse) + err := c.cc.Invoke(ctx, UsersService_UpdateProfile_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } return out, nil } -func (c *usersServiceClient) CreateUser(ctx context.Context, in *CreateUserRequest, opts ...grpc.CallOption) (*CreateUserResponse, error) { +func (c *usersServiceClient) CreateProfile(ctx context.Context, in *CreateProfileRequest, opts ...grpc.CallOption) (*CreateProfileResponse, error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) - out := new(CreateUserResponse) - err := c.cc.Invoke(ctx, UsersService_CreateUser_FullMethodName, in, out, cOpts...) + out := new(CreateProfileResponse) + err := c.cc.Invoke(ctx, UsersService_CreateProfile_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } @@ -75,9 +76,10 @@ func (c *usersServiceClient) CreateUser(ctx context.Context, in *CreateUserReque // All implementations must embed UnimplementedUsersServiceServer // for forward compatibility. type UsersServiceServer interface { - GetMe(context.Context, *GetMeRequest) (*GetMeResponse, error) - ChangeMe(context.Context, *ChangeMeRequest) (*ChangeMeResponse, error) - CreateUser(context.Context, *CreateUserRequest) (*CreateUserResponse, error) + GetProfile(context.Context, *GetProfileRequest) (*GetProfileResponse, error) + UpdateProfile(context.Context, *UpdateProfileRequest) (*UpdateProfileResponse, error) + // Для системного использования (вызывается из Auth/Admin) + CreateProfile(context.Context, *CreateProfileRequest) (*CreateProfileResponse, error) mustEmbedUnimplementedUsersServiceServer() } @@ -88,14 +90,14 @@ type UsersServiceServer interface { // pointer dereference when methods are called. type UnimplementedUsersServiceServer struct{} -func (UnimplementedUsersServiceServer) GetMe(context.Context, *GetMeRequest) (*GetMeResponse, error) { - return nil, status.Error(codes.Unimplemented, "method GetMe not implemented") +func (UnimplementedUsersServiceServer) GetProfile(context.Context, *GetProfileRequest) (*GetProfileResponse, error) { + return nil, status.Error(codes.Unimplemented, "method GetProfile not implemented") } -func (UnimplementedUsersServiceServer) ChangeMe(context.Context, *ChangeMeRequest) (*ChangeMeResponse, error) { - return nil, status.Error(codes.Unimplemented, "method ChangeMe not implemented") +func (UnimplementedUsersServiceServer) UpdateProfile(context.Context, *UpdateProfileRequest) (*UpdateProfileResponse, error) { + return nil, status.Error(codes.Unimplemented, "method UpdateProfile not implemented") } -func (UnimplementedUsersServiceServer) CreateUser(context.Context, *CreateUserRequest) (*CreateUserResponse, error) { - return nil, status.Error(codes.Unimplemented, "method CreateUser not implemented") +func (UnimplementedUsersServiceServer) CreateProfile(context.Context, *CreateProfileRequest) (*CreateProfileResponse, error) { + return nil, status.Error(codes.Unimplemented, "method CreateProfile not implemented") } func (UnimplementedUsersServiceServer) mustEmbedUnimplementedUsersServiceServer() {} func (UnimplementedUsersServiceServer) testEmbeddedByValue() {} @@ -118,56 +120,56 @@ func RegisterUsersServiceServer(s grpc.ServiceRegistrar, srv UsersServiceServer) s.RegisterService(&UsersService_ServiceDesc, srv) } -func _UsersService_GetMe_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(GetMeRequest) +func _UsersService_GetProfile_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetProfileRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(UsersServiceServer).GetMe(ctx, in) + return srv.(UsersServiceServer).GetProfile(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: UsersService_GetMe_FullMethodName, + FullMethod: UsersService_GetProfile_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(UsersServiceServer).GetMe(ctx, req.(*GetMeRequest)) + return srv.(UsersServiceServer).GetProfile(ctx, req.(*GetProfileRequest)) } return interceptor(ctx, in, info, handler) } -func _UsersService_ChangeMe_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(ChangeMeRequest) +func _UsersService_UpdateProfile_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(UpdateProfileRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(UsersServiceServer).ChangeMe(ctx, in) + return srv.(UsersServiceServer).UpdateProfile(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: UsersService_ChangeMe_FullMethodName, + FullMethod: UsersService_UpdateProfile_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(UsersServiceServer).ChangeMe(ctx, req.(*ChangeMeRequest)) + return srv.(UsersServiceServer).UpdateProfile(ctx, req.(*UpdateProfileRequest)) } return interceptor(ctx, in, info, handler) } -func _UsersService_CreateUser_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(CreateUserRequest) +func _UsersService_CreateProfile_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(CreateProfileRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(UsersServiceServer).CreateUser(ctx, in) + return srv.(UsersServiceServer).CreateProfile(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: UsersService_CreateUser_FullMethodName, + FullMethod: UsersService_CreateProfile_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(UsersServiceServer).CreateUser(ctx, req.(*CreateUserRequest)) + return srv.(UsersServiceServer).CreateProfile(ctx, req.(*CreateProfileRequest)) } return interceptor(ctx, in, info, handler) } @@ -180,16 +182,16 @@ var UsersService_ServiceDesc = grpc.ServiceDesc{ HandlerType: (*UsersServiceServer)(nil), Methods: []grpc.MethodDesc{ { - MethodName: "GetMe", - Handler: _UsersService_GetMe_Handler, + MethodName: "GetProfile", + Handler: _UsersService_GetProfile_Handler, }, { - MethodName: "ChangeMe", - Handler: _UsersService_ChangeMe_Handler, + MethodName: "UpdateProfile", + Handler: _UsersService_UpdateProfile_Handler, }, { - MethodName: "CreateUser", - Handler: _UsersService_CreateUser_Handler, + MethodName: "CreateProfile", + Handler: _UsersService_CreateProfile_Handler, }, }, Streams: []grpc.StreamDesc{}, diff --git a/gen/users/users.ts b/gen/users/users.ts index 5bc7c0b..ce54ce0 100644 --- a/gen/users/users.ts +++ b/gen/users/users.ts @@ -11,25 +11,26 @@ import { Observable } from "rxjs"; export const protobufPackage = "users.v1"; -export interface GetMeRequest { - id: string; -} - -export interface GetMeResponse { - user: User | undefined; -} - -export interface CreateUserRequest { - id: string; -} - -export interface CreateUserResponse { - success: boolean; -} - -export interface ChangeMeRequest { +export interface GetProfileRequest { + /** Берется из access токена на API шлюзе */ + userId: string; +} + +export interface GetProfileResponse { + id: string; + email?: string | undefined; + phone?: string | undefined; + fullName?: string | undefined; + avatarUrl?: string | undefined; + isPublic: boolean; + timezone: string; + language: string; + customStatusText?: string | undefined; + customStatusEmoji?: string | undefined; +} + +export interface UpdateProfileRequest { userId: string; - sessionId: string; email?: string | undefined; phone?: string | undefined; fullName?: string | undefined; @@ -41,59 +42,59 @@ export interface ChangeMeRequest { isPublic?: boolean | undefined; } -export interface ChangeMeResponse { +export interface UpdateProfileResponse { success: boolean; message: string; } -export interface User { - id: string; - username?: string | undefined; +/** Вызывается другими сервисами при создании аккаунта */ +export interface CreateProfileRequest { + /** Обязательно передаем ID созданного аккаунта! */ + userId: string; email?: string | undefined; - phone?: string | undefined; fullName?: string | undefined; - isLdap: boolean; - status?: string | undefined; - roles: string[]; + phone?: string | undefined; avatarUrl?: string | undefined; - employeeId?: string | undefined; - presence?: string | undefined; - lastActive?: string | undefined; - customStatusText?: string | undefined; - customStatusEmoji?: string | undefined; - timezone?: string | undefined; - language?: string | undefined; - twoFaEnabled: boolean; - hasPin: boolean; +} + +export interface CreateProfileResponse { + success: boolean; } export const USERS_V1_PACKAGE_NAME = "users.v1"; export interface UsersServiceClient { - getMe(request: GetMeRequest, metadata?: Metadata): Observable; + getProfile(request: GetProfileRequest, metadata?: Metadata): Observable; - changeMe(request: ChangeMeRequest, metadata?: Metadata): Observable; + updateProfile(request: UpdateProfileRequest, metadata?: Metadata): Observable; - createUser(request: CreateUserRequest, metadata?: Metadata): Observable; + /** Для системного использования (вызывается из Auth/Admin) */ + + createProfile(request: CreateProfileRequest, metadata?: Metadata): Observable; } export interface UsersServiceController { - getMe(request: GetMeRequest, metadata?: Metadata): Promise | Observable | GetMeResponse; - - changeMe( - request: ChangeMeRequest, + getProfile( + request: GetProfileRequest, metadata?: Metadata, - ): Promise | Observable | ChangeMeResponse; + ): Promise | Observable | GetProfileResponse; - createUser( - request: CreateUserRequest, + updateProfile( + request: UpdateProfileRequest, metadata?: Metadata, - ): Promise | Observable | CreateUserResponse; + ): Promise | Observable | UpdateProfileResponse; + + /** Для системного использования (вызывается из Auth/Admin) */ + + createProfile( + request: CreateProfileRequest, + metadata?: Metadata, + ): Promise | Observable | CreateProfileResponse; } export function UsersServiceControllerMethods() { return function (constructor: Function) { - const grpcMethods: string[] = ["getMe", "changeMe", "createUser"]; + const grpcMethods: string[] = ["getProfile", "updateProfile", "createProfile"]; for (const method of grpcMethods) { const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method); GrpcMethod("UsersService", method)(constructor.prototype[method], method, descriptor);