🐛 Bug fix on missing id in realm

This commit is contained in:
LittleSheep 2024-05-04 16:59:31 +08:00
parent fddcb86c9e
commit 7c418a3cd3
4 changed files with 37 additions and 20 deletions

View File

@ -4,9 +4,11 @@
<option name="autoReloadType" value="ALL" /> <option name="autoReloadType" value="ALL" />
</component> </component>
<component name="ChangeListManager"> <component name="ChangeListManager">
<list default="true" id="3fefb2c4-b6f9-466b-a523-53352e8d6f95" name="更改" comment=":sparkles: Realm Member GRPC"> <list default="true" id="3fefb2c4-b6f9-466b-a523-53352e8d6f95" name="更改" comment=":bug: Bug fixes on forgot add realm members for account">
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" /> <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/pkg/models/accounts.go" beforeDir="false" afterPath="$PROJECT_DIR$/pkg/models/accounts.go" afterDir="false" /> <change beforePath="$PROJECT_DIR$/pkg/grpc/proto/realms.pb.go" beforeDir="false" afterPath="$PROJECT_DIR$/pkg/grpc/proto/realms.pb.go" afterDir="false" />
<change beforePath="$PROJECT_DIR$/pkg/grpc/proto/realms.proto" beforeDir="false" afterPath="$PROJECT_DIR$/pkg/grpc/proto/realms.proto" afterDir="false" />
<change beforePath="$PROJECT_DIR$/pkg/grpc/realms.go" beforeDir="false" afterPath="$PROJECT_DIR$/pkg/grpc/realms.go" afterDir="false" />
</list> </list>
<option name="SHOW_DIALOG" value="false" /> <option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" /> <option name="HIGHLIGHT_CONFLICTS" value="true" />
@ -144,7 +146,8 @@
<MESSAGE value=":sparkles: Realm in passport" /> <MESSAGE value=":sparkles: Realm in passport" />
<MESSAGE value=":sparkles: Realm GRPC" /> <MESSAGE value=":sparkles: Realm GRPC" />
<MESSAGE value=":sparkles: Realm Member GRPC" /> <MESSAGE value=":sparkles: Realm Member GRPC" />
<option name="LAST_COMMIT_MESSAGE" value=":sparkles: Realm Member GRPC" /> <MESSAGE value=":bug: Bug fixes on forgot add realm members for account" />
<option name="LAST_COMMIT_MESSAGE" value=":bug: Bug fixes on forgot add realm members for account" />
</component> </component>
<component name="VgoProject"> <component name="VgoProject">
<settings-migrated>true</settings-migrated> <settings-migrated>true</settings-migrated>

View File

