feat(rank): add ViewerRankProgress owned entity + migration

One row per (viewer, format) tracking accumulated Point + MasterPoint.
Unique index on (ViewerId, Format) enforces one row per format per viewer
(mirrors owned-collection precedent per project_owned_collection_unique_index).

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
gamer147
2026-07-04 10:13:50 -04:00
parent 94ed6734c7
commit 9f97837211
5 changed files with 5184 additions and 0 deletions

View File

@@ -87,6 +87,8 @@ public class Viewer : BaseEntity<long>
public List<ViewerFreePackClaim> FreePackClaims { get; set; } = new List<ViewerFreePackClaim>();
public List<ViewerRankProgress> RankProgress { get; set; } = new List<ViewerRankProgress>();
public List<MyPageBgRotationEntry> MyPageBgRotation { get; set; } = new List<MyPageBgRotationEntry>();
public List<ViewerGachaPointBalance> GachaPointBalances { get; set; } = new List<ViewerGachaPointBalance>();

View File

@@ -0,0 +1,17 @@
using Microsoft.EntityFrameworkCore;
using SVSim.Database.Enums;
namespace SVSim.Database.Models;
/// <summary>
/// One row per (viewer, format) tracking accumulated rank points and master points.
/// Point is 0-based cumulative; the current rank_id is derived at read time from Point
/// (and MasterPoint once past 50000). Owned collection on <see cref="Viewer"/>.
/// </summary>
[Owned]
public class ViewerRankProgress
{
public Format Format { get; set; }
public int Point { get; set; }
public int MasterPoint { get; set; }
}