server state cleanup
This commit is contained in:
@@ -52,8 +52,8 @@ namespace AyaNova.Api.Controllers
|
||||
[HttpPost]
|
||||
public async Task<IActionResult> List([FromBody] ListOptions listOptions)
|
||||
{
|
||||
if (serverState.IsClosed)
|
||||
return StatusCode(503, new ApiErrorResponse(ApiErrorCode.API_CLOSED, null, serverState.Reason));
|
||||
if (!serverState.IsOpen)
|
||||
return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason));
|
||||
|
||||
if (listOptions.Limit == null || listOptions.Limit < 1)
|
||||
{
|
||||
@@ -61,9 +61,9 @@ namespace AyaNova.Api.Controllers
|
||||
}
|
||||
if (listOptions.Offset == null)
|
||||
{
|
||||
listOptions.Offset = 0;
|
||||
listOptions.Offset = 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (!ModelState.IsValid)
|
||||
return BadRequest(new ApiErrorResponse(ModelState));
|
||||
@@ -95,9 +95,7 @@ namespace AyaNova.Api.Controllers
|
||||
public ActionResult GetDataListKeys()
|
||||
{
|
||||
if (!serverState.IsOpen)
|
||||
{
|
||||
return StatusCode(503, new ApiErrorResponse(ApiErrorCode.API_CLOSED, null, serverState.Reason));
|
||||
}
|
||||
return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason));
|
||||
|
||||
return Ok(ApiOkResponse.Response(DataListFactory.GetListOfAllDataListKeyNames(), true));
|
||||
}
|
||||
@@ -111,9 +109,7 @@ namespace AyaNova.Api.Controllers
|
||||
public ActionResult GetDataListFields([FromQuery] string DataListKey)
|
||||
{
|
||||
if (!serverState.IsOpen)
|
||||
{
|
||||
return StatusCode(503, new ApiErrorResponse(ApiErrorCode.API_CLOSED, null, serverState.Reason));
|
||||
}
|
||||
return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason));
|
||||
|
||||
var DataList = DataListFactory.GetAyaDataList(DataListKey);
|
||||
//was the name not found as a list?
|
||||
|
||||
Reference in New Issue
Block a user