Fix /s/user/{id} endpoint

This commit is contained in:
jvyden 2021-10-16 17:19:25 -04:00
commit f941befc7e
No known key found for this signature in database
GPG key ID: 18BCF2BE0262B278

View file

@ -1,3 +1,4 @@
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
@ -18,15 +19,12 @@ namespace ProjectLighthouse.Controllers {
}
[HttpGet("s/user/{id:int}")]
public async Task<IActionResult> SUser(int id) {
Slot slot = await new Database().Slots.FirstOrDefaultAsync(s => s.SlotId == id);
public IActionResult SUser(int id) {
IEnumerable<Slot> slots = new Database().Slots
.Where(s => s.CreatorId == id)
.AsEnumerable();
return this.Ok(slot.Serialize());
}
[HttpGet("slots/lolcatftw/{username}")]
public IActionResult SlotsLolCat(string username) {
string response = Enumerable.Aggregate(new Database().Slots, string.Empty, (current, slot) => current + slot.Serialize());
string response = slots.Aggregate(string.Empty, (current, s) => current + s.Serialize());
return this.Ok(LbpSerializer.TaggedStringElement("slots", response, "total", 1));
}