mirror of
https://github.com/LBPUnion/ProjectLighthouse.git
synced 2025-07-15 17:51:28 +00:00
Fix LBP3 playlist editing
This commit is contained in:
parent
8376928a6c
commit
b0858448c8
1 changed files with 4 additions and 5 deletions
|
@ -64,7 +64,7 @@ public class CollectionController : ControllerBase
|
||||||
{
|
{
|
||||||
targetPlaylist.SlotIds = targetPlaylist.SlotIds.Where(s => s != slotId).ToArray();
|
targetPlaylist.SlotIds = targetPlaylist.SlotIds.Where(s => s != slotId).ToArray();
|
||||||
await this.database.SaveChangesAsync();
|
await this.database.SaveChangesAsync();
|
||||||
return this.Ok(this.GetUserPlaylists(token.UserId));
|
return this.Ok(await this.GetUserPlaylists(token.UserId));
|
||||||
}
|
}
|
||||||
|
|
||||||
GamePlaylist? newPlaylist = await this.DeserializeBody<GamePlaylist>("playlist", "levels");
|
GamePlaylist? newPlaylist = await this.DeserializeBody<GamePlaylist>("playlist", "levels");
|
||||||
|
@ -96,13 +96,12 @@ public class CollectionController : ControllerBase
|
||||||
|
|
||||||
await this.database.SaveChangesAsync();
|
await this.database.SaveChangesAsync();
|
||||||
|
|
||||||
return this.Ok(this.GetUserPlaylists(token.UserId));
|
return this.Ok(await this.GetUserPlaylists(token.UserId));
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task<PlaylistResponse> GetUserPlaylists(int userId)
|
private async Task<PlaylistResponse> GetUserPlaylists(int userId)
|
||||||
{
|
{
|
||||||
List<GamePlaylist> playlists = await this.database.Playlists.Include(p => p.Creator)
|
List<GamePlaylist> playlists = await this.database.Playlists.Where(p => p.CreatorId == userId)
|
||||||
.Where(p => p.CreatorId == userId)
|
|
||||||
.Select(p => GamePlaylist.CreateFromEntity(p))
|
.Select(p => GamePlaylist.CreateFromEntity(p))
|
||||||
.ToListAsync();
|
.ToListAsync();
|
||||||
int total = this.database.Playlists.Count(p => p.CreatorId == userId);
|
int total = this.database.Playlists.Count(p => p.CreatorId == userId);
|
||||||
|
@ -140,7 +139,7 @@ public class CollectionController : ControllerBase
|
||||||
|
|
||||||
await this.database.SaveChangesAsync();
|
await this.database.SaveChangesAsync();
|
||||||
|
|
||||||
return this.Ok(await this.GetUserPlaylists(token.UserId));
|
return this.Ok(GamePlaylist.CreateFromEntity(playlistEntity));
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpGet("user/{username}/playlists")]
|
[HttpGet("user/{username}/playlists")]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue