osu-tournament-rating / otr-api

API powering osu! Tournament Rating
https://otr.stagec.xyz/
4 stars 2 forks source link

Use redirect actions for `/me` endpoints #291

Closed myssto closed 1 month ago

myssto commented 1 month ago

Soft breaking changes, as there are new response codes. Functionally, nothing has changed. As long as web has redirect following, no changes should be required.

Closes #235

hburn7 commented 1 month ago

I get the following No route matches the supplied values error when trying to load my dashboard on my local. I'm testing with "ASPNETCORE_ENVIRONMENT": "Production" in my launchSettings.json profile (production mode).

[2024-05-05 08:59:04.441 INF] Client on scheme http requests GET localhost:5075/api/v1/me/stats?mode=0 with body ''
[2024-05-05 08:59:04.656 ERR] Connection id "0HN3D0CHFFU13", Request id "0HN3D0CHFFU13:00000001": An unhandled exception was thrown by the application.
System.InvalidOperationException: No route matches the supplied values.
   at Microsoft.AspNetCore.Mvc.Infrastructure.RedirectToActionResultExecutor.ExecuteAsync(ActionContext context, RedirectToActionResult result)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeResultAsync>g__Logged|22_0(ResourceInvoker invoker, IActionResult result)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeNextResultFilterAsync>g__Awaited|30_0[TFilter,TFilterAsync](ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Rethrow(ResultExecutedContextSealed context)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.ResultNext[TFilter,TFilterAsync](State& next, Scope& scope, Object& state, Boolean& isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.InvokeResultFilters()
--- End of stack trace from previous location ---
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeFilterPipelineAsync>g__Awaited|20_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Logged|17_1(ResourceInvoker invoker)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Logged|17_1(ResourceInvoker invoker)
   at Microsoft.AspNetCore.RateLimiting.RateLimitingMiddleware.InvokeInternal(HttpContext context, EnableRateLimitingAttribute enableRateLimitingAttribute)
   at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context)
   at API.Middlewares.WhitelistEnforcementMiddleware.Invoke(HttpContext context) in /home/stage/Documents/code/git/otr-api/API/Middlewares/WhitelistEnforcementMiddleware.cs:line 27
   at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)
   at API.Middlewares.RequestLoggingMiddleware.Invoke(HttpContext context) in /home/stage/Documents/code/git/otr-api/API/Middlewares/RequestLoggingMiddleware.cs:line 23
   at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.HttpProtocol.ProcessRequests[TContext](IHttpApplication`1 application)
myssto commented 1 month ago

Damn I got got by an automatic refactor action from Rider lol

return RedirectToAction("GetByUsername", "Stats", new