diff --git a/Server/src/SOR.Admin/Components/Pages/Game/CustomLobbiesPage.razor b/Server/src/SOR.Admin/Components/Pages/Game/CustomLobbiesPage.razor index d85a42a..140969f 100644 --- a/Server/src/SOR.Admin/Components/Pages/Game/CustomLobbiesPage.razor +++ b/Server/src/SOR.Admin/Components/Pages/Game/CustomLobbiesPage.razor @@ -4,6 +4,7 @@ @using SOR.Database.Enums @using Microsoft.EntityFrameworkCore @inject GameDbContext GameDb +@inject IJSRuntime JS Custom Lobbies — SOR Admin @@ -113,7 +114,7 @@ else — } - + @if (lobby.Status == CustomLobbyStatus.Open || lobby.Status == CustomLobbyStatus.Full) { } @@ -174,6 +180,18 @@ else await LoadAsync(); } + private async Task DeleteLobbyAsync(Guid lobbyId) + { + var confirmed = await JS.InvokeAsync("confirm", $"Permanently delete lobby {lobbyId.ToString()[..8]}…? This cannot be undone."); + if (!confirmed) return; + + var lobby = await GameDb.CustomLobbies.FindAsync(lobbyId); + if (lobby is null) return; + GameDb.CustomLobbies.Remove(lobby); + await GameDb.SaveChangesAsync(); + await LoadAsync(); + } + private static string StatusBadge(CustomLobbyStatus status) => status switch { CustomLobbyStatus.Open => "bg-primary", diff --git a/Server/src/SOR.Collection/Handlers/CollectionGetCardsHandler.cs b/Server/src/SOR.Collection/Handlers/CollectionGetCardsHandler.cs index 157c276..31ff5c1 100644 --- a/Server/src/SOR.Collection/Handlers/CollectionGetCardsHandler.cs +++ b/Server/src/SOR.Collection/Handlers/CollectionGetCardsHandler.cs @@ -84,15 +84,15 @@ internal sealed class CollectionGetCardsHandler : CollectionHandlerBase, IMessag IsTradeable = g.Any(x => x.IsTradeable), }); - int total = await grouped.CountAsync(cancellationToken); + int groupedTotal = await grouped.CountAsync(cancellationToken); var pageRows = await grouped .OrderBy(x => x.CardDefinitionId) // or by AcquiredAt if you prefer .Skip(skip) .Take(pageSize) .ToListAsync(cancellationToken); - - var dtos = pageRows.Select(x => new PlayerCardDto( + + var groupedDtos = pageRows.Select(x => new PlayerCardDto( PlayerCardId: x.PlayerCardId, CardDefinitionId: x.CardDefinitionId, IsFoil: x.IsFoil, @@ -104,7 +104,7 @@ internal sealed class CollectionGetCardsHandler : CollectionHandlerBase, IMessag return ServerMessage.Reply( "collection.get_cards.ack", message.Seq, - new GetCardsResponse(dtos, total, page, pageSize)); + new GetCardsResponse(groupedDtos, groupedTotal, page, pageSize)); } }