feat(tutorial): add /tutorial/gift_top with hardcoded starter present list
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
3713
SVSim.Database/Migrations/20260528160031_AddViewerClaimedTutorialGift.Designer.cs
generated
Normal file
3713
SVSim.Database/Migrations/20260528160031_AddViewerClaimedTutorialGift.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,41 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace SVSim.Database.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class AddViewerClaimedTutorialGift : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateTable(
|
||||
name: "ViewerClaimedTutorialGifts",
|
||||
columns: table => new
|
||||
{
|
||||
ViewerId = table.Column<long>(type: "bigint", nullable: false),
|
||||
PresentId = table.Column<string>(type: "character varying(64)", maxLength: 64, nullable: false),
|
||||
ClaimedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_ViewerClaimedTutorialGifts", x => new { x.ViewerId, x.PresentId });
|
||||
table.ForeignKey(
|
||||
name: "FK_ViewerClaimedTutorialGifts_Viewers_ViewerId",
|
||||
column: x => x.ViewerId,
|
||||
principalTable: "Viewers",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "ViewerClaimedTutorialGifts");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2407,6 +2407,23 @@ namespace SVSim.Database.Migrations
|
||||
b.ToTable("ViewerBattlePassProgress");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("SVSim.Database.Models.ViewerClaimedTutorialGift", b =>
|
||||
{
|
||||
b.Property<long>("ViewerId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<string>("PresentId")
|
||||
.HasMaxLength(64)
|
||||
.HasColumnType("character varying(64)");
|
||||
|
||||
b.Property<DateTime>("ClaimedAt")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.HasKey("ViewerId", "PresentId");
|
||||
|
||||
b.ToTable("ViewerClaimedTutorialGifts");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("SVSim.Database.Models.ViewerEventCounter", b =>
|
||||
{
|
||||
b.Property<long>("ViewerId")
|
||||
@@ -3598,6 +3615,17 @@ namespace SVSim.Database.Migrations
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("SVSim.Database.Models.ViewerClaimedTutorialGift", b =>
|
||||
{
|
||||
b.HasOne("SVSim.Database.Models.Viewer", "Viewer")
|
||||
.WithMany()
|
||||
.HasForeignKey("ViewerId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Viewer");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("SVSim.Database.Models.ViewerEventCounter", b =>
|
||||
{
|
||||
b.HasOne("SVSim.Database.Models.Viewer", null)
|
||||
|
||||
14
SVSim.Database/Models/ViewerClaimedTutorialGift.cs
Normal file
14
SVSim.Database/Models/ViewerClaimedTutorialGift.cs
Normal file
@@ -0,0 +1,14 @@
|
||||
namespace SVSim.Database.Models;
|
||||
|
||||
/// <summary>
|
||||
/// Records that a viewer has claimed a specific tutorial gift present_id. Composite key
|
||||
/// (ViewerId, PresentId) — viewer can't claim the same present twice.
|
||||
/// </summary>
|
||||
public class ViewerClaimedTutorialGift
|
||||
{
|
||||
public long ViewerId { get; set; }
|
||||
public string PresentId { get; set; } = string.Empty;
|
||||
public DateTime ClaimedAt { get; set; }
|
||||
|
||||
public Viewer Viewer { get; set; } = null!;
|
||||
}
|
||||
@@ -95,6 +95,8 @@ public class SVSimDbContext : DbContext
|
||||
public DbSet<ViewerStoryProgress> ViewerStoryProgress => Set<ViewerStoryProgress>();
|
||||
public DbSet<ViewerStoryBranchUnlock> ViewerStoryBranchUnlocks => Set<ViewerStoryBranchUnlock>();
|
||||
|
||||
public DbSet<ViewerClaimedTutorialGift> ViewerClaimedTutorialGifts => Set<ViewerClaimedTutorialGift>();
|
||||
|
||||
#endregion
|
||||
|
||||
public override async Task<int> SaveChangesAsync(CancellationToken cancellationToken = default)
|
||||
@@ -336,6 +338,13 @@ public class SVSimDbContext : DbContext
|
||||
b.HasIndex(e => new { e.ViewerId, e.Period });
|
||||
});
|
||||
|
||||
modelBuilder.Entity<ViewerClaimedTutorialGift>(b =>
|
||||
{
|
||||
b.HasKey(g => new { g.ViewerId, g.PresentId });
|
||||
b.HasOne(g => g.Viewer).WithMany().HasForeignKey(g => g.ViewerId).OnDelete(DeleteBehavior.Cascade);
|
||||
b.Property(g => g.PresentId).HasMaxLength(64);
|
||||
});
|
||||
|
||||
base.OnModelCreating(modelBuilder);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user