feat(home-dialog): IGlobalsRepository.GetActiveHomeDialogsAsync
Window is [begin, end) — exclusive upper bound. Ordered priority-DESC then Id-ASC so the controller can break on the first match. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -65,6 +65,13 @@ public class GlobalsRepository : IGlobalsRepository
|
||||
public Task<List<BannerEntry>> GetBanners() =>
|
||||
_dbContext.Banners.AsNoTracking().OrderBy(b => b.Id).ToListAsync();
|
||||
|
||||
public async Task<IReadOnlyList<HomeDialogEntry>> GetActiveHomeDialogsAsync(DateTime nowUtc) =>
|
||||
await _dbContext.HomeDialogEntries.AsNoTracking()
|
||||
.Where(e => e.BeginTime <= nowUtc && e.EndTime > nowUtc)
|
||||
.OrderByDescending(e => e.Priority)
|
||||
.ThenBy(e => e.Id)
|
||||
.ToListAsync();
|
||||
|
||||
public Task<ColosseumConfig?> GetCurrentColosseum() =>
|
||||
_dbContext.Colosseums.AsNoTracking().FirstOrDefaultAsync(e => e.Id == 1);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user