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:
gamer147
2026-05-26 22:40:45 -04:00
parent 44da54c418
commit 1420c60486
8 changed files with 168 additions and 3 deletions

View File

@@ -230,12 +230,14 @@ public class SVSimDbContext : DbContext
modelBuilder.Entity<ViewerBattlePassProgressEntry>(b =>
{
b.HasKey(e => e.Id);
b.Property(e => e.Id).ValueGeneratedOnAdd();
b.HasIndex(e => new { e.ViewerId, e.SeasonId }).IsUnique();
});
modelBuilder.Entity<ViewerBattlePassClaimEntry>(b =>
{
b.HasKey(e => e.Id);
b.Property(e => e.Id).ValueGeneratedOnAdd();
b.HasIndex(e => new { e.ViewerId, e.SeasonId, e.Track, e.Level }).IsUnique();
b.HasIndex(e => new { e.ViewerId, e.SeasonId });
});