From f941befc7e73bc767a5b3582295def0639fbdac0 Mon Sep 17 00:00:00 2001 From: jvyden Date: Sat, 16 Oct 2021 17:19:25 -0400 Subject: [PATCH] Fix /s/user/{id} endpoint --- ProjectLighthouse/Controllers/SlotsController.cs | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/ProjectLighthouse/Controllers/SlotsController.cs b/ProjectLighthouse/Controllers/SlotsController.cs index ba095e09..1900932c 100644 --- a/ProjectLighthouse/Controllers/SlotsController.cs +++ b/ProjectLighthouse/Controllers/SlotsController.cs @@ -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 SUser(int id) { - Slot slot = await new Database().Slots.FirstOrDefaultAsync(s => s.SlotId == id); + public IActionResult SUser(int id) { + IEnumerable 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)); }