@ -144,11 +144,12 @@ type RealmResponse struct {
sizeCache protoimpl.SizeCache sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields unknownFields protoimpl.UnknownFields
Alias string `protobuf:"bytes,1,opt,name=alias,proto3" json:"alias,omitempty"` Id uint64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` Alias string `protobuf:"bytes,2,opt,name=alias,proto3" json:"alias,omitempty"`
Description string `protobuf:"bytes,3,opt,name=description,proto3" json:"description,omitempty"` Name string `protobuf:"bytes,3,opt,name=name,proto3" json:"name,omitempty"`
IsPublic bool `protobuf:"varint,4,opt,name=is_public,json=isPublic,proto3" json:"is_public,omitempty"` Description string `protobuf:"bytes,4,opt,name=description,proto3" json:"description,omitempty"`
IsCommunity bool `protobuf:"varint,5,opt,name=is_community,json=isCommunity,proto3" json:"is_community,omitempty"` IsPublic bool `protobuf:"varint,5,opt,name=is_public,json=isPublic,proto3" json:"is_public,omitempty"`
IsCommunity bool `protobuf:"varint,6,opt,name=is_community,json=isCommunity,proto3" json:"is_community,omitempty"`
} }
func (x *RealmResponse) Reset() { func (x *RealmResponse) Reset() {
@ -183,6 +184,13 @@ func (*RealmResponse) Descriptor() ([]byte, []int) {
return file_realms_proto_rawDescGZIP(), []int{2} return file_realms_proto_rawDescGZIP(), []int{2}
} }
func (x *RealmResponse) GetId() uint64 {
if x != nil {
return x.Id
}
return 0
}
func (x *RealmResponse) GetAlias() string { func (x *RealmResponse) GetAlias() string {
if x != nil { if x != nil {
return x.Alias return x.Alias
@ -451,16 +459,17 @@ var file_realms_proto_rawDesc = []byte{
0x6d, 0x6d, 0x75, 0x6e, 0x69, 0x74, 0x79, 0x88, 0x01, 0x01, 0x42, 0x05, 0x0a, 0x03, 0x5f, 0x69, 0x6d, 0x6d, 0x75, 0x6e, 0x69, 0x74, 0x79, 0x88, 0x01, 0x01, 0x42, 0x05, 0x0a, 0x03, 0x5f, 0x69,
0x64, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x61, 0x6c, 0x69, 0x61, 0x73, 0x42, 0x0c, 0x0a, 0x0a, 0x5f, 0x64, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x61, 0x6c, 0x69, 0x61, 0x73, 0x42, 0x0c, 0x0a, 0x0a, 0x5f,
0x69, 0x73, 0x5f, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x42, 0x0f, 0x0a, 0x0d, 0x5f, 0x69, 0x73, 0x69, 0x73, 0x5f, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x42, 0x0f, 0x0a, 0x0d, 0x5f, 0x69, 0x73,
0x5f, 0x63, 0x6f, 0x6d, 0x6d, 0x75, 0x6e, 0x69, 0x74, 0x79, 0x22, 0x9b, 0x01, 0x0a, 0x0d, 0x52, 0x5f, 0x63, 0x6f, 0x6d, 0x6d, 0x75, 0x6e, 0x69, 0x74, 0x79, 0x22, 0xab, 0x01, 0x0a, 0x0d, 0x52,
0x65, 0x61, 0x6c, 0x6d, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x61, 0x6c, 0x6d, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x0e, 0x0a, 0x02,
0x61, 0x6c, 0x69, 0x61, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x61, 0x6c, 0x69, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x02, 0x69, 0x64, 0x12, 0x14, 0x0a, 0x05,
0x61, 0x73, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x61, 0x6c, 0x69, 0x61, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x61, 0x6c, 0x69,
0x61, 0x73, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09,
0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69,
0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73,
0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x1b, 0x0a, 0x09, 0x69, 0x73, 0x5f, 0x70, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x1b, 0x0a, 0x09, 0x69, 0x73, 0x5f, 0x70,
0x75, 0x62, 0x6c, 0x69, 0x63, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x69, 0x73, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x69, 0x73, 0x50,
0x75, 0x62, 0x6c, 0x69, 0x63, 0x12, 0x21, 0x0a, 0x0c, 0x69, 0x73, 0x5f, 0x63, 0x6f, 0x6d, 0x6d, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x12, 0x21, 0x0a, 0x0c, 0x69, 0x73, 0x5f, 0x63, 0x6f, 0x6d, 0x6d,
0x75, 0x6e, 0x69, 0x74, 0x79, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0b, 0x69, 0x73, 0x43, 0x75, 0x6e, 0x69, 0x74, 0x79, 0x18, 0x06, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0b, 0x69, 0x73, 0x43,
0x6f, 0x6d, 0x6d, 0x75, 0x6e, 0x69, 0x74, 0x79, 0x22, 0x3d, 0x0a, 0x11, 0x4c, 0x69, 0x73, 0x74, 0x6f, 0x6d, 0x6d, 0x75, 0x6e, 0x69, 0x74, 0x79, 0x22, 0x3d, 0x0a, 0x11, 0x4c, 0x69, 0x73, 0x74,
0x52, 0x65, 0x61, 0x6c, 0x6d, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x28, 0x0a, 0x52, 0x65, 0x61, 0x6c, 0x6d, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x28, 0x0a,
0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x70, 0x72, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x70, 0x72,

View File

@ -27,11 +27,12 @@ message RealmLookupRequest {
} }
message RealmResponse { message RealmResponse {
string alias = 1; uint64 id = 1;
string name = 2; string alias = 2;
string description = 3; string name = 3;
bool is_public = 4; string description = 4;
bool is_community = 5; bool is_public = 5;
bool is_community = 6;
} }
message ListRealmResponse { message ListRealmResponse {

View File

@ -20,6 +20,7 @@ func (v *Server) ListCommunityRealm(ctx context.Context, empty *emptypb.Empty) (
return &proto.ListRealmResponse{ return &proto.ListRealmResponse{
Data: lo.Map(realms, func(item models.Realm, index int) *proto.RealmResponse { Data: lo.Map(realms, func(item models.Realm, index int) *proto.RealmResponse {
return &proto.RealmResponse{ return &proto.RealmResponse{
Id: uint64(item.ID),
Alias: item.Alias, Alias: item.Alias,
Name: item.Name, Name: item.Name,
Description: item.Description, Description: item.Description,
@ -43,6 +44,7 @@ func (v *Server) ListAvailableRealm(ctx context.Context, request *proto.RealmLoo
return &proto.ListRealmResponse{ return &proto.ListRealmResponse{
Data: lo.Map(realms, func(item models.Realm, index int) *proto.RealmResponse { Data: lo.Map(realms, func(item models.Realm, index int) *proto.RealmResponse {
return &proto.RealmResponse{ return &proto.RealmResponse{
Id: uint64(item.ID),
Alias: item.Alias, Alias: item.Alias,
Name: item.Name, Name: item.Name,
Description: item.Description, Description: item.Description,
@ -66,6 +68,7 @@ func (v *Server) ListOwnedRealm(ctx context.Context, request *proto.RealmLookupW
return &proto.ListRealmResponse{ return &proto.ListRealmResponse{
Data: lo.Map(realms, func(item models.Realm, index int) *proto.RealmResponse { Data: lo.Map(realms, func(item models.Realm, index int) *proto.RealmResponse {
return &proto.RealmResponse{ return &proto.RealmResponse{
Id: uint64(item.ID),
Alias: item.Alias, Alias: item.Alias,
Name: item.Name, Name: item.Name,
Description: item.Description, Description: item.Description,
@ -98,6 +101,7 @@ func (v *Server) GetRealm(ctx context.Context, request *proto.RealmLookupRequest
} }
return &proto.RealmResponse{ return &proto.RealmResponse{
Id: uint64(realm.ID),
Alias: realm.Alias, Alias: realm.Alias,
Name: realm.Name, Name: realm.Name,
Description: realm.Description, Description: realm.Description,