feat(tutorial): add /tutorial/update — echo step + persist to viewer
POST /tutorial/update echoes tutorial_step back and saves it to Viewer.MissionData.TutorialState. is_skip=1 is handled server-side by honoring whatever tutorial_step value the client sends (client already sends 100 when skipping). Adds TutorialUpdateRequest DTO, TutorialUpdateResponse DTO, injects SVSimDbContext into TutorialController, and adds GetViewerTutorialStateAsync helper to SVSimTestFactory. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -372,6 +372,18 @@ internal sealed class SVSimTestFactory : WebApplicationFactory<Program>
|
||||
await db.SaveChangesAsync();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Reads the viewer's current <c>TutorialState</c> from the DB.
|
||||
/// Tests use this to verify that <c>/tutorial/update</c> persisted the step.
|
||||
/// </summary>
|
||||
public async Task<int> GetViewerTutorialStateAsync(long viewerId)
|
||||
{
|
||||
using var scope = Services.CreateScope();
|
||||
var db = scope.ServiceProvider.GetRequiredService<SVSimDbContext>();
|
||||
var viewer = await db.Viewers.Include(v => v.MissionData).FirstAsync(v => v.Id == viewerId);
|
||||
return viewer.MissionData.TutorialState;
|
||||
}
|
||||
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
base.Dispose(disposing);
|
||||
|
||||
Reference in New Issue
Block a user