This commit is contained in:
@@ -86,7 +86,7 @@ namespace Sockeye.Api.Controllers
|
||||
if (!Authorized.HasModifyRole(HttpContext.Items, biz.BizType))
|
||||
return StatusCode(403, new ApiNotAuthorizedResponse());
|
||||
|
||||
var o = await biz.PutAsync(updatedObject);
|
||||
var o = await biz.PutAsync(updatedObject);
|
||||
if (o == null)
|
||||
return StatusCode(409, new ApiErrorResponse(biz.Errors));
|
||||
return Ok(ApiOkResponse.Response(new { Concurrency = o.Concurrency }));
|
||||
@@ -121,7 +121,50 @@ namespace Sockeye.Api.Controllers
|
||||
return Ok(ApiOkResponse.Response(ret));
|
||||
}
|
||||
|
||||
|
||||
[HttpPost("permanently-erase-all-data")]
|
||||
public async Task<IActionResult> RemoveAllData([FromBody] string acceptCode)
|
||||
{
|
||||
if (serverState.IsClosed)
|
||||
return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason));
|
||||
|
||||
if (!ModelState.IsValid)
|
||||
return BadRequest(new ApiErrorResponse(ModelState));
|
||||
|
||||
long UserId = UserIdFromContext.Id(HttpContext.Items);
|
||||
|
||||
//SuperUser only and must have accept code
|
||||
if (string.IsNullOrWhiteSpace(acceptCode) || acceptCode.ToLowerInvariant() != "i bloody understand")
|
||||
return StatusCode(403, new ApiNotAuthorizedResponse());
|
||||
|
||||
|
||||
|
||||
//empty the db
|
||||
await Sockeye.Util.DbUtil.EmptyBizDataFromDatabaseForSeedingOrImportingAsync(log);
|
||||
|
||||
//Log
|
||||
await EventLogProcessor.LogEventToDatabaseAsync(new Event(1, 0, SockType.Global, SockEvent.EraseAllData), ct);
|
||||
|
||||
return NoContent();
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// import data from rockfish that isn't already present
|
||||
/// </summary>
|
||||
/// <returns>No content</returns>
|
||||
[HttpPost("import-rockfish")]
|
||||
public async Task<IActionResult> ImportRockfish([FromBody] Customer newObject, ApiVersion apiVersion)
|
||||
{
|
||||
if (!serverState.IsOpen)
|
||||
return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason));
|
||||
|
||||
GlobalBizSettingsBiz biz = GlobalBizSettingsBiz.GetBiz(ct, HttpContext);
|
||||
await biz.ImportRockfish();
|
||||
return NoContent();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}//eoc
|
||||
|
||||
Reference in New Issue
Block a user