feat(bp): repositories + identity generation for runtime-inserted tables
Add ValueGeneratedOnAdd to ViewerBattlePassProgress.Id and ViewerBattlePassClaims.Id so Postgres generates IDENTITY values at runtime. Regenerate AddBattlePass migration in-place to include the IdentityByDefaultColumn annotations. Add IBattlePassRepository / BattlePassRepository (season lookup + level-curve cache) and IViewerBattlePassRepository / ViewerBattlePassRepository (get-or-create progress, claim reads/writes). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
using SVSim.Database.Models;
|
||||
|
||||
namespace SVSim.Database.Repositories.BattlePass;
|
||||
|
||||
public interface IBattlePassRepository
|
||||
{
|
||||
/// <summary>
|
||||
/// Active season for the given moment (StartDate <= when < EndDate). Returns null
|
||||
/// if none. If multiple match (overlap), the most recently started wins.
|
||||
/// </summary>
|
||||
Task<BattlePassSeasonEntry?> GetActiveSeasonAsync(DateTimeOffset when, CancellationToken ct);
|
||||
|
||||
/// <summary>
|
||||
/// Season by id (no time-window filter). Used by /battle_pass/buy to validate request.season_id.
|
||||
/// </summary>
|
||||
Task<BattlePassSeasonEntry?> GetSeasonAsync(int seasonId, CancellationToken ct);
|
||||
|
||||
/// <summary>
|
||||
/// All rewards for a season, both tracks. Sorted by (Track, Level) for deterministic wire order.
|
||||
/// </summary>
|
||||
Task<List<BattlePassRewardEntry>> GetSeasonRewardsAsync(int seasonId, CancellationToken ct);
|
||||
|
||||
/// <summary>
|
||||
/// Global level curve. Cached after first load.
|
||||
/// </summary>
|
||||
Task<IReadOnlyList<BattlePassLevelEntry>> GetLevelCurveAsync(CancellationToken ct);
|
||||
}
|
||||
Reference in New Issue
Block a user