Refactor app architecture and clean local artifacts
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
using Backend.Data;
|
||||
using Backend.Domain;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace Backend.Repositories;
|
||||
|
||||
public sealed class RiskFlagRepository(AwardsDbContext dbContext) : IRiskFlagRepository
|
||||
{
|
||||
public Task<bool> ExistsOpenRecentAsync(
|
||||
int? seasonId,
|
||||
string? twitchUserId,
|
||||
string source,
|
||||
string type,
|
||||
string clientIp,
|
||||
DateTimeOffset threshold,
|
||||
CancellationToken cancellationToken = default) =>
|
||||
dbContext.RiskFlags.AnyAsync(
|
||||
item => item.Status == "open"
|
||||
&& item.Source == source
|
||||
&& item.Type == type
|
||||
&& item.TwitchUserId == twitchUserId
|
||||
&& item.CreatedFromIp == clientIp
|
||||
&& item.SeasonId == seasonId
|
||||
&& item.CreatedAt >= threshold,
|
||||
cancellationToken);
|
||||
|
||||
public void Add(RiskFlag riskFlag) => dbContext.RiskFlags.Add(riskFlag);
|
||||
}
|
||||
Reference in New Issue
Block a user