using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; using Remotely.Server.Auth; using Remotely.Server.Services; using System.Threading.Tasks; namespace Remotely.Server.API; /// /// Can only be accessed from the local machine. The sole purpose /// is to provide a healthcheck endpoint for Docker that exercises /// the database connection. /// [Route("api/[controller]")] [ApiController] [ServiceFilter(typeof(LocalOnlyFilter))] public class HealthCheckController : ControllerBase { private readonly IDataService _dataService; public HealthCheckController(IDataService dataService) { _dataService = dataService; } [HttpGet] public async Task Get() { var orgCount = await _dataService.GetOrganizationCountAsync(); return Ok($"Organization Count: {orgCount}"); } }