2012-02-05 06:34:36 +00:00
|
|
|
|
using System;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Web.Mvc;
|
|
|
|
|
using NzbDrone.Common;
|
|
|
|
|
using NzbDrone.Core.Datastore.Migrations;
|
2012-02-17 22:04:22 +00:00
|
|
|
|
using Services.PetaPoco;
|
2012-02-05 06:34:36 +00:00
|
|
|
|
|
|
|
|
|
namespace NzbDrone.Services.Service.Controllers
|
|
|
|
|
{
|
|
|
|
|
public class HealthController : Controller
|
|
|
|
|
{
|
|
|
|
|
private readonly EnviromentProvider _enviromentProvider;
|
|
|
|
|
private readonly IDatabase _database;
|
|
|
|
|
|
|
|
|
|
public HealthController(EnviromentProvider enviromentProvider, IDatabase database)
|
|
|
|
|
{
|
|
|
|
|
_enviromentProvider = enviromentProvider;
|
|
|
|
|
_database = database;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[HttpGet]
|
|
|
|
|
public JsonResult Echo()
|
|
|
|
|
{
|
|
|
|
|
var stat = new
|
|
|
|
|
{
|
|
|
|
|
Service = _enviromentProvider.Version.ToString(),
|
|
|
|
|
Schema = _database.Fetch<SchemaInfo>().OrderByDescending(c => c.Version).First()
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
return Json(stat, JsonRequestBehavior.AllowGet);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[HttpGet]
|
|
|
|
|
public JsonResult Exception()
|
|
|
|
|
{
|
|
|
|
|
throw new NotImplementedException();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|