More story fixes
This commit is contained in:
@@ -39,6 +39,7 @@ public class StoryChapter
|
||||
public SpecialBattleSetting? SpecialBattleSetting { get; set; }
|
||||
|
||||
public int ReleasePoint { get; set; }
|
||||
public string? UnlockText { get; set; }
|
||||
public bool IsMaintenanceChapter { get; set; }
|
||||
public bool IsPlayAnotherEndAppearanceAnimation { get; set; }
|
||||
public bool IsReleasedAnotherEnd { get; set; }
|
||||
|
||||
@@ -23,4 +23,7 @@ public class StorySection
|
||||
public int StoryTypeOverwrite { get; set; }
|
||||
public bool IsUnderMaintenance { get; set; }
|
||||
public bool IsPlayAnotherEndAppearanceAnimation { get; set; }
|
||||
|
||||
public int IsSpoiler { get; set; }
|
||||
public string SpoilerMessage { get; set; } = string.Empty;
|
||||
}
|
||||
|
||||
2579
SVSim.Database/Migrations/20260525212450_AddStoryChapterUnlockText.Designer.cs
generated
Normal file
2579
SVSim.Database/Migrations/20260525212450_AddStoryChapterUnlockText.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,28 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace SVSim.Database.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class AddStoryChapterUnlockText : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "UnlockText",
|
||||
table: "StoryChapters",
|
||||
type: "text",
|
||||
nullable: true);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropColumn(
|
||||
name: "UnlockText",
|
||||
table: "StoryChapters");
|
||||
}
|
||||
}
|
||||
}
|
||||
2586
SVSim.Database/Migrations/20260525213842_AddStorySectionSpoilerFields.Designer.cs
generated
Normal file
2586
SVSim.Database/Migrations/20260525213842_AddStorySectionSpoilerFields.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,40 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace SVSim.Database.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class AddStorySectionSpoilerFields : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddColumn<int>(
|
||||
name: "IsSpoiler",
|
||||
table: "StorySections",
|
||||
type: "integer",
|
||||
nullable: false,
|
||||
defaultValue: 0);
|
||||
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "SpoilerMessage",
|
||||
table: "StorySections",
|
||||
type: "text",
|
||||
nullable: false,
|
||||
defaultValue: "");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropColumn(
|
||||
name: "IsSpoiler",
|
||||
table: "StorySections");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "SpoilerMessage",
|
||||
table: "StorySections");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -230,6 +230,9 @@ namespace SVSim.Database.Migrations
|
||||
b.Property<int?>("SpecialBattleSettingId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("UnlockText")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<decimal>("XCoordinate")
|
||||
.HasColumnType("numeric");
|
||||
|
||||
@@ -271,6 +274,9 @@ namespace SVSim.Database.Migrations
|
||||
b.Property<bool>("IsPlayAnotherEndAppearanceAnimation")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<int>("IsSpoiler")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<bool>("IsUnderMaintenance")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
@@ -281,6 +287,10 @@ namespace SVSim.Database.Migrations
|
||||
b.Property<int>("OrderId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("SpoilerMessage")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("StoryApiType")
|
||||
.HasColumnType("integer");
|
||||
|
||||
|
||||
@@ -16,4 +16,12 @@ public interface IStoryMasterRepository
|
||||
|
||||
Task<StoryChapter?> GetChapterByIdAsync(int storyId);
|
||||
Task<SpecialBattleSetting?> GetSbsByIdAsync(int sbsId);
|
||||
|
||||
/// <summary>
|
||||
/// Resolve a wire story_id to a sub-chapter row when no top-level <see cref="StoryChapter"/>
|
||||
/// exists for it. Sub-chapter story_ids have no chapter master data of their own — they're
|
||||
/// progress markers hanging off the parent. Used by /finish to record progress at the sub's
|
||||
/// story_id when the client sends sub-chapter ids directly.
|
||||
/// </summary>
|
||||
Task<StorySubChapter?> FindSubChapterByStoryIdAsync(int storyId);
|
||||
}
|
||||
|
||||
@@ -51,4 +51,15 @@ public class StoryMasterRepository : IStoryMasterRepository
|
||||
|
||||
public Task<SpecialBattleSetting?> GetSbsByIdAsync(int sbsId)
|
||||
=> _db.SpecialBattleSettings.FirstOrDefaultAsync(s => s.Id == sbsId);
|
||||
|
||||
public async Task<StorySubChapter?> FindSubChapterByStoryIdAsync(int storyId)
|
||||
{
|
||||
// StorySubChapter is an owned entity (no DbSet of its own); query through the owning
|
||||
// chapter. SelectMany over the owned collection translates to a JOIN in the relational
|
||||
// provider — no need to materialize the full chapter row.
|
||||
return await _db.StoryChapters
|
||||
.AsNoTracking()
|
||||
.SelectMany(c => c.SubChapters)
|
||||
.FirstOrDefaultAsync(sc => sc.SubChapterStoryId == storyId);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user