feat(bp): IBattlePassService skeleton + level-curve method + DI
This commit is contained in:
28
SVSim.EmulatedEntrypoint/Services/BattlePassService.cs
Normal file
28
SVSim.EmulatedEntrypoint/Services/BattlePassService.cs
Normal file
@@ -0,0 +1,28 @@
|
||||
using System.Globalization;
|
||||
using SVSim.Database.Repositories.BattlePass;
|
||||
using SVSim.EmulatedEntrypoint.Models.Dtos;
|
||||
|
||||
namespace SVSim.EmulatedEntrypoint.Services;
|
||||
|
||||
public sealed class BattlePassService : IBattlePassService
|
||||
{
|
||||
private readonly IBattlePassRepository _bp;
|
||||
|
||||
public BattlePassService(IBattlePassRepository bp)
|
||||
{
|
||||
_bp = bp;
|
||||
}
|
||||
|
||||
public async Task<IReadOnlyDictionary<string, BattlePassLevel>?> GetLevelCurveAsync(CancellationToken ct)
|
||||
{
|
||||
var rows = await _bp.GetLevelCurveAsync(ct);
|
||||
if (rows.Count == 0) return null;
|
||||
return rows.ToDictionary(
|
||||
r => r.Level.ToString(CultureInfo.InvariantCulture),
|
||||
r => new BattlePassLevel
|
||||
{
|
||||
Level = r.Level.ToString(CultureInfo.InvariantCulture),
|
||||
RequiredPoint = r.RequiredPoint.ToString(CultureInfo.InvariantCulture),
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user