mirror of
https://github.com/LBPUnion/ProjectLighthouse.git
synced 2025-07-28 16:08:38 +00:00
Add newest levels category
This commit is contained in:
parent
b867cf1d8c
commit
b340d4a955
2 changed files with 19 additions and 0 deletions
|
@ -1,3 +1,4 @@
|
|||
using System;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using LBPUnion.ProjectLighthouse.Serialization;
|
||||
|
@ -38,5 +39,18 @@ namespace LBPUnion.ProjectLighthouse.Controllers {
|
|||
|
||||
return this.Ok(slot.Serialize());
|
||||
}
|
||||
|
||||
[HttpGet("slots")]
|
||||
public IActionResult NewestSlots([FromQuery] int pageStart, [FromQuery] int pageSize) {
|
||||
string response = Enumerable.Aggregate(this.database.Slots
|
||||
.Include(s => s.Creator)
|
||||
.Include(s => s.Location)
|
||||
.OrderBy(s => s.FirstUploaded)
|
||||
.Skip(pageStart - 1)
|
||||
.Take(Math.Min(pageSize, 30))
|
||||
, string.Empty, (current, slot) => current + slot.Serialize());
|
||||
|
||||
return this.Ok(LbpSerializer.TaggedStringElement("slots", response, "total", 1));
|
||||
}
|
||||
}
|
||||
}
|
|
@ -28,6 +28,11 @@ namespace LBPUnion.ProjectLighthouse.Controllers {
|
|||
return this.Ok(user.Serialize());
|
||||
}
|
||||
|
||||
[HttpGet("users")]
|
||||
public async Task<IActionResult> GetUserAlt([FromQuery] string u) {
|
||||
return await GetUser(u);
|
||||
}
|
||||
|
||||
// [HttpPost("user/{username}")]
|
||||
// public async Task<IActionResult> CreateUser(string username) {
|
||||
// await new Database().CreateUser(username);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue