2020-04-21 10:39:04 +02:00
|
|
|
using BTCPayServer.Client.Models;
|
2020-06-28 10:55:27 +02:00
|
|
|
using BTCPayServer.HostedServices;
|
2020-04-16 15:39:08 +02:00
|
|
|
using Microsoft.AspNetCore.Authorization;
|
2020-06-30 08:26:19 +02:00
|
|
|
using Microsoft.AspNetCore.Cors;
|
2020-04-16 15:39:08 +02:00
|
|
|
using Microsoft.AspNetCore.Mvc;
|
|
|
|
|
2022-01-14 05:05:23 +01:00
|
|
|
namespace BTCPayServer.Controllers.Greenfield
|
2020-04-16 15:39:08 +02:00
|
|
|
{
|
2020-04-21 17:09:17 +02:00
|
|
|
[Controller]
|
2020-06-30 08:26:19 +02:00
|
|
|
[EnableCors(CorsPolicies.All)]
|
2022-01-07 04:17:59 +01:00
|
|
|
public class GreenfieldHealthController : ControllerBase
|
2020-04-16 15:39:08 +02:00
|
|
|
{
|
2021-07-27 14:11:47 +02:00
|
|
|
private readonly NBXplorerDashboard _dashBoard;
|
|
|
|
|
2022-01-07 04:17:59 +01:00
|
|
|
public GreenfieldHealthController(NBXplorerDashboard dashBoard)
|
2021-07-27 14:11:47 +02:00
|
|
|
{
|
|
|
|
_dashBoard = dashBoard;
|
|
|
|
}
|
2020-04-16 15:39:08 +02:00
|
|
|
[AllowAnonymous]
|
|
|
|
[HttpGet("~/api/v1/health")]
|
2021-07-27 14:11:47 +02:00
|
|
|
public ActionResult GetHealth()
|
2020-04-16 15:39:08 +02:00
|
|
|
{
|
2020-04-21 16:43:14 +02:00
|
|
|
ApiHealthData model = new ApiHealthData()
|
|
|
|
{
|
2021-07-27 14:11:47 +02:00
|
|
|
Synchronized = _dashBoard.IsFullySynched()
|
2020-04-21 16:43:14 +02:00
|
|
|
};
|
2020-04-21 10:39:04 +02:00
|
|
|
return Ok(model);
|
2020-04-16 15:39:08 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|