This commit is contained in:
2021-01-30 16:24:13 +00:00
parent 0e8b90a778
commit b5ddfb211d
7 changed files with 103 additions and 95 deletions

View File

@@ -203,17 +203,22 @@ namespace AyaNova.Api.Controllers
if (!ModelState.IsValid)
return BadRequest(new ApiErrorResponse(ModelState));
if (selectedRequest.IsEmpty)
return BadRequest(new ApiErrorResponse(ApiErrorCode.VALIDATION_REQUIRED, null, "DataListSelection is required"));
if (selectedRequest == null)
return BadRequest(new ApiErrorResponse(ApiErrorCode.VALIDATION_REQUIRED, null, "DataListSelectedRequest is required"));
if (!Authorized.HasDeleteRole(HttpContext.Items, selectedRequest.ObjectType))
return StatusCode(403, new ApiNotAuthorizedResponse());
await selectedRequest.RehydrateIdList(ct, UserRolesFromContext.Roles(HttpContext.Items), log, UserIdFromContext.Id(HttpContext.Items));
//Rehydrate id list if necessary
if (selectedRequest.SelectedRowIds.Length == 0)
return BadRequest(new ApiErrorResponse(ApiErrorCode.VALIDATION_REQUIRED, null, "List of ids"));
selectedRequest.SelectedRowIds = await DataListSelectedProcessingOptions.RehydrateIdList(
selectedRequest,
ct,
UserRolesFromContext.Roles(HttpContext.Items),
log,
UserIdFromContext.Id(HttpContext.Items),
UserTranslationIdFromContext.Id(HttpContext.Items));
var JobName = $"LT:BatchDeleteJob - LT:{selectedRequest.ObjectType} ({selectedRequest.SelectedRowIds.LongLength}) LT:User {UserNameFromContext.Name(HttpContext.Items)}";
JObject o = JObject.FromObject(new