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,23 @@
|
||||
using SVSim.Database.Enums;
|
||||
using SVSim.Database.Models;
|
||||
|
||||
namespace SVSim.Database.Repositories.BattlePass;
|
||||
|
||||
public interface IViewerBattlePassRepository
|
||||
{
|
||||
/// <summary>
|
||||
/// Get-or-create progress row for (viewer, season). New rows are added to the change-tracker
|
||||
/// but NOT saved — caller batches with other mutations.
|
||||
/// </summary>
|
||||
Task<ViewerBattlePassProgressEntry> GetOrCreateProgressAsync(long viewerId, int seasonId, CancellationToken ct);
|
||||
|
||||
/// <summary>
|
||||
/// All claim rows for (viewer, season). Used by /battle_pass/info to enrich is_received.
|
||||
/// </summary>
|
||||
Task<List<ViewerBattlePassClaimEntry>> GetClaimsAsync(long viewerId, int seasonId, CancellationToken ct);
|
||||
|
||||
/// <summary>
|
||||
/// Append a claim row (in-memory; caller saves).
|
||||
/// </summary>
|
||||
void AddClaim(long viewerId, int seasonId, BattlePassTrack track, int level, DateTimeOffset claimedAt);
|
||||
}
|
||||
Reference in New Issue
Block a user