feat: add AddAvatarExperience RPC to UserProfileService

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Kaien 2026-03-20 23:12:35 +03:00
parent e26dc84ccc
commit 3a741152fc
3 changed files with 146 additions and 43 deletions

View File

@ -1603,6 +1603,58 @@ func (x *GetMoodHistoryResponse) GetHistory() []*UserMoodHistory {
return nil
}
type AddAvatarExperienceRequest struct {
state protoimpl.MessageState `protogen:"open.v1"`
AvatarId int64 `protobuf:"varint,1,opt,name=avatar_id,json=avatarId,proto3" json:"avatar_id,omitempty"`
Amount int64 `protobuf:"varint,2,opt,name=amount,proto3" json:"amount,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *AddAvatarExperienceRequest) Reset() {
*x = AddAvatarExperienceRequest{}
mi := &file_profiles_proto_msgTypes[23]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *AddAvatarExperienceRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*AddAvatarExperienceRequest) ProtoMessage() {}
func (x *AddAvatarExperienceRequest) ProtoReflect() protoreflect.Message {
mi := &file_profiles_proto_msgTypes[23]
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 AddAvatarExperienceRequest.ProtoReflect.Descriptor instead.
func (*AddAvatarExperienceRequest) Descriptor() ([]byte, []int) {
return file_profiles_proto_rawDescGZIP(), []int{23}
}
func (x *AddAvatarExperienceRequest) GetAvatarId() int64 {
if x != nil {
return x.AvatarId
}
return 0
}
func (x *AddAvatarExperienceRequest) GetAmount() int64 {
if x != nil {
return x.Amount
}
return 0
}
var File_profiles_proto protoreflect.FileDescriptor
const file_profiles_proto_rawDesc = "" +
@ -1746,7 +1798,10 @@ const file_profiles_proto_rawDesc = "" +
"\x1cGetLastMoodBeforeTimeRequest\x122\n" +
"\x06before\x18\x01 \x01(\v2\x1a.google.protobuf.TimestampR\x06before\"J\n" +
"\x16GetMoodHistoryResponse\x120\n" +
"\ahistory\x18\x01 \x03(\v2\x16.users.UserMoodHistoryR\ahistory2\xd7\x05\n" +
"\ahistory\x18\x01 \x03(\v2\x16.users.UserMoodHistoryR\ahistory\"Q\n" +
"\x1aAddAvatarExperienceRequest\x12\x1b\n" +
"\tavatar_id\x18\x01 \x01(\x03R\bavatarId\x12\x16\n" +
"\x06amount\x18\x02 \x01(\x03R\x06amount2\xa9\x06\n" +
"\x12UserProfileService\x12J\n" +
"\x12GetOrCreateProfile\x12 .users.GetOrCreateProfileRequest\x1a\x12.users.UserProfile\x12:\n" +
"\n" +
@ -1757,7 +1812,8 @@ const file_profiles_proto_rawDesc = "" +
"\x0eSetBotAttitude\x12\x1c.users.SetBotAttitudeRequest\x1a\x16.google.protobuf.Empty\x12P\n" +
"\x13SaveMemorableMoment\x12!.users.SaveMemorableMomentRequest\x1a\x16.google.protobuf.Empty\x12\\\n" +
"\x13GetMemorableMoments\x12!.users.GetMemorableMomentsRequest\x1a\".users.GetMemorableMomentsResponse\x12L\n" +
"\x11RecordMoodHistory\x12\x1f.users.RecordMoodHistoryRequest\x1a\x16.google.protobuf.Empty2\x90\x03\n" +
"\x11RecordMoodHistory\x12\x1f.users.RecordMoodHistoryRequest\x1a\x16.google.protobuf.Empty\x12P\n" +
"\x13AddAvatarExperience\x12!.users.AddAvatarExperienceRequest\x1a\x16.google.protobuf.Empty2\x90\x03\n" +
"\x16UserMoodHistoryService\x12Y\n" +
"\x14GetMoodHistoryByUser\x12\".users.GetMoodHistoryByUserRequest\x1a\x1d.users.GetMoodHistoryResponse\x12c\n" +
"\x19GetMoodHistoryByTimeRange\x12'.users.GetMoodHistoryByTimeRangeRequest\x1a\x1d.users.GetMoodHistoryResponse\x12Y\n" +
@ -1776,7 +1832,7 @@ func file_profiles_proto_rawDescGZIP() []byte {
return file_profiles_proto_rawDescData
}
var file_profiles_proto_msgTypes = make([]protoimpl.MessageInfo, 26)
var file_profiles_proto_msgTypes = make([]protoimpl.MessageInfo, 27)
var file_profiles_proto_goTypes = []any{
(*UserStats)(nil), // 0: users.UserStats
(*UserFavorites)(nil), // 1: users.UserFavorites
@ -1801,63 +1857,66 @@ var file_profiles_proto_goTypes = []any{
(*GetRecentMoodHistoryRequest)(nil), // 20: users.GetRecentMoodHistoryRequest
(*GetLastMoodBeforeTimeRequest)(nil), // 21: users.GetLastMoodBeforeTimeRequest
(*GetMoodHistoryResponse)(nil), // 22: users.GetMoodHistoryResponse
nil, // 23: users.UserStats.TopicFrequencyEntry
nil, // 24: users.UserStats.MessagesByHourEntry
nil, // 25: users.UserStats.MessagesByDayEntry
(*timestamppb.Timestamp)(nil), // 26: google.protobuf.Timestamp
(*emptypb.Empty)(nil), // 27: google.protobuf.Empty
(*AddAvatarExperienceRequest)(nil), // 23: users.AddAvatarExperienceRequest
nil, // 24: users.UserStats.TopicFrequencyEntry
nil, // 25: users.UserStats.MessagesByHourEntry
nil, // 26: users.UserStats.MessagesByDayEntry
(*timestamppb.Timestamp)(nil), // 27: google.protobuf.Timestamp
(*emptypb.Empty)(nil), // 28: google.protobuf.Empty
}
var file_profiles_proto_depIdxs = []int32{
23, // 0: users.UserStats.topic_frequency:type_name -> users.UserStats.TopicFrequencyEntry
24, // 1: users.UserStats.messages_by_hour:type_name -> users.UserStats.MessagesByHourEntry
25, // 2: users.UserStats.messages_by_day:type_name -> users.UserStats.MessagesByDayEntry
24, // 0: users.UserStats.topic_frequency:type_name -> users.UserStats.TopicFrequencyEntry
25, // 1: users.UserStats.messages_by_hour:type_name -> users.UserStats.MessagesByHourEntry
26, // 2: users.UserStats.messages_by_day:type_name -> users.UserStats.MessagesByDayEntry
2, // 3: users.Avatar.stats:type_name -> users.AvatarStats
3, // 4: users.Avatar.skills:type_name -> users.Skill
26, // 5: users.Avatar.created_at:type_name -> google.protobuf.Timestamp
26, // 6: users.Avatar.updated_at:type_name -> google.protobuf.Timestamp
26, // 7: users.UserProfile.join_date:type_name -> google.protobuf.Timestamp
26, // 8: users.UserProfile.updated_at:type_name -> google.protobuf.Timestamp
27, // 5: users.Avatar.created_at:type_name -> google.protobuf.Timestamp
27, // 6: users.Avatar.updated_at:type_name -> google.protobuf.Timestamp
27, // 7: users.UserProfile.join_date:type_name -> google.protobuf.Timestamp
27, // 8: users.UserProfile.updated_at:type_name -> google.protobuf.Timestamp
4, // 9: users.UserProfile.avatar:type_name -> users.Avatar
0, // 10: users.UserProfile.stats:type_name -> users.UserStats
1, // 11: users.UserProfile.favorites:type_name -> users.UserFavorites
26, // 12: users.UserMoodHistory.timestamp:type_name -> google.protobuf.Timestamp
26, // 13: users.MemorableMoment.date:type_name -> google.protobuf.Timestamp
27, // 12: users.UserMoodHistory.timestamp:type_name -> google.protobuf.Timestamp
27, // 13: users.MemorableMoment.date:type_name -> google.protobuf.Timestamp
5, // 14: users.GetAllProfilesResponse.profiles:type_name -> users.UserProfile
7, // 15: users.GetMemorableMomentsResponse.moments:type_name -> users.MemorableMoment
26, // 16: users.GetMoodHistoryByUserRequest.from:type_name -> google.protobuf.Timestamp
26, // 17: users.GetMoodHistoryByUserRequest.to:type_name -> google.protobuf.Timestamp
26, // 18: users.GetMoodHistoryByTimeRangeRequest.from:type_name -> google.protobuf.Timestamp
26, // 19: users.GetMoodHistoryByTimeRangeRequest.to:type_name -> google.protobuf.Timestamp
26, // 20: users.GetLastMoodBeforeTimeRequest.before:type_name -> google.protobuf.Timestamp
27, // 16: users.GetMoodHistoryByUserRequest.from:type_name -> google.protobuf.Timestamp
27, // 17: users.GetMoodHistoryByUserRequest.to:type_name -> google.protobuf.Timestamp
27, // 18: users.GetMoodHistoryByTimeRangeRequest.from:type_name -> google.protobuf.Timestamp
27, // 19: users.GetMoodHistoryByTimeRangeRequest.to:type_name -> google.protobuf.Timestamp
27, // 20: users.GetLastMoodBeforeTimeRequest.before:type_name -> google.protobuf.Timestamp
6, // 21: users.GetMoodHistoryResponse.history:type_name -> users.UserMoodHistory
8, // 22: users.UserProfileService.GetOrCreateProfile:input_type -> users.GetOrCreateProfileRequest
9, // 23: users.UserProfileService.GetProfile:input_type -> users.GetProfileRequest
27, // 24: users.UserProfileService.GetAllProfilesWithMessages:input_type -> google.protobuf.Empty
28, // 24: users.UserProfileService.GetAllProfilesWithMessages:input_type -> google.protobuf.Empty
11, // 25: users.UserProfileService.AddMessageToStats:input_type -> users.AddMessageToStatsRequest
12, // 26: users.UserProfileService.UpdateReactionCount:input_type -> users.UpdateReactionCountRequest
13, // 27: users.UserProfileService.SetBotAttitude:input_type -> users.SetBotAttitudeRequest
14, // 28: users.UserProfileService.SaveMemorableMoment:input_type -> users.SaveMemorableMomentRequest
15, // 29: users.UserProfileService.GetMemorableMoments:input_type -> users.GetMemorableMomentsRequest
17, // 30: users.UserProfileService.RecordMoodHistory:input_type -> users.RecordMoodHistoryRequest
18, // 31: users.UserMoodHistoryService.GetMoodHistoryByUser:input_type -> users.GetMoodHistoryByUserRequest
19, // 32: users.UserMoodHistoryService.GetMoodHistoryByTimeRange:input_type -> users.GetMoodHistoryByTimeRangeRequest
20, // 33: users.UserMoodHistoryService.GetRecentMoodHistory:input_type -> users.GetRecentMoodHistoryRequest
21, // 34: users.UserMoodHistoryService.GetLastMoodBeforeTime:input_type -> users.GetLastMoodBeforeTimeRequest
5, // 35: users.UserProfileService.GetOrCreateProfile:output_type -> users.UserProfile
5, // 36: users.UserProfileService.GetProfile:output_type -> users.UserProfile
10, // 37: users.UserProfileService.GetAllProfilesWithMessages:output_type -> users.GetAllProfilesResponse
27, // 38: users.UserProfileService.AddMessageToStats:output_type -> google.protobuf.Empty
27, // 39: users.UserProfileService.UpdateReactionCount:output_type -> google.protobuf.Empty
27, // 40: users.UserProfileService.SetBotAttitude:output_type -> google.protobuf.Empty
27, // 41: users.UserProfileService.SaveMemorableMoment:output_type -> google.protobuf.Empty
16, // 42: users.UserProfileService.GetMemorableMoments:output_type -> users.GetMemorableMomentsResponse
27, // 43: users.UserProfileService.RecordMoodHistory:output_type -> google.protobuf.Empty
22, // 44: users.UserMoodHistoryService.GetMoodHistoryByUser:output_type -> users.GetMoodHistoryResponse
22, // 45: users.UserMoodHistoryService.GetMoodHistoryByTimeRange:output_type -> users.GetMoodHistoryResponse
22, // 46: users.UserMoodHistoryService.GetRecentMoodHistory:output_type -> users.GetMoodHistoryResponse
22, // 47: users.UserMoodHistoryService.GetLastMoodBeforeTime:output_type -> users.GetMoodHistoryResponse
35, // [35:48] is the sub-list for method output_type
22, // [22:35] is the sub-list for method input_type
23, // 31: users.UserProfileService.AddAvatarExperience:input_type -> users.AddAvatarExperienceRequest
18, // 32: users.UserMoodHistoryService.GetMoodHistoryByUser:input_type -> users.GetMoodHistoryByUserRequest
19, // 33: users.UserMoodHistoryService.GetMoodHistoryByTimeRange:input_type -> users.GetMoodHistoryByTimeRangeRequest
20, // 34: users.UserMoodHistoryService.GetRecentMoodHistory:input_type -> users.GetRecentMoodHistoryRequest
21, // 35: users.UserMoodHistoryService.GetLastMoodBeforeTime:input_type -> users.GetLastMoodBeforeTimeRequest
5, // 36: users.UserProfileService.GetOrCreateProfile:output_type -> users.UserProfile
5, // 37: users.UserProfileService.GetProfile:output_type -> users.UserProfile
10, // 38: users.UserProfileService.GetAllProfilesWithMessages:output_type -> users.GetAllProfilesResponse
28, // 39: users.UserProfileService.AddMessageToStats:output_type -> google.protobuf.Empty
28, // 40: users.UserProfileService.UpdateReactionCount:output_type -> google.protobuf.Empty
28, // 41: users.UserProfileService.SetBotAttitude:output_type -> google.protobuf.Empty
28, // 42: users.UserProfileService.SaveMemorableMoment:output_type -> google.protobuf.Empty
16, // 43: users.UserProfileService.GetMemorableMoments:output_type -> users.GetMemorableMomentsResponse
28, // 44: users.UserProfileService.RecordMoodHistory:output_type -> google.protobuf.Empty
28, // 45: users.UserProfileService.AddAvatarExperience:output_type -> google.protobuf.Empty
22, // 46: users.UserMoodHistoryService.GetMoodHistoryByUser:output_type -> users.GetMoodHistoryResponse
22, // 47: users.UserMoodHistoryService.GetMoodHistoryByTimeRange:output_type -> users.GetMoodHistoryResponse
22, // 48: users.UserMoodHistoryService.GetRecentMoodHistory:output_type -> users.GetMoodHistoryResponse
22, // 49: users.UserMoodHistoryService.GetLastMoodBeforeTime:output_type -> users.GetMoodHistoryResponse
36, // [36:50] is the sub-list for method output_type
22, // [22:36] is the sub-list for method input_type
22, // [22:22] is the sub-list for extension type_name
22, // [22:22] is the sub-list for extension extendee
0, // [0:22] is the sub-list for field type_name
@ -1874,7 +1933,7 @@ func file_profiles_proto_init() {
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: unsafe.Slice(unsafe.StringData(file_profiles_proto_rawDesc), len(file_profiles_proto_rawDesc)),
NumEnums: 0,
NumMessages: 26,
NumMessages: 27,
NumExtensions: 0,
NumServices: 2,
},

View File

@ -18,6 +18,7 @@ service UserProfileService {
rpc SaveMemorableMoment(SaveMemorableMomentRequest) returns (google.protobuf.Empty);
rpc GetMemorableMoments(GetMemorableMomentsRequest) returns (GetMemorableMomentsResponse);
rpc RecordMoodHistory(RecordMoodHistoryRequest) returns (google.protobuf.Empty);
rpc AddAvatarExperience(AddAvatarExperienceRequest) returns (google.protobuf.Empty);
}
// UserMoodHistoryService provides mood history queries
@ -194,3 +195,8 @@ message GetLastMoodBeforeTimeRequest {
message GetMoodHistoryResponse {
repeated UserMoodHistory history = 1;
}
message AddAvatarExperienceRequest {
int64 avatar_id = 1;
int64 amount = 2;
}

View File

@ -29,6 +29,7 @@ const (
UserProfileService_SaveMemorableMoment_FullMethodName = "/users.UserProfileService/SaveMemorableMoment"
UserProfileService_GetMemorableMoments_FullMethodName = "/users.UserProfileService/GetMemorableMoments"
UserProfileService_RecordMoodHistory_FullMethodName = "/users.UserProfileService/RecordMoodHistory"
UserProfileService_AddAvatarExperience_FullMethodName = "/users.UserProfileService/AddAvatarExperience"
)
// UserProfileServiceClient is the client API for UserProfileService service.
@ -46,6 +47,7 @@ type UserProfileServiceClient interface {
SaveMemorableMoment(ctx context.Context, in *SaveMemorableMomentRequest, opts ...grpc.CallOption) (*emptypb.Empty, error)
GetMemorableMoments(ctx context.Context, in *GetMemorableMomentsRequest, opts ...grpc.CallOption) (*GetMemorableMomentsResponse, error)
RecordMoodHistory(ctx context.Context, in *RecordMoodHistoryRequest, opts ...grpc.CallOption) (*emptypb.Empty, error)
AddAvatarExperience(ctx context.Context, in *AddAvatarExperienceRequest, opts ...grpc.CallOption) (*emptypb.Empty, error)
}
type userProfileServiceClient struct {
@ -146,6 +148,16 @@ func (c *userProfileServiceClient) RecordMoodHistory(ctx context.Context, in *Re
return out, nil
}
func (c *userProfileServiceClient) AddAvatarExperience(ctx context.Context, in *AddAvatarExperienceRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(emptypb.Empty)
err := c.cc.Invoke(ctx, UserProfileService_AddAvatarExperience_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
// UserProfileServiceServer is the server API for UserProfileService service.
// All implementations must embed UnimplementedUserProfileServiceServer
// for forward compatibility.
@ -161,6 +173,7 @@ type UserProfileServiceServer interface {
SaveMemorableMoment(context.Context, *SaveMemorableMomentRequest) (*emptypb.Empty, error)
GetMemorableMoments(context.Context, *GetMemorableMomentsRequest) (*GetMemorableMomentsResponse, error)
RecordMoodHistory(context.Context, *RecordMoodHistoryRequest) (*emptypb.Empty, error)
AddAvatarExperience(context.Context, *AddAvatarExperienceRequest) (*emptypb.Empty, error)
mustEmbedUnimplementedUserProfileServiceServer()
}
@ -198,6 +211,9 @@ func (UnimplementedUserProfileServiceServer) GetMemorableMoments(context.Context
func (UnimplementedUserProfileServiceServer) RecordMoodHistory(context.Context, *RecordMoodHistoryRequest) (*emptypb.Empty, error) {
return nil, status.Error(codes.Unimplemented, "method RecordMoodHistory not implemented")
}
func (UnimplementedUserProfileServiceServer) AddAvatarExperience(context.Context, *AddAvatarExperienceRequest) (*emptypb.Empty, error) {
return nil, status.Error(codes.Unimplemented, "method AddAvatarExperience not implemented")
}
func (UnimplementedUserProfileServiceServer) mustEmbedUnimplementedUserProfileServiceServer() {}
func (UnimplementedUserProfileServiceServer) testEmbeddedByValue() {}
@ -381,6 +397,24 @@ func _UserProfileService_RecordMoodHistory_Handler(srv interface{}, ctx context.
return interceptor(ctx, in, info, handler)
}
func _UserProfileService_AddAvatarExperience_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(AddAvatarExperienceRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(UserProfileServiceServer).AddAvatarExperience(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: UserProfileService_AddAvatarExperience_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(UserProfileServiceServer).AddAvatarExperience(ctx, req.(*AddAvatarExperienceRequest))
}
return interceptor(ctx, in, info, handler)
}
// UserProfileService_ServiceDesc is the grpc.ServiceDesc for UserProfileService service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
@ -424,6 +458,10 @@ var UserProfileService_ServiceDesc = grpc.ServiceDesc{
MethodName: "RecordMoodHistory",
Handler: _UserProfileService_RecordMoodHistory_Handler,
},
{
MethodName: "AddAvatarExperience",
Handler: _UserProfileService_AddAvatarExperience_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "profiles.proto",