diff --git a/server/AyaNova/Controllers/NotifyController.cs b/server/AyaNova/Controllers/NotifyController.cs new file mode 100644 index 00000000..18321a51 --- /dev/null +++ b/server/AyaNova/Controllers/NotifyController.cs @@ -0,0 +1,57 @@ +using System.Threading.Tasks; +using Microsoft.AspNetCore.Http; +using Microsoft.AspNetCore.Mvc; +using Microsoft.AspNetCore.Routing; +using Microsoft.AspNetCore.Authorization; +using Microsoft.Extensions.Logging; +using AyaNova.Models; +using AyaNova.Api.ControllerHelpers; +using AyaNova.Biz; + + +namespace AyaNova.Api.Controllers +{ + [ApiController] + [ApiVersion("8.0")] + [Route("api/v{version:apiVersion}/notify")] + [Produces("application/json")] + [Authorize] + public class NotifyController : ControllerBase + { + private readonly AyContext ct; + private readonly ILogger log; + private readonly ApiServerState serverState; + + /// + /// ctor + /// + /// + /// + /// + public NotifyController(AyContext dbcontext, ILogger logger, ApiServerState apiServerState) + { + ct = dbcontext; + log = logger; + serverState = apiServerState; + } + + /// + /// Pre-login route to confirm server is available + /// + /// + [AllowAnonymous] + [HttpGet("hello")] + public ActionResult GetPreLoginPing() + { + //note: this route is called by the client as the first action so it also acts like a ping to see if the server is up as well + if (serverState.IsClosed) + return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason)); + return Ok(ApiOkResponse.Response(!AyaNova.Core.License.ActiveKey.TrialLicense, true)); + } + + + //------------ + + + }//eoc +}//eons \ No newline at end of file