feat(missions): /load/index materializes viewer mission/achievement state

EnsureCurrentAsync now takes viewerId (was Viewer), so it works with
LoadController's AsNoTracking-loaded detached viewers.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
gamer147
2026-05-27 10:45:31 -04:00
parent 640a77ec6c
commit 5693ec0302
6 changed files with 27 additions and 18 deletions

View File

@@ -1,12 +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.
/// Takes viewerId (not Viewer) so it works against both tracked and detached viewer loads.
/// Caller is responsible for SaveChangesAsync.
/// </summary>
public interface IViewerMissionStateService
{
Task EnsureCurrentAsync(Viewer viewer, CancellationToken ct = default);
Task EnsureCurrentAsync(long viewerId, CancellationToken ct = default);
}