feat(serial-code): add SerialCode + SerialCodeReward + ViewerSerialCodeRedemption entities

Three new EF entities for /campaign/regist_serial_code: SerialCodeEntry (code, message,
window, enabled flag), SerialCodeRewardEntry (FK child, per-slot reward), and
ViewerSerialCodeRedemption (composite-PK redemption record). Registered in SVSimDbContext
with unique index on Code and cascade FK constraints. 3/3 persistence tests pass.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
gamer147
2026-06-09 18:42:10 -04:00
parent b117fe825c
commit 206be77a86
5 changed files with 193 additions and 0 deletions

View File

@@ -0,0 +1,13 @@
namespace SVSim.Database.Models;
/// <summary>
/// One row per (viewer, code) redemption. Composite PK on <c>(ViewerId, SerialCodeId)</c>
/// enforces the single-use-per-viewer guarantee at the DB layer; the controller catches
/// the unique-constraint violation as a race-condition backstop.
/// </summary>
public class ViewerSerialCodeRedemption
{
public long ViewerId { get; set; }
public int SerialCodeId { get; set; }
public DateTime RedeemedAt { get; set; }
}