aboutsummaryrefslogtreecommitdiff
path: root/Backend/GetStopEstimates.cs
diff options
context:
space:
mode:
authorAriel Costas Guerrero <ariel@costas.dev>2025-05-26 10:48:43 +0200
committerAriel Costas Guerrero <ariel@costas.dev>2025-05-26 10:48:43 +0200
commit5ced7f916d94e86e9a7ec164bee56f9a8e3a2a3a (patch)
treeb1ef5afa17b4a2f9fb2cbd683afc2fb6d905b5e1 /Backend/GetStopEstimates.cs
parent4637373b50636e78dc2c7b6f99be879edb4ff7dc (diff)
Replace Azure SWA with custom server
Diffstat (limited to 'Backend/GetStopEstimates.cs')
-rw-r--r--Backend/GetStopEstimates.cs43
1 files changed, 0 insertions, 43 deletions
diff --git a/Backend/GetStopEstimates.cs b/Backend/GetStopEstimates.cs
deleted file mode 100644
index a97625b..0000000
--- a/Backend/GetStopEstimates.cs
+++ /dev/null
@@ -1,43 +0,0 @@
-using Microsoft.Azure.Functions.Worker;
-using Microsoft.AspNetCore.Http;
-using Microsoft.AspNetCore.Mvc;
-using Costasdev.VigoTransitApi;
-
-namespace Costasdev.UrbanoVigoWeb;
-
-public class GetStopEstimates
-{
- private readonly VigoTransitApiClient _api;
-
- public GetStopEstimates(HttpClient http)
- {
- _api = new VigoTransitApiClient(http);
- }
-
- [Function("GetStopEstimates")]
- public async Task<IActionResult> Run([HttpTrigger(AuthorizationLevel.Anonymous, "get")] HttpRequest req)
- {
- var argumentAvailable = req.Query.TryGetValue("id", out var requestedStopIdString);
- if (!argumentAvailable)
- {
- return new BadRequestObjectResult("Please provide a stop id");
- }
-
- var argumentNumber = int.TryParse(requestedStopIdString, out var requestedStopId);
- if (!argumentNumber)
- {
- return new BadRequestObjectResult("Please provide a valid stop id");
- }
-
- try
- {
- var estimates = await _api.GetStopEstimates(requestedStopId);
- return new OkObjectResult(estimates);
- }
- catch (InvalidOperationException)
- {
- return new BadRequestObjectResult("Stop not found");
- }
- }
-}
-