🐛 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

@@ -4,7 +4,7 @@ using Microsoft.EntityFrameworkCore;
namespace DysonNetwork.Sphere.Autocompletion;
public class AutocompletionService(AppDatabase db, RemoteAccountService remoteAccountsHelper)
public class AutocompletionService(AppDatabase db, RemoteAccountService remoteAccountsHelper, RemoteRealmService remoteRealmService)
{
public async Task<List<DysonNetwork.Shared.Models.Autocompletion>> GetAutocompletion(string content, Guid? chatId = null, Guid? realmId = null, int limit = 10)
{
@@ -95,17 +95,14 @@ public class AutocompletionService(AppDatabase db, RemoteAccountService remoteAc
break;
case "r":
var realms = await db.Realms
.Where(r => EF.Functions.Like(r.Slug, $"{query}%") || EF.Functions.Like(r.Name, $"{query}%"))
.Take(limit)
.Select(r => new DysonNetwork.Shared.Models.Autocompletion
{
Type = "realm",
Keyword = "@r/" + r.Slug,
Data = r
})
.ToListAsync();
results.AddRange(realms);
var realms = await remoteRealmService.SearchRealms(query, limit);
var autocompletions = realms.Select(r => new DysonNetwork.Shared.Models.Autocompletion
{
Type = "realm",
Keyword = "@r/" + r.Slug,
Data = r
});
results.AddRange(autocompletions);
break;
case "c":