mirror of
https://github.com/LBPUnion/ProjectLighthouse.git
synced 2025-08-09 21:38:43 +00:00
Fix /s/user/{id} endpoint
This commit is contained in:
parent
a0a21e4898
commit
f941befc7e
1 changed files with 6 additions and 8 deletions
|
@ -1,3 +1,4 @@
|
||||||
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
@ -18,15 +19,12 @@ namespace ProjectLighthouse.Controllers {
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpGet("s/user/{id:int}")]
|
[HttpGet("s/user/{id:int}")]
|
||||||
public async Task<IActionResult> SUser(int id) {
|
public IActionResult SUser(int id) {
|
||||||
Slot slot = await new Database().Slots.FirstOrDefaultAsync(s => s.SlotId == id);
|
IEnumerable<Slot> slots = new Database().Slots
|
||||||
|
.Where(s => s.CreatorId == id)
|
||||||
|
.AsEnumerable();
|
||||||
|
|
||||||
return this.Ok(slot.Serialize());
|
string response = slots.Aggregate(string.Empty, (current, s) => current + s.Serialize());
|
||||||
}
|
|
||||||
|
|
||||||
[HttpGet("slots/lolcatftw/{username}")]
|
|
||||||
public IActionResult SlotsLolCat(string username) {
|
|
||||||
string response = Enumerable.Aggregate(new Database().Slots, string.Empty, (current, slot) => current + slot.Serialize());
|
|
||||||
|
|
||||||
return this.Ok(LbpSerializer.TaggedStringElement("slots", response, "total", 1));
|
return this.Ok(LbpSerializer.TaggedStringElement("slots", response, "total", 1));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue