feat(leader-skin): shop catalog + 5 endpoints (/products, /buy, /buy_set, /buy_set_item, /ids)
Schema: LeaderSkinShopSeries -> Products (owned rewards) + owned SetCompletionRewards on the series; ViewerLeaderSkinSetClaim composite PK (ViewerId, SeriesId) backs the /buy_set_item idempotent-claim check. Importer mirrors SleeveShopImporter: idempotent find-or-create, owned collections rewritten wholesale on rerun. 16 series, 104 products. Controller (extends existing /set with 5 new endpoints): - /products: dict-keyed-by-series_id-string wire shape. is_completed per-viewer, rewards.status from ViewerLeaderSkinSetClaim (0=no set sale, 1=available, 2=claimed) matching client RewardStatus enum. - /buy: single skin, sales_type 1/2 dispatch, 3=>501. - /buy_set: whole series at SetPrice; requires set_sales_status != 0; grants every product's rewards (RewardGrantService idempotent on already-owned cosmetics, so partial-set buys don't double-add). - /buy_set_item: requires viewer owns every skin in series; idempotent on re-claim (returns 200 + empty reward_list, not 400) so client retries don't error. - /ids: flat owned-skin-id list for badge refresh. 496 tests pass (was 486; +10 leader-skin-shop tests). Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -1182,6 +1182,100 @@ namespace SVSim.Database.Migrations
|
||||
b.ToTable("LeaderSkins");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("SVSim.Database.Models.LeaderSkinShopProductEntry", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("CvNameKey")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<DateTime>("DateCreated")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<DateTime?>("DateUpdated")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("IntroductionKey")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<bool>("IsEnabled")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<int>("LeaderSkinId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("ProductNameKey")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("SeriesId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int?>("SinglePriceCrystal")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int?>("SinglePriceRupy")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int?>("SinglePriceTicket")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<long?>("TicketItemId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<int?>("TicketNumber")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("SeriesId");
|
||||
|
||||
b.ToTable("LeaderSkinShopProducts");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("SVSim.Database.Models.LeaderSkinShopSeriesEntry", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<DateTime>("DateCreated")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<DateTime?>("DateUpdated")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<bool>("IsEnabled")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<bool>("IsNew")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<int>("SetCompletionRewardStatus")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int?>("SetPriceCrystal")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int?>("SetPriceRupy")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int?>("SetPriceTicket")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<long?>("SetPriceTicketId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<int>("SetSalesStatus")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("LeaderSkinShopSeries");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("SVSim.Database.Models.LoadingExclusionCardEntry", b =>
|
||||
{
|
||||
b.Property<long>("Id")
|
||||
@@ -2300,6 +2394,24 @@ namespace SVSim.Database.Migrations
|
||||
b.ToTable("ViewerEventCounters");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("SVSim.Database.Models.ViewerLeaderSkinSetClaim", b =>
|
||||
{
|
||||
b.Property<long>("ViewerId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<int>("SeriesId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<DateTime>("ClaimedAt")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.HasKey("ViewerId", "SeriesId");
|
||||
|
||||
b.HasIndex("ViewerId");
|
||||
|
||||
b.ToTable("ViewerLeaderSkinSetClaims");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("SVSim.Database.Models.ViewerMission", b =>
|
||||
{
|
||||
b.Property<long>("Id")
|
||||
@@ -2714,6 +2826,86 @@ namespace SVSim.Database.Migrations
|
||||
b.Navigation("Class");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("SVSim.Database.Models.LeaderSkinShopProductEntry", b =>
|
||||
{
|
||||
b.HasOne("SVSim.Database.Models.LeaderSkinShopSeriesEntry", "Series")
|
||||
.WithMany("Products")
|
||||
.HasForeignKey("SeriesId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.OwnsMany("SVSim.Database.Models.LeaderSkinShopProductRewardEntry", "Rewards", b1 =>
|
||||
{
|
||||
b1.Property<int>("LeaderSkinShopProductEntryId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b1.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b1.Property<int>("Id"));
|
||||
|
||||
b1.Property<int>("OrderIndex")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b1.Property<long>("RewardDetailId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b1.Property<int>("RewardNumber")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b1.Property<int>("RewardType")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b1.HasKey("LeaderSkinShopProductEntryId", "Id");
|
||||
|
||||
b1.ToTable("LeaderSkinShopProductRewardEntry");
|
||||
|
||||
b1.WithOwner()
|
||||
.HasForeignKey("LeaderSkinShopProductEntryId");
|
||||
});
|
||||
|
||||
b.Navigation("Rewards");
|
||||
|
||||
b.Navigation("Series");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("SVSim.Database.Models.LeaderSkinShopSeriesEntry", b =>
|
||||
{
|
||||
b.OwnsMany("SVSim.Database.Models.LeaderSkinShopSeriesRewardEntry", "SetCompletionRewards", b1 =>
|
||||
{
|
||||
b1.Property<int>("LeaderSkinShopSeriesEntryId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b1.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b1.Property<int>("Id"));
|
||||
|
||||
b1.Property<int>("OrderIndex")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b1.Property<long>("RewardDetailId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b1.Property<int>("RewardNumber")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b1.Property<int>("RewardType")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b1.HasKey("LeaderSkinShopSeriesEntryId", "Id");
|
||||
|
||||
b1.ToTable("LeaderSkinShopSeriesRewardEntry");
|
||||
|
||||
b1.WithOwner()
|
||||
.HasForeignKey("LeaderSkinShopSeriesEntryId");
|
||||
});
|
||||
|
||||
b.Navigation("SetCompletionRewards");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("SVSim.Database.Models.PackConfigEntry", b =>
|
||||
{
|
||||
b.OwnsMany("SVSim.Database.Models.PackBannerEntry", "Banners", b1 =>
|
||||
@@ -3396,6 +3588,11 @@ namespace SVSim.Database.Migrations
|
||||
b.Navigation("LeaderSkins");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("SVSim.Database.Models.LeaderSkinShopSeriesEntry", b =>
|
||||
{
|
||||
b.Navigation("Products");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("SVSim.Database.Models.PuzzleGroupEntry", b =>
|
||||
{
|
||||
b.Navigation("Puzzles");
|
||||
|
||||
Reference in New Issue
Block a user