Refactor app architecture and clean local artifacts

This commit is contained in:
AzuTear
2026-06-24 23:43:14 +02:00
parent 17134b3b82
commit fef1d36fe8
274 changed files with 37724 additions and 6065 deletions
+38
View File
@@ -0,0 +1,38 @@
using Backend.Contracts;
using Backend.Domain;
using Backend.Services;
namespace Backend.Endpoints;
public static partial class AuthEndpoints
{
private static async Task<IResult> GetSession(HttpContext context, IUserSessionService userSessionService)
{
var session = await userSessionService.ResolveSessionAsync(context, context.RequestAborted);
if (session is null)
{
return Results.Unauthorized();
}
return Results.Ok(ToAuthSessionDto(session));
}
private static async Task<IResult> Logout(HttpContext context, IUserSessionService userSessionService)
{
var session = await userSessionService.ResolveSessionAsync(context, context.RequestAborted);
if (session is null)
{
return Results.Ok(new { loggedOut = true });
}
await userSessionService.LogoutAsync(session, context.RequestAborted);
return Results.Ok(new { loggedOut = true });
}
private static AuthSessionDto ToAuthSessionDto(UserSession session) =>
new(
session.SessionToken,
session.TwitchUserId,
session.DisplayName,
session.Role);
}