This commit is contained in:
@@ -70,6 +70,26 @@ namespace AyaNova.Api.Controllers
|
||||
return Ok(ApiOkResponse.Response(ret));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get DB Emptiness
|
||||
/// </summary>
|
||||
/// <returns>Checks if there is any data in critical tables only</returns>
|
||||
[HttpGet("database-empty")]
|
||||
public async Task<IActionResult> GetDbEmpty()
|
||||
{
|
||||
if (serverState.IsClosed)
|
||||
{
|
||||
//Exception for SuperUser account to handle licensing issues
|
||||
if (UserIdFromContext.Id(HttpContext.Items) != 1)
|
||||
return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason));
|
||||
}
|
||||
if (!Authorized.HasReadFullRole(HttpContext.Items, AyaType.License))
|
||||
{
|
||||
return StatusCode(403, new ApiNotAuthorizedResponse());
|
||||
}
|
||||
return Ok(ApiOkResponse.Response(await AyaNova.Util.DbUtil.DBIsEmptyAsync(ct, log)));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -111,7 +131,7 @@ namespace AyaNova.Api.Controllers
|
||||
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserIdFromContext.Id(HttpContext.Items), 0, AyaType.License, AyaEvent.LicenseFetch), ct);
|
||||
}
|
||||
else
|
||||
{
|
||||
{
|
||||
log.LogError($"LicenseController::FetchLicense - failed: {ret}");
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user