From b0858448c8bc284a27d35c082985c5bd3361ee90 Mon Sep 17 00:00:00 2001 From: Slendy Date: Wed, 29 Mar 2023 19:34:16 -0500 Subject: [PATCH] Fix LBP3 playlist editing --- .../Controllers/Slots/CollectionController.cs | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) 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")]