diff --git a/ProjectLighthouse.Servers.GameServer/Controllers/Slots/CollectionController.cs b/ProjectLighthouse.Servers.GameServer/Controllers/Slots/CollectionController.cs index 90b5cb24..5542c619 100644 --- a/ProjectLighthouse.Servers.GameServer/Controllers/Slots/CollectionController.cs +++ b/ProjectLighthouse.Servers.GameServer/Controllers/Slots/CollectionController.cs @@ -64,7 +64,7 @@ public class CollectionController : ControllerBase { targetPlaylist.SlotIds = targetPlaylist.SlotIds.Where(s => s != slotId).ToArray(); await this.database.SaveChangesAsync(); - return this.Ok(this.GetUserPlaylists(token.UserId)); + return this.Ok(await this.GetUserPlaylists(token.UserId)); } GamePlaylist? newPlaylist = await this.DeserializeBody("playlist", "levels"); @@ -96,13 +96,12 @@ public class CollectionController : ControllerBase await this.database.SaveChangesAsync(); - return this.Ok(this.GetUserPlaylists(token.UserId)); + return this.Ok(await this.GetUserPlaylists(token.UserId)); } private async Task GetUserPlaylists(int userId) { - List playlists = await this.database.Playlists.Include(p => p.Creator) - .Where(p => p.CreatorId == userId) + List playlists = await this.database.Playlists.Where(p => p.CreatorId == userId) .Select(p => GamePlaylist.CreateFromEntity(p)) .ToListAsync(); int total = this.database.Playlists.Count(p => p.CreatorId == userId); @@ -140,7 +139,7 @@ public class CollectionController : ControllerBase await this.database.SaveChangesAsync(); - return this.Ok(await this.GetUserPlaylists(token.UserId)); + return this.Ok(GamePlaylist.CreateFromEntity(playlistEntity)); } [HttpGet("user/{username}/playlists")]