mirror of
https://github.com/DorkSquadRR/DorkNet.git
synced 2026-10-25 23:18:44 -07:00
Add Rec Center doors management: implement endpoints for retrieving and updating door configurations; enhance database schema and UI integration
This commit is contained in:
@@ -1,9 +1,10 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using DorkNet.Server.Services;
|
||||
|
||||
namespace DorkNet.Server.Controllers.API.GameConfigurations;
|
||||
|
||||
[ApiController]
|
||||
public class GameConfigurationsController : ControllerBase
|
||||
public class GameConfigurationsController(ServerSettingsService serverSettings) : ControllerBase
|
||||
{
|
||||
// Actual path used by the 2020 build
|
||||
[HttpGet("api/gameconfigs/v1/all")]
|
||||
@@ -11,5 +12,6 @@ public class GameConfigurationsController : ControllerBase
|
||||
// Legacy path we originally assumed
|
||||
[HttpGet("api/gameconfigurations/v1/all")]
|
||||
[HttpGet("api/gameconfigurations/v1")]
|
||||
public ActionResult<List<object>> GetAll() => Ok(new List<object>());
|
||||
public async Task<ActionResult<IReadOnlyList<GameConfigurationSetting>>> GetAll()
|
||||
=> Ok(await serverSettings.GetGameConfigurationsAsync());
|
||||
}
|
||||
|
||||
@@ -1514,6 +1514,23 @@ public class AdminController(
|
||||
return Ok(tags);
|
||||
}
|
||||
|
||||
[HttpGet("settings/rec-center-doors")]
|
||||
public async Task<ActionResult> GetRecCenterDoors()
|
||||
=> Ok(await serverSettings.GetRecCenterDoorsAsync());
|
||||
|
||||
public sealed record RecCenterDoorsRequest(
|
||||
List<RecCenterDoorConfig>? Doors);
|
||||
|
||||
[HttpPost("settings/rec-center-doors")]
|
||||
public async Task<ActionResult> SetRecCenterDoors([FromBody] RecCenterDoorsRequest body)
|
||||
{
|
||||
var doors = await serverSettings.SetRecCenterDoorsAsync(body.Doors ?? []);
|
||||
await LogAsync("rec_center_doors_updated", "system", 0,
|
||||
string.Join(";", doors.Doors.Select(d => $"{d.Key}:{d.Query}")));
|
||||
await db.SaveChangesAsync();
|
||||
return Ok(doors);
|
||||
}
|
||||
|
||||
// ── Signup codes ─────────────────────────────────────────────────────
|
||||
|
||||
/// <summary>GET <c>api/admin/v1/signup-codes</c> — every issued code
|
||||
|
||||
Reference in New Issue
Block a user