feat: Implement base room management; add API endpoints for retrieving and setting curated base rooms

This commit is contained in:
Alexa
2026-07-13 00:40:35 +03:00
parent 2795d2ed7d
commit 2c749c2677
7 changed files with 291 additions and 4 deletions
@@ -1810,6 +1810,32 @@ public class AdminController(
return Ok(doors);
}
/// <summary>GET <c>api/admin/v1/settings/base-rooms</c> — the curated
/// room-creation base-room list (ordered room names) plus the catalogue of
/// Rec Room Original rooms the SPA can offer as pickable candidates.</summary>
[HttpGet("settings/base-rooms")]
public async Task<ActionResult> GetBaseRooms()
{
var names = await serverSettings.GetBaseRoomNamesAsync();
var available = await db.Rooms
.Where(r => EF.Functions.Like(r.TagsCsv, "%recroomoriginal%"))
.OrderBy(r => r.Name)
.Select(r => new { r.Name, r.ImageName, r.TagsCsv })
.ToListAsync();
return Ok(new { Names = names, Available = available });
}
public sealed record BaseRoomsRequest(List<string>? Names);
[HttpPost("settings/base-rooms")]
public async Task<ActionResult> SetBaseRooms([FromBody] BaseRoomsRequest body)
{
var names = await serverSettings.SetBaseRoomNamesAsync(body.Names ?? []);
await LogAsync("base_rooms_updated", "system", 0, string.Join(",", names));
await db.SaveChangesAsync();
return Ok(new { Names = names });
}
[HttpGet("settings/gameconfigs")]
public async Task<ActionResult> GetDiscoveredGameConfigs()
=> Ok(await serverSettings.GetDiscoveredGameConfigsAsync());