using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using RecNet.Application.Common.Security; using RecNet.Application.Profiles; namespace API.Controllers.Settings.V1; [Authorize] [ApiController] [Route("api/[controller]/v1")] public class SettingsController(IProfileService profileService) : ControllerBase { [HttpGet] public async Task> GetAllAsync(CancellationToken ct) { var profileId = User.GetProfileId(); return await profileService.GetPlayerSettingsAsync(profileId, ct); } [HttpPost("set")] public async Task SetAsync( [FromBody] PlayerSettingDTO request, CancellationToken ct) { var profileId = User.GetProfileId(); var updated = await profileService.UpdatePlayerSettingAsync ( profileId: profileId, command: new UpdatePlayerSettingCommand(request.Key, request.Value), ct: ct ); if (!updated) return NotFound(); return Ok(); } }