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:
13
SVSim.Database/Models/ViewerSerialCodeRedemption.cs
Normal file
13
SVSim.Database/Models/ViewerSerialCodeRedemption.cs
Normal 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; }
|
||||
}
|
||||
Reference in New Issue
Block a user