feat(missions): ViewerMissionStateService — lazy materialize achievements + assign slots

Reads existing state from DB on each call (don't trust navigation
property — caller may pass it stale or double-tracked). Adds via DbSet
only, not via navigation property, to avoid EF double-tracking.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
gamer147
2026-05-27 10:29:30 -04:00
parent aad604a589
commit c9534d8fac
4 changed files with 255 additions and 0 deletions

View File

@@ -0,0 +1,12 @@
using SVSim.Database.Models;
namespace SVSim.EmulatedEntrypoint.Services;
/// <summary>
/// Lazy-initializes viewer mission/achievement state. Idempotent. Called from
/// LoadController on every /load/index and as belt-and-braces from /mission/info.
/// </summary>
public interface IViewerMissionStateService
{
Task EnsureCurrentAsync(Viewer viewer, CancellationToken ct = default);
}