Files
SVSimServer/SVSim.EmulatedEntrypoint/Services/BattlePassService.cs

29 lines
906 B
C#

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),
});
}
}