feat(battle-xp): config section + viewer loader for class XP grants

Adds BattleXpConfig ([ConfigSection("BattleXp")]) with global
XpPerWin/XpPerLoss plus per-mode nullable overrides. Adds BattleXpMode
enum and IViewerRepository.LoadForBattleXpGrantAsync — focused tracked
load with viewer.Classes + Class nav ref included, for the service
about to be introduced.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
gamer147
2026-07-04 08:44:11 -04:00
parent 57df329923
commit 4541378885
4 changed files with 55 additions and 0 deletions

View File

@@ -273,6 +273,14 @@ public class ViewerRepository : IViewerRepository
.FirstOrDefaultAsync(v => v.Id == viewerId);
}
public Task<Models.Viewer?> LoadForBattleXpGrantAsync(long viewerId, CancellationToken ct = default)
{
return _dbContext.Set<Models.Viewer>()
.Include(v => v.Classes)
.ThenInclude(c => c.Class)
.FirstOrDefaultAsync(v => v.Id == viewerId, ct);
}
public async Task SetGuildIdAsync(long viewerId, int guildId, CancellationToken ct = default)
{
var viewer = await _dbContext.Set<Models.Viewer>()