42 lines
1.3 KiB
C#
42 lines
1.3 KiB
C#
using Microsoft.AspNetCore.Mvc;
|
|
using SVSim.Database.Models;
|
|
using SVSim.Database.Repositories.Viewer;
|
|
using SVSim.EmulatedEntrypoint.Constants;
|
|
using SVSim.EmulatedEntrypoint.Models.Dtos;
|
|
using SVSim.EmulatedEntrypoint.Models.Dtos.Requests;
|
|
using SVSim.EmulatedEntrypoint.Models.Dtos.Responses;
|
|
|
|
namespace SVSim.EmulatedEntrypoint.Controllers;
|
|
|
|
public class LoadController : SVSimController
|
|
{
|
|
private readonly IViewerRepository _viewerRepository;
|
|
|
|
public LoadController(IViewerRepository viewerRepository)
|
|
{
|
|
_viewerRepository = viewerRepository;
|
|
}
|
|
|
|
[HttpPost("index")]
|
|
public async Task<ActionResult<IndexResponse>> Index(IndexRequest request)
|
|
{
|
|
Viewer? viewer = await _viewerRepository.GetViewerByShortUdid(ulong.Parse(User.Claims
|
|
.FirstOrDefault(claim => claim.Type == ShadowverseClaimTypes.ShortUdidClaim).Value));
|
|
|
|
if (viewer == null)
|
|
{
|
|
return NotFound();
|
|
}
|
|
|
|
return new IndexResponse
|
|
{
|
|
UserTutorial = new UserTutorial()
|
|
{
|
|
TutorialStep = viewer.MissionData.TutorialState
|
|
},
|
|
UserInfo = new UserInfo(int.Parse(Request.Headers["DEVICE"].FirstOrDefault()), viewer),
|
|
UserCurrency = new UserCurrency(),
|
|
|
|
};
|
|
}
|
|
} |