From fabc81bbf6ebc5fb671ca236efa3b55ec5ce8870 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Chris=20G=C3=A5rdenberg?= Date: Tue, 25 Jun 2024 21:30:07 +0200 Subject: [PATCH] feat: Also added endpoint for projectid-json, to enable fetching data for deleted projects --- CFLookup/ApiController.cs | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/CFLookup/ApiController.cs b/CFLookup/ApiController.cs index f3b5ede..cde9b04 100644 --- a/CFLookup/ApiController.cs +++ b/CFLookup/ApiController.cs @@ -41,5 +41,25 @@ public async Task GetSlugProject(string game, string category, st return NotFound(); } } + + [HttpGet("/{projectId}.json")] + public async Task GetProject(int projectId) + { + try + { + var project = await SharedMethods.SearchModAsync(_redis, _cfApiClient, projectId); + + if (project == null) + { + return NotFound(); + } + + return new JsonResult(project); + } + catch + { + return NotFound(); + } + } } }