This commit is contained in:
@@ -146,7 +146,44 @@ namespace AyaNova.Api.Controllers
|
|||||||
return Ok(ApiOkResponse.Response(await TagUtil.BulkRemoveAny(ayaType, tag, ct), true));
|
return Ok(ApiOkResponse.Response(await TagUtil.BulkRemoveAny(ayaType, tag, ct), true));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Bulk replace tags to list of object id's specified
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="ayaType">Required</param>
|
||||||
|
/// <param name="fromTag">Required</param>
|
||||||
|
/// <param name="toTag">Required</param>
|
||||||
|
/// <param name="idList">Required</param>
|
||||||
|
/// <returns>Number of items affected</returns>
|
||||||
|
[HttpPost("bulk-replace/{ayaType}/{tag}")]
|
||||||
|
public async Task<IActionResult> BulkReplace([FromRoute] AyaType ayaType, [FromRoute] string fromTag, [FromQuery] string toTag, [FromBody] List<long> idList)
|
||||||
|
{
|
||||||
|
if (!serverState.IsOpen)
|
||||||
|
return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason));
|
||||||
|
if (!ModelState.IsValid)
|
||||||
|
return BadRequest(new ApiErrorResponse(ModelState));
|
||||||
|
if (!Authorized.HasModifyRole(HttpContext.Items, ayaType))
|
||||||
|
return StatusCode(403, new ApiNotAuthorizedResponse());
|
||||||
|
return Ok(ApiOkResponse.Response(await TagUtil.BulkReplace(ayaType, fromTag, toTag, idList, ct), true));
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Bulk replace tags to all objects of type specified
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="ayaType">Required</param>
|
||||||
|
/// <param name="fromTag">Required</param>
|
||||||
|
/// <param name="toTag">Required</param>
|
||||||
|
/// <returns>Number of items affected</returns>
|
||||||
|
[HttpPost("bulk-replace-any/{ayaType}/{tag}")]
|
||||||
|
public async Task<IActionResult> BulkReplaceAny([FromRoute] AyaType ayaType, [FromRoute] string fromTag, [FromQuery] string toTag)
|
||||||
|
{
|
||||||
|
if (!serverState.IsOpen)
|
||||||
|
return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason));
|
||||||
|
if (!ModelState.IsValid)
|
||||||
|
return BadRequest(new ApiErrorResponse(ModelState));
|
||||||
|
if (!Authorized.HasModifyRole(HttpContext.Items, ayaType))
|
||||||
|
return StatusCode(403, new ApiNotAuthorizedResponse());
|
||||||
|
return Ok(ApiOkResponse.Response(await TagUtil.BulkReplaceAny(ayaType, fromTag, toTag, ct), true));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}//eoc
|
}//eoc
|
||||||
|
|||||||
@@ -243,6 +243,20 @@ namespace AyaNova.Biz
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static async Task<long> BulkReplace(AyaType ayaType, string fromTag, string toTag, List<long> idList, AyContext ct)
|
||||||
|
{
|
||||||
|
//todo iterate the object in question, open and update and save each one through it's biz object interface so rules etc are all maintained
|
||||||
|
//not sure if should update locked or read only objects, probably not I guess as it should only do whatever was done in interface
|
||||||
|
|
||||||
|
throw new System.NotImplementedException("NOT IMPLEMENTED YET");
|
||||||
|
}
|
||||||
|
|
||||||
|
public static async Task<long> BulkReplaceAny(AyaType ayaType, string fromTag, string toTag, AyContext ct)
|
||||||
|
{
|
||||||
|
throw new System.NotImplementedException("NOT IMPLEMENTED YET");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}//eoc
|
}//eoc
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user