More story fixes

This commit is contained in:
gamer147
2026-05-25 19:07:49 -04:00
parent ce8d80559b
commit fa0901b776
16 changed files with 6361 additions and 48 deletions

View File

@@ -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);
}
}