This commit is contained in:
2
.vscode/launch.json
vendored
2
.vscode/launch.json
vendored
@@ -52,7 +52,7 @@
|
||||
"AYANOVA_FOLDER_USER_FILES": "c:\\temp\\RavenTestData\\userfiles",
|
||||
"AYANOVA_FOLDER_BACKUP_FILES": "c:\\temp\\RavenTestData\\backupfiles",
|
||||
"AYANOVA_FOLDER_TEMPORARY_SERVER_FILES": "c:\\temp\\RavenTestData\\tempfiles",
|
||||
"AYANOVA_SERVER_TEST_MODE": "true",
|
||||
"AYANOVA_SERVER_TEST_MODE": "false",
|
||||
"AYANOVA_SERVER_TEST_MODE_SEEDLEVEL": "small",
|
||||
"AYANOVA_SERVER_TEST_MODE_TZ_OFFSET": "-7",
|
||||
"AYANOVA_BACKUP_PG_DUMP_PATH": "C:\\data\\code\\PostgreSQLPortable_12.0\\App\\PgSQL\\bin\\"
|
||||
|
||||
@@ -103,7 +103,7 @@ namespace AyaNova.Api.Controllers
|
||||
tag = TagBiz.NormalizeTag(tag);
|
||||
if (string.IsNullOrWhiteSpace(tag))
|
||||
return BadRequest(new ApiErrorResponse(ApiErrorCode.VALIDATION_REQUIRED, null, "tag required"));
|
||||
|
||||
|
||||
await dataListSelection.RehydrateIdList(ct, UserRolesFromContext.Roles(HttpContext.Items), log);
|
||||
if (dataListSelection.SelectedRowIds.Length == 0)
|
||||
return BadRequest(new ApiErrorResponse(ApiErrorCode.VALIDATION_REQUIRED, null, "List of ids"));
|
||||
@@ -169,38 +169,45 @@ namespace AyaNova.Api.Controllers
|
||||
|
||||
/// <summary>
|
||||
/// Bulk remove tags to list of object id's specified
|
||||
/// </summary>
|
||||
/// <param name="ayaType"></param>
|
||||
/// </summary>
|
||||
/// <param name="tag"></param>
|
||||
/// <param name="idList"></param>
|
||||
/// <param name="dataListSelection"></param>
|
||||
/// <returns>Job Id</returns>
|
||||
[HttpPost("bulk-remove/{ayaType}/{tag}")]
|
||||
public async Task<IActionResult> BulkRemove([FromRoute] AyaType ayaType, [FromRoute] string tag, [FromBody] List<long> idList)
|
||||
[HttpPost("bulk-remove/{tag}")]
|
||||
public async Task<IActionResult> BulkRemove([FromRoute] string tag, [FromBody] DataListSelection dataListSelection)
|
||||
{
|
||||
if (!serverState.IsOpen)
|
||||
return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason));
|
||||
if (!ModelState.IsValid)
|
||||
return BadRequest(new ApiErrorResponse(ModelState));
|
||||
if (!ayaType.HasAttribute(typeof(CoreBizObjectAttribute)))
|
||||
|
||||
if (dataListSelection.IsEmpty)
|
||||
return BadRequest(new ApiErrorResponse(ApiErrorCode.VALIDATION_REQUIRED, null, "DataListSelection is required"));
|
||||
|
||||
if (!dataListSelection.ObjectType.HasAttribute(typeof(CoreBizObjectAttribute)))
|
||||
return BadRequest(new ApiErrorResponse(ApiErrorCode.INVALID_OPERATION, null, "Not a taggable object type"));
|
||||
if (!Authorized.HasModifyRole(HttpContext.Items, ayaType))
|
||||
if (!Authorized.HasModifyRole(HttpContext.Items, dataListSelection.ObjectType))
|
||||
return StatusCode(403, new ApiNotAuthorizedResponse());
|
||||
if (idList.Count == 0)
|
||||
return BadRequest(new ApiErrorResponse(ApiErrorCode.VALIDATION_REQUIRED, null, "List of ids"));
|
||||
|
||||
tag = TagBiz.NormalizeTag(tag);
|
||||
if (string.IsNullOrWhiteSpace(tag))
|
||||
return BadRequest(new ApiErrorResponse(ApiErrorCode.VALIDATION_REQUIRED, null, "tag"));
|
||||
|
||||
var JobName = $"Bulk operation: Remove tag \"{tag}\" from {ayaType} ({idList.Count} specified)";
|
||||
await dataListSelection.RehydrateIdList(ct, UserRolesFromContext.Roles(HttpContext.Items), log);
|
||||
if (dataListSelection.SelectedRowIds.Length == 0)
|
||||
return BadRequest(new ApiErrorResponse(ApiErrorCode.VALIDATION_REQUIRED, null, "List of ids"));
|
||||
|
||||
|
||||
var JobName = $"Bulk operation: Remove tag \"{tag}\" from {dataListSelection.ObjectType} ({dataListSelection.SelectedRowIds.LongLength} specified)";
|
||||
JObject o = JObject.FromObject(new
|
||||
{
|
||||
idList = idList,
|
||||
idList = dataListSelection.SelectedRowIds,
|
||||
tag = tag
|
||||
});
|
||||
|
||||
OpsJob j = new OpsJob();
|
||||
j.Name = JobName;
|
||||
j.ObjectType = ayaType;
|
||||
j.ObjectType = dataListSelection.ObjectType;
|
||||
j.JobType = JobType.BulkCoreBizObjectOperation;
|
||||
j.SubType = JobSubType.TagRemove;
|
||||
j.Exclusive = false;
|
||||
@@ -254,41 +261,44 @@ namespace AyaNova.Api.Controllers
|
||||
|
||||
/// <summary>
|
||||
/// Bulk replace tags to list of object id's specified
|
||||
/// </summary>
|
||||
/// <param name="ayaType"></param>
|
||||
/// </summary>
|
||||
/// <param name="fromTag"></param>
|
||||
/// <param name="toTag"></param>
|
||||
/// <param name="idList"></param>
|
||||
/// <param name="dataListSelection"></param>
|
||||
/// <returns>Job Id</returns>
|
||||
[HttpPost("bulk-replace/{ayaType}/{fromTag}")]
|
||||
public async Task<IActionResult> BulkReplace([FromRoute] AyaType ayaType, [FromRoute] string fromTag, [FromQuery] string toTag, [FromBody] List<long> idList)
|
||||
[HttpPost("bulk-replace/{fromTag}")]
|
||||
public async Task<IActionResult> BulkReplace([FromRoute] string fromTag, [FromQuery] string toTag, [FromBody] DataListSelection dataListSelection)
|
||||
{
|
||||
if (!serverState.IsOpen)
|
||||
return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason));
|
||||
if (!ModelState.IsValid)
|
||||
return BadRequest(new ApiErrorResponse(ModelState));
|
||||
if (!ayaType.HasAttribute(typeof(CoreBizObjectAttribute)))
|
||||
if (dataListSelection.IsEmpty)
|
||||
return BadRequest(new ApiErrorResponse(ApiErrorCode.VALIDATION_REQUIRED, null, "DataListSelection is required"));
|
||||
if (!dataListSelection.ObjectType.HasAttribute(typeof(CoreBizObjectAttribute)))
|
||||
return BadRequest(new ApiErrorResponse(ApiErrorCode.INVALID_OPERATION, null, "Not a taggable object type"));
|
||||
if (!Authorized.HasModifyRole(HttpContext.Items, ayaType))
|
||||
if (!Authorized.HasModifyRole(HttpContext.Items, dataListSelection.ObjectType))
|
||||
return StatusCode(403, new ApiNotAuthorizedResponse());
|
||||
if (idList.Count == 0)
|
||||
return BadRequest(new ApiErrorResponse(ApiErrorCode.VALIDATION_REQUIRED, null, "List of ids"));
|
||||
fromTag = TagBiz.NormalizeTag(fromTag);
|
||||
if (string.IsNullOrWhiteSpace(fromTag))
|
||||
return BadRequest(new ApiErrorResponse(ApiErrorCode.VALIDATION_REQUIRED, null, "fromTag"));
|
||||
toTag = TagBiz.NormalizeTag(toTag);
|
||||
if (string.IsNullOrWhiteSpace(toTag))
|
||||
return BadRequest(new ApiErrorResponse(ApiErrorCode.VALIDATION_REQUIRED, null, "toTag"));
|
||||
var JobName = $"Bulk operation: Replace tag \"{fromTag}\" with tag \"{toTag}\" on {ayaType} ({idList.Count} specified)";
|
||||
await dataListSelection.RehydrateIdList(ct, UserRolesFromContext.Roles(HttpContext.Items), log);
|
||||
if (dataListSelection.SelectedRowIds.Length == 0)
|
||||
return BadRequest(new ApiErrorResponse(ApiErrorCode.VALIDATION_REQUIRED, null, "List of ids"));
|
||||
|
||||
var JobName = $"Bulk operation: Replace tag \"{fromTag}\" with tag \"{toTag}\" on {dataListSelection.ObjectType} ({dataListSelection.SelectedRowIds.LongLength} specified)";
|
||||
JObject o = JObject.FromObject(new
|
||||
{
|
||||
idList = idList,
|
||||
idList = dataListSelection.SelectedRowIds,
|
||||
tag = fromTag,
|
||||
toTag = toTag
|
||||
});
|
||||
|
||||
OpsJob j = new OpsJob();
|
||||
j.ObjectType = ayaType;
|
||||
j.ObjectType = dataListSelection.ObjectType;
|
||||
j.Name = JobName;
|
||||
j.JobType = JobType.BulkCoreBizObjectOperation;
|
||||
j.SubType = JobSubType.TagReplace;
|
||||
|
||||
Reference in New Issue
Block a user