Files
Radicade/Server/Config/VoiceChatRestrictionAPI.cs
T
2026-10-16 23:33:13 -07:00

23 lines
650 B
C#

using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using RadicadeServer.DB;
using RadicadeServer.Extensions;
using RadicadeServer.Utils;
namespace RadicadeServer.API.Config
{
[Route("api/voicechat")]
public class VoiceChatRestrictionAPI(RecDBContext db) : Controller
{
[HttpGet("restriction"), Authorize]
public async Task<IActionResult> GetRestriction()
{
var userId = User.GetUserId();
if (userId == null)
return Unauthorized(new { restricted = false });
var restriction = await VoiceChatRestrictions.ActiveAsync(db, userId.Value);
return Ok(VoiceChatRestrictions.Payload(restriction));
}
}
}