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
@@ -0,0 +1,23 @@
using Backend.Data;
using Backend.Domain;
using Microsoft.EntityFrameworkCore;
namespace Backend.Repositories;
public sealed class UserSessionRepository(AwardsDbContext dbContext) : IUserSessionRepository
{
public Task<UserSession?> GetActiveByTokenAsync(string token, CancellationToken cancellationToken = default) =>
dbContext.UserSessions.FirstOrDefaultAsync(
item => item.SessionToken == token && item.IsActive,
cancellationToken);
public Task<int> CountRecentSessionsFromIpAsync(string ipAddress, DateTimeOffset since, CancellationToken cancellationToken = default) =>
dbContext.UserSessions.CountAsync(
item => item.CreatedFromIp == ipAddress && item.CreatedAt >= since,
cancellationToken);
public void Add(UserSession session) => dbContext.UserSessions.Add(session);
public Task SaveChangesAsync(CancellationToken cancellationToken = default) =>
dbContext.SaveChangesAsync(cancellationToken);
}