Files

22 lines
621 B
C#

using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using MoonlightServers.Daemon.Helpers;
using MoonlightServers.Daemon.Mappers;
using MoonlightServers.DaemonShared.Http.Daemon;
namespace MoonlightServers.Daemon.Http.Controllers;
[Authorize]
[ApiController]
[Route("api/system")]
public class SystemController : Controller
{
[HttpGet("statistics")]
public async Task<ActionResult<SystemStatisticsDto>> GetStatisticsAsync()
{
var snapshot = await SystemMetrics.ReadAllAsync();
var statistics = SystemStatisticsMapper.ToDto(snapshot);
return statistics;
}
}