Refactor app architecture and clean local artifacts
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
using Backend.Data;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace Backend.Services;
|
||||
|
||||
public sealed class RiskRuleService(AwardsDbContext db) : IRiskRuleService
|
||||
{
|
||||
public async Task<RiskRuleSetting[]> GetRulesAsync(CancellationToken cancellationToken = default)
|
||||
{
|
||||
var settings = await db.SiteSettings
|
||||
.AsNoTracking()
|
||||
.FirstOrDefaultAsync(item => item.Id == 1, cancellationToken);
|
||||
|
||||
return RiskRuleSettings.Read(settings);
|
||||
}
|
||||
|
||||
public async Task<RiskRuleSetting> GetRuleAsync(string key, CancellationToken cancellationToken = default) =>
|
||||
RiskRuleSettings.Find(await GetRulesAsync(cancellationToken), key);
|
||||
}
|
||||
Reference in New Issue
Block a user