Batch is the new Bulk
This commit is contained in:
@@ -428,9 +428,9 @@ namespace AyaNova.Api.Controllers
|
||||
///
|
||||
/// </summary>
|
||||
/// <returns>No content</returns>
|
||||
[HttpPost("bulk-delete")]
|
||||
[HttpPost("batch-delete")]
|
||||
[Authorize]
|
||||
public async Task<IActionResult> PostBulkDelete([FromBody] List<long> idList)
|
||||
public async Task<IActionResult> PostBatchDelete([FromBody] List<long> idList)
|
||||
{
|
||||
if (serverState.IsClosed)
|
||||
return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason));
|
||||
@@ -463,9 +463,9 @@ namespace AyaNova.Api.Controllers
|
||||
///
|
||||
/// </summary>
|
||||
/// <returns>No content</returns>
|
||||
[HttpPost("bulk-move")]
|
||||
[HttpPost("batch-move")]
|
||||
[Authorize]
|
||||
public async Task<IActionResult> PostBulkMove([FromBody] dtoBulkMove dt)
|
||||
public async Task<IActionResult> PostBatchMove([FromBody] dtoBatchMove dt)
|
||||
{
|
||||
if (serverState.IsClosed)
|
||||
return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason));
|
||||
@@ -497,7 +497,7 @@ namespace AyaNova.Api.Controllers
|
||||
return NoContent();
|
||||
}
|
||||
|
||||
public class dtoBulkMove
|
||||
public class dtoBatchMove
|
||||
{
|
||||
public List<long> IdList { get; set; }
|
||||
public AyaType ToType { get; set; }
|
||||
|
||||
@@ -61,10 +61,6 @@ namespace AyaNova.Api.Controllers
|
||||
if (dataListSelection.IsEmpty)
|
||||
return BadRequest(new ApiErrorResponse(ApiErrorCode.VALIDATION_REQUIRED, null, "DataListSelection is required"));
|
||||
|
||||
//Not sure exactly what this is, maybe copied from a bulk tag op fragment?
|
||||
// if (!dataListSelection.ObjectType.HasAttribute(typeof(CoreBizObjectAttribute)))
|
||||
// return BadRequest(new ApiErrorResponse(ApiErrorCode.INVALID_OPERATION, null, "Not a taggable object type"));
|
||||
|
||||
if (!Authorized.HasReadFullRole(HttpContext.Items, dataListSelection.ObjectType))
|
||||
return StatusCode(403, new ApiNotAuthorizedResponse());
|
||||
|
||||
|
||||
@@ -113,7 +113,7 @@ namespace AyaNova.Api.Controllers
|
||||
return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason));
|
||||
|
||||
|
||||
//## NOTE: deliberately do *not* check for authorization as this is called by any bulk operation users may submit via extensions
|
||||
//## NOTE: deliberately do *not* check for authorization as this is called by any batch operation users may submit via extensions
|
||||
//and the user would need the exact Guid to view a job so not likely they will fish for it in a nefarious way
|
||||
// if (!Authorized.HasReadFullRole(HttpContext.Items, AyaType.ServerJob))
|
||||
// {
|
||||
@@ -185,7 +185,7 @@ namespace AyaNova.Api.Controllers
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// EXTENSION BULK JOBS
|
||||
// EXTENSION BATCH JOBS
|
||||
//
|
||||
//
|
||||
|
||||
@@ -195,8 +195,8 @@ namespace AyaNova.Api.Controllers
|
||||
/// </summary>
|
||||
/// <param name="dataListSelection"></param>
|
||||
/// <returns>Job Id</returns>
|
||||
[HttpPost("bulk-delete")]
|
||||
public async Task<IActionResult> BulkDeleteObjects([FromBody] DataListSelection dataListSelection)
|
||||
[HttpPost("batch-delete")]
|
||||
public async Task<IActionResult> BatchDeleteObjects([FromBody] DataListSelection dataListSelection)
|
||||
{
|
||||
if (!serverState.IsOpen)
|
||||
return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason));
|
||||
@@ -224,7 +224,7 @@ namespace AyaNova.Api.Controllers
|
||||
OpsJob j = new OpsJob();
|
||||
j.Name = JobName;
|
||||
j.ObjectType = dataListSelection.ObjectType;
|
||||
j.JobType = JobType.BulkCoreBizObjectOperation;
|
||||
j.JobType = JobType.BatchCoreObjectOperation;
|
||||
j.SubType = JobSubType.Delete;
|
||||
j.Exclusive = false;
|
||||
j.JobInfo = o.ToString();
|
||||
|
||||
@@ -72,7 +72,7 @@ namespace AyaNova.Api.Controllers
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////
|
||||
//BULK OPS
|
||||
//BATCH OPS
|
||||
//
|
||||
//
|
||||
|
||||
@@ -82,8 +82,8 @@ namespace AyaNova.Api.Controllers
|
||||
/// <param name="tag"></param>
|
||||
/// <param name="dataListSelection"></param>
|
||||
/// <returns>Job Id</returns>
|
||||
[HttpPost("bulk-add/{tag}")]
|
||||
public async Task<IActionResult> BulkAdd([FromRoute] string tag, [FromBody] DataListSelection dataListSelection)
|
||||
[HttpPost("batch-add/{tag}")]
|
||||
public async Task<IActionResult> BatchAdd([FromRoute] string tag, [FromBody] DataListSelection dataListSelection)
|
||||
{
|
||||
if (!serverState.IsOpen)
|
||||
return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason));
|
||||
@@ -117,7 +117,7 @@ namespace AyaNova.Api.Controllers
|
||||
OpsJob j = new OpsJob();
|
||||
j.Name = JobName;
|
||||
j.ObjectType = dataListSelection.ObjectType;
|
||||
j.JobType = JobType.BulkCoreBizObjectOperation;
|
||||
j.JobType = JobType.BatchCoreObjectOperation;
|
||||
j.SubType = JobSubType.TagAdd;
|
||||
j.Exclusive = false;
|
||||
j.JobInfo = o.ToString();
|
||||
@@ -132,8 +132,8 @@ namespace AyaNova.Api.Controllers
|
||||
/// <param name="ayaType"></param>
|
||||
/// <param name="tag"></param>
|
||||
/// <returns>Job Id</returns>
|
||||
[HttpPost("bulk-add-any/{ayaType}/{tag}")]
|
||||
public async Task<IActionResult> BulkAddAny([FromRoute] AyaType ayaType, [FromRoute] string tag)
|
||||
[HttpPost("batch-add-any/{ayaType}/{tag}")]
|
||||
public async Task<IActionResult> BatchAddAny([FromRoute] AyaType ayaType, [FromRoute] string tag)
|
||||
{
|
||||
if (!serverState.IsOpen)
|
||||
return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason));
|
||||
@@ -157,7 +157,7 @@ namespace AyaNova.Api.Controllers
|
||||
OpsJob j = new OpsJob();
|
||||
j.Name = JobName;
|
||||
j.ObjectType = ayaType;
|
||||
j.JobType = JobType.BulkCoreBizObjectOperation;
|
||||
j.JobType = JobType.BatchCoreObjectOperation;
|
||||
j.SubType = JobSubType.TagAddAny;
|
||||
j.Exclusive = false;
|
||||
j.JobInfo = o.ToString();
|
||||
@@ -172,8 +172,8 @@ namespace AyaNova.Api.Controllers
|
||||
/// <param name="tag"></param>
|
||||
/// <param name="dataListSelection"></param>
|
||||
/// <returns>Job Id</returns>
|
||||
[HttpPost("bulk-remove/{tag}")]
|
||||
public async Task<IActionResult> BulkRemove([FromRoute] string tag, [FromBody] DataListSelection dataListSelection)
|
||||
[HttpPost("batch-remove/{tag}")]
|
||||
public async Task<IActionResult> BatchRemove([FromRoute] string tag, [FromBody] DataListSelection dataListSelection)
|
||||
{
|
||||
if (!serverState.IsOpen)
|
||||
return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason));
|
||||
@@ -207,7 +207,7 @@ namespace AyaNova.Api.Controllers
|
||||
OpsJob j = new OpsJob();
|
||||
j.Name = JobName;
|
||||
j.ObjectType = dataListSelection.ObjectType;
|
||||
j.JobType = JobType.BulkCoreBizObjectOperation;
|
||||
j.JobType = JobType.BatchCoreObjectOperation;
|
||||
j.SubType = JobSubType.TagRemove;
|
||||
j.Exclusive = false;
|
||||
j.JobInfo = o.ToString();
|
||||
@@ -223,8 +223,8 @@ namespace AyaNova.Api.Controllers
|
||||
/// <param name="ayaType"></param>
|
||||
/// <param name="tag"></param>
|
||||
/// <returns>Job Id</returns>
|
||||
[HttpPost("bulk-remove-any/{ayaType}/{tag}")]
|
||||
public async Task<IActionResult> BulkRemoveAny([FromRoute] AyaType ayaType, [FromRoute] string tag)
|
||||
[HttpPost("batch-remove-any/{ayaType}/{tag}")]
|
||||
public async Task<IActionResult> BatchRemoveAny([FromRoute] AyaType ayaType, [FromRoute] string tag)
|
||||
{
|
||||
if (!serverState.IsOpen)
|
||||
return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason));
|
||||
@@ -249,7 +249,7 @@ namespace AyaNova.Api.Controllers
|
||||
j.Name = JobName;
|
||||
j.ObjectType = ayaType;
|
||||
j.SubType = JobSubType.TagRemoveAny;
|
||||
j.JobType = JobType.BulkCoreBizObjectOperation;
|
||||
j.JobType = JobType.BatchCoreObjectOperation;
|
||||
j.Exclusive = false;
|
||||
j.JobInfo = o.ToString();
|
||||
await JobsBiz.AddJobAsync(j);
|
||||
@@ -265,8 +265,8 @@ namespace AyaNova.Api.Controllers
|
||||
/// <param name="toTag"></param>
|
||||
/// <param name="dataListSelection"></param>
|
||||
/// <returns>Job Id</returns>
|
||||
[HttpPost("bulk-replace/{fromTag}")]
|
||||
public async Task<IActionResult> BulkReplace([FromRoute] string fromTag, [FromQuery] string toTag, [FromBody] DataListSelection dataListSelection)
|
||||
[HttpPost("batch-replace/{fromTag}")]
|
||||
public async Task<IActionResult> BatchReplace([FromRoute] string fromTag, [FromQuery] string toTag, [FromBody] DataListSelection dataListSelection)
|
||||
{
|
||||
if (!serverState.IsOpen)
|
||||
return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason));
|
||||
@@ -299,7 +299,7 @@ namespace AyaNova.Api.Controllers
|
||||
OpsJob j = new OpsJob();
|
||||
j.ObjectType = dataListSelection.ObjectType;
|
||||
j.Name = JobName;
|
||||
j.JobType = JobType.BulkCoreBizObjectOperation;
|
||||
j.JobType = JobType.BatchCoreObjectOperation;
|
||||
j.SubType = JobSubType.TagReplace;
|
||||
j.Exclusive = false;
|
||||
j.JobInfo = o.ToString();
|
||||
@@ -315,8 +315,8 @@ namespace AyaNova.Api.Controllers
|
||||
/// <param name="fromTag"></param>
|
||||
/// <param name="toTag"></param>
|
||||
/// <returns>Job Id</returns>
|
||||
[HttpPost("bulk-replace-any/{ayaType}/{fromTag}")]
|
||||
public async Task<IActionResult> BulkReplaceAny([FromRoute] AyaType ayaType, [FromRoute] string fromTag, [FromQuery] string toTag)
|
||||
[HttpPost("batch-replace-any/{ayaType}/{fromTag}")]
|
||||
public async Task<IActionResult> BatchReplaceAny([FromRoute] AyaType ayaType, [FromRoute] string fromTag, [FromQuery] string toTag)
|
||||
{
|
||||
if (!serverState.IsOpen)
|
||||
return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason));
|
||||
@@ -345,7 +345,7 @@ namespace AyaNova.Api.Controllers
|
||||
OpsJob j = new OpsJob();
|
||||
j.Name = JobName;
|
||||
j.ObjectType = ayaType;
|
||||
j.JobType = JobType.BulkCoreBizObjectOperation;
|
||||
j.JobType = JobType.BatchCoreObjectOperation;
|
||||
j.SubType = JobSubType.TagReplaceAny;
|
||||
j.Exclusive = false;
|
||||
j.JobInfo = o.ToString();
|
||||
|
||||
Reference in New Issue
Block a user