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:
gamer147
2026-06-08 18:52:32 -04:00
parent 7a82f4e189
commit 6d60edaa2a
3 changed files with 65 additions and 0 deletions

View File

@@ -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);

View File

@@ -21,6 +21,7 @@ public interface IGlobalsRepository
Task<List<BattlePassLevelEntry>> GetBattlePassLevels();
Task<List<DailyLoginBonusEntry>> GetDailyLoginBonus();
Task<List<BannerEntry>> GetBanners();
Task<IReadOnlyList<HomeDialogEntry>> GetActiveHomeDialogsAsync(DateTime nowUtc);
Task<ColosseumConfig?> GetCurrentColosseum();
Task<SealedConfig?> GetCurrentSealedSeason();
Task<MasterPointRankingPeriodEntry?> GetCurrentMasterPointPeriod();