Initialize repository

Added basic info to get in game for like...August 2016 ;-;
It's not much but it's a start
This commit is contained in:
splootybean
2026-02-27 00:58:13 -08:00
parent 05c35b2a18
commit 387ec7ba89
61 changed files with 1722 additions and 0 deletions
@@ -0,0 +1,37 @@
using Microsoft.AspNetCore.Mvc;
using RecRoomArchive.Models.API.Players;
using RecRoomArchive.Models.Common;
using RecRoomArchive.Services;
using System.Text.Json;
namespace RecRoomArchive.Controllers.API.Players.V2
{
/// <summary>
/// Used to modify accounts / profiles in 2017-2019 although gets phased out as time goes on...
/// </summary>
[Route(template: "api/[controller]/v2")]
[ApiController]
public class PlayersController(FileService fileService) : ControllerBase
{
/// <summary>
/// Sets the players displayName
/// </summary>
/// <param name="name">The displayName the player is requesting</param>
/// <returns>OkResponse</returns>
[HttpPost(template: "displayName")]
public async Task<ActionResult<OkResponse>> SetDisplayName([FromForm(Name = "Name")] string name)
{
var profileData = fileService.GetData("profile.json");
if (profileData == null)
return BadRequest("Profile is not populated");
var profile = JsonSerializer.Deserialize<BaseProfile>(profileData)!;
profile.DisplayName = name;
fileService.SetData("profile.json", JsonSerializer.Serialize(profile));
return Ok(OkResponse.Ok());
}
}
}