Files
RRAC/RecRoomArchive/Controllers/API/PlatformLogin/V1/PlatformLoginController.cs
T
2026-02-27 19:30:49 -08:00

29 lines
983 B
C#

using Microsoft.AspNetCore.Mvc;
using RecRoomArchive.Models.API.Platform;
using RecRoomArchive.Models.API.Players;
using RecRoomArchive.Services;
namespace RecRoomArchive.Controllers.API.PlatformLogin.V1
{
[Route("api/[controller]/v1")]
[ApiController]
public class PlatformLoginController(AccountService accountService) : ControllerBase
{
[HttpPost(template: "profiles")]
public async Task<ActionResult<List<BaseProfile>>> GetProfiles([FromForm(Name = "Platform")] PlatformType platform, [FromForm(Name = "PlatformId")] ulong platformId)
{
if (!accountService.AccountExists())
{
accountService.CreateAccount();
}
var profile = accountService.GetSelfAccount();
if (profile == null)
return BadRequest("Please relaunch RRAC and re-run setup");
List<BaseProfile> profiles = [profile];
return Ok(profiles);
}
}
}