Add player settings feature and settings API

This commit is contained in:
Holden
2026-06-20 22:58:33 -05:00
parent f4887c3f93
commit e77e479493
17 changed files with 405 additions and 3 deletions

View File

@@ -21,9 +21,9 @@ public class ProfilesController(IProfileService profileService) : ControllerBase
return profile;
}
[HttpGet("bulk")]
[HttpPost("bulk")]
public async Task<IReadOnlyList<ProfileDTO>> GetBulkProfiles(
[FromQuery(Name = "id")] List<Guid> ids,
[FromBody] List<Guid> ids,
CancellationToken ct)
=> await profileService.GetProfilesAsync(ids, ct);

View File

@@ -0,0 +1,40 @@
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<IReadOnlyList<PlayerSettingDTO>> GetAllAsync(CancellationToken ct)
{
var profileId = User.GetProfileId();
return await profileService.GetPlayerSettingsAsync(profileId, ct);
}
[HttpPost("set")]
public async Task<IActionResult> 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();
}
}