diff --git a/ProjectLighthouse/Controllers/LevelListController.cs b/ProjectLighthouse/Controllers/ListController.cs similarity index 92% rename from ProjectLighthouse/Controllers/LevelListController.cs rename to ProjectLighthouse/Controllers/ListController.cs index 8d9396d9..1c67e077 100644 --- a/ProjectLighthouse/Controllers/LevelListController.cs +++ b/ProjectLighthouse/Controllers/ListController.cs @@ -12,12 +12,13 @@ namespace LBPUnion.ProjectLighthouse.Controllers { [ApiController] [Route("LITTLEBIGPLANETPS3_XML/")] [Produces("text/xml")] - public class LevelListController : ControllerBase { + public class ListController : ControllerBase { private readonly Database database; - public LevelListController(Database database) { + public ListController(Database database) { this.database = database; } + #region Levels #region Level Queue (lolcatftw) [HttpGet("slots/lolcatftw/{username}")] @@ -34,19 +35,6 @@ namespace LBPUnion.ProjectLighthouse.Controllers { return this.Ok(LbpSerializer.TaggedStringElement("slots", response, "total", 1)); } - [HttpPost("lolcatftw/remove/user/{id:int}")] - public async Task RemoveQueuedLevel(int id) { - User? user = await this.database.UserFromRequest(this.Request); - if(user == null) return this.StatusCode(403, ""); - - QueuedLevel queuedLevel = await this.database.QueuedLevels.FirstOrDefaultAsync(q => q.UserId == user.UserId && q.SlotId == id); - if(queuedLevel != null) this.database.QueuedLevels.Remove(queuedLevel); - - await this.database.SaveChangesAsync(); - - return this.Ok(); - } - [HttpPost("lolcatftw/add/user/{id:int}")] public async Task AddQueuedLevel(int id) { User? user = await this.database.UserFromRequest(this.Request); @@ -64,6 +52,19 @@ namespace LBPUnion.ProjectLighthouse.Controllers { return this.Ok(); } + + [HttpPost("lolcatftw/remove/user/{id:int}")] + public async Task RemoveQueuedLevel(int id) { + User? user = await this.database.UserFromRequest(this.Request); + if(user == null) return this.StatusCode(403, ""); + + QueuedLevel queuedLevel = await this.database.QueuedLevels.FirstOrDefaultAsync(q => q.UserId == user.UserId && q.SlotId == id); + if(queuedLevel != null) this.database.QueuedLevels.Remove(queuedLevel); + + await this.database.SaveChangesAsync(); + + return this.Ok(); + } #endregion @@ -85,7 +86,7 @@ namespace LBPUnion.ProjectLighthouse.Controllers { } [HttpPost("favourite/slot/user/{id:int}")] - public async Task AddFavourite(int id) { + public async Task AddFavouriteSlot(int id) { User? user = await this.database.UserFromRequest(this.Request); if(user == null) return this.StatusCode(403, ""); @@ -103,7 +104,7 @@ namespace LBPUnion.ProjectLighthouse.Controllers { } [HttpPost("unfavourite/slot/user/{id:int}")] - public async Task RemoveFavourite(int id) { + public async Task RemoveFavouriteSlot(int id) { User? user = await this.database.UserFromRequest(this.Request); if(user == null) return this.StatusCode(403, ""); @@ -116,6 +117,12 @@ namespace LBPUnion.ProjectLighthouse.Controllers { } #endregion + #endregion Levels + #region Users + + + + #endregion } } \ No newline at end of file diff --git a/ProjectLighthouse/Helpers/MatchHelper.cs b/ProjectLighthouse/Helpers/MatchHelper.cs index fefa8888..22d34ad0 100644 --- a/ProjectLighthouse/Helpers/MatchHelper.cs +++ b/ProjectLighthouse/Helpers/MatchHelper.cs @@ -1,6 +1,4 @@ #nullable enable -using System; -using System.Collections.Generic; using System.Linq; using System.Text.Json; using LBPUnion.ProjectLighthouse.Types.Match;