🐛 Bug fixes in the Sphere still referencing the old realm db

This commit is contained in:
2025-10-22 23:31:42 +08:00
parent 0c09ef25ec
commit e6aa61b03b
6 changed files with 43 additions and 16 deletions

View File

@@ -39,7 +39,8 @@ public class SnRealm : ModelBase, IIdentifiedResource
return new Realm
{
Id = Id.ToString(),
Name = Name
Name = Name,
Slug = Slug
};
}
@@ -49,7 +50,7 @@ public class SnRealm : ModelBase, IIdentifiedResource
{
Id = Guid.Parse(proto.Id),
Name = proto.Name,
Slug = "", // Required but not in proto
Slug = proto.Slug,
Description = "",
IsCommunity = false,
IsPublic = false

View File

@@ -15,6 +15,7 @@ import 'account.proto';
message Realm {
string id = 1;
string name = 2;
string slug = 3;
}
message RealmMember {
@@ -38,6 +39,8 @@ service RealmService {
rpc GetUserRealms(GetUserRealmsRequest) returns (GetUserRealmsResponse) {}
// Get public realms
rpc GetPublicRealms(google.protobuf.Empty) returns (GetPublicRealmsResponse) {}
// Search public realms
rpc SearchRealms(SearchRealmsRequest) returns (GetPublicRealmsResponse) {}
// Send invitation notification
rpc SendInviteNotify(SendInviteNotifyRequest) returns (google.protobuf.Empty) {}
// Check if member has required role
@@ -77,6 +80,11 @@ message GetPublicRealmsResponse {
repeated Realm realms = 1;
}
message SearchRealmsRequest {
string query = 1;
int32 limit = 2;
}
message SendInviteNotifyRequest {
RealmMember member = 1;
}

View File

@@ -33,6 +33,13 @@ public class RemoteRealmService(RealmService.RealmServiceClient realms)
return response.Realms.Select(SnRealm.FromProtoValue).ToList();
}
public async Task<List<SnRealm>> SearchRealms(string query, int limit)
{
var request = new SearchRealmsRequest { Query = query, Limit = limit };
var response = await realms.SearchRealmsAsync(request);
return response.Realms.Select(SnRealm.FromProtoValue).ToList();
}
public async Task<List<SnRealm>> GetRealmBatch(List<string> ids)
{
var request = new GetRealmBatchRequest();