This commit is contained in:
2020-01-23 22:56:01 +00:00
parent 866428776f
commit 784ea46fd1
24 changed files with 365 additions and 902 deletions

View File

@@ -51,9 +51,6 @@ namespace AyaNova.Api.Controllers
/// <summary>
/// Get full widget object
///
/// Required roles:
/// BizAdminFull, InventoryFull, BizAdminLimited, InventoryLimited
/// </summary>
/// <param name="id"></param>
/// <returns>A single widget</returns>
@@ -84,120 +81,9 @@ namespace AyaNova.Api.Controllers
}
// /// <summary>
// /// Get list for selection / viewing
// ///
// /// Required roles: Any in-house staff (some roles might have restrictions on exact fields that are returned)
// ///
// /// </summary>
// /// <param name="pagingOptions">Paging, filtering and sorting options</param>
// /// <returns>Collection with paging data</returns>
// [HttpGet("List", Name = nameof(List))]
// public ActionResult List([FromQuery] ListOptions pagingOptions)
// {
// if (serverState.IsClosed)
// return StatusCode(503, new ApiErrorResponse(ApiErrorCode.API_CLOSED, null, serverState.Reason));
// if (!ModelState.IsValid)
// return BadRequest(new ApiErrorResponse(ModelState));
// //Instantiate the business object handler
// WidgetBiz biz = WidgetBiz.GetBiz(ct, HttpContext);
// ApiPagedResponse pr = biz.GetList(Url, nameof(List), pagingOptions).Result;
// return Ok(new ApiOkWithPagingResponse(pr));
// }
// /// <summary>
// /// TEST list with relationships
// ///
// /// Required roles: Any in-house staff (some roles might have restrictions on exact fields that are returned)
// ///
// /// </summary>
// /// <param name="pagingOptions">Paging, filtering and sorting options</param>
// /// <returns>Collection with paging data</returns>
// [HttpGet("TestGetWidgetUserEmailList", Name = nameof(TestGetWidgetUserEmailList))]
// public ActionResult TestGetWidgetUserEmailList([FromQuery] ListOptions pagingOptions)
// {
// if (serverState.IsClosed)
// return StatusCode(503, new ApiErrorResponse(ApiErrorCode.API_CLOSED, null, serverState.Reason));
// if (!ModelState.IsValid)
// return BadRequest(new ApiErrorResponse(ModelState));
// //Instantiate the business object handler
// WidgetBiz biz = WidgetBiz.GetBiz(ct, HttpContext);
// ApiPagedResponse pr = biz.TestGetWidgetUserEmailList(Url, nameof(TestGetWidgetUserEmailList), pagingOptions).Result;
// return Ok(new ApiOkWithPagingResponse(pr));
// // string ret= biz.GetList(Url, nameof(List), pagingOptions).Result;
// // return Ok(ret);
// }
// /// <summary>
// /// Get paged list of widgets
// ///
// /// Required roles:
// /// BizAdminFull, InventoryFull, BizAdminLimited, InventoryLimited
// /// </summary>
// /// <returns>Paged collection of widgets with paging data</returns>
// [HttpGet("ListWidgets", Name = nameof(ListWidgets))]//We MUST have a "Name" defined or we can't get the link for the pagination, non paged urls don't need a name
// public async Task<IActionResult> ListWidgets([FromQuery] ListOptions pagingOptions)
// {
// if (serverState.IsClosed)
// return StatusCode(503, new ApiErrorResponse(ApiErrorCode.API_CLOSED, null, serverState.Reason));
// //Instantiate the business object handler
// WidgetBiz biz = WidgetBiz.GetBiz(ct, HttpContext);
// if (!Authorized.HasReadFullRole(HttpContext.Items, biz.BizType))
// return StatusCode(403, new ApiNotAuthorizedResponse());
// if (!ModelState.IsValid)
// return BadRequest(new ApiErrorResponse(ModelState));
// ApiPagedResponse<Widget> pr = await biz.GetManyAsync(Url, nameof(ListWidgets), pagingOptions);
// return Ok(new ApiOkWithPagingResponse<Widget>(pr));
// }
// /// <summary>
// /// Get pick list
// ///
// /// Required roles: Any
// ///
// /// </summary>
// /// <param name="pagingOptions">Paging, filtering and sorting options</param>
// /// <returns>Paged id/name collection with paging data</returns>
// [HttpGet("PickList", Name = nameof(WidgetPickList))]
// public ActionResult WidgetPickList([FromQuery] ListOptions pagingOptions)
// {
// if (serverState.IsClosed)
// return StatusCode(503, new ApiErrorResponse(ApiErrorCode.API_CLOSED, null, serverState.Reason));
// if (!ModelState.IsValid)
// return BadRequest(new ApiErrorResponse(ModelState));
// //Instantiate the business object handler
// WidgetBiz biz = WidgetBiz.GetBiz(ct, HttpContext);
// ApiPagedResponse<NameIdItem> pr = biz.GetPickList(Url, nameof(WidgetPickList), pagingOptions);
// return Ok(new ApiOkWithPagingResponse<NameIdItem>(pr));
// }
/// <summary>
/// Put (update) widget
///
/// Required roles:
/// BizAdminFull, InventoryFull
///
/// </summary>
/// <param name="id"></param>
/// <param name="inObj"></param>
@@ -214,7 +100,7 @@ namespace AyaNova.Api.Controllers
//Instantiate the business object handler
WidgetBiz biz = WidgetBiz.GetBiz(ct, HttpContext);
var o = await biz.GetNoLogAsync(id);
var o = await biz.GetAsync(id, false);
if (o == null)
return NotFound(new ApiErrorResponse(ApiErrorCode.NOT_FOUND));
@@ -240,10 +126,6 @@ namespace AyaNova.Api.Controllers
/// <summary>
/// Patch (update) widget
///
/// Required roles:
/// BizAdminFull, InventoryFull
///
/// </summary>
/// <param name="id"></param>
/// <param name="concurrencyToken"></param>
@@ -263,7 +145,7 @@ namespace AyaNova.Api.Controllers
//Instantiate the business object handler
WidgetBiz biz = WidgetBiz.GetBiz(ct, HttpContext);
var o = await biz.GetNoLogAsync(id);
var o = await biz.GetAsync(id, false);
if (o == null)
return NotFound(new ApiErrorResponse(ApiErrorCode.NOT_FOUND));
@@ -289,9 +171,6 @@ namespace AyaNova.Api.Controllers
/// <summary>
/// Post widget
///
/// Required roles:
/// BizAdminFull, InventoryFull
/// </summary>
/// <param name="inObj"></param>
/// <param name="apiVersion">Automatically filled from route path, no need to specify in body</param>
@@ -324,9 +203,6 @@ namespace AyaNova.Api.Controllers
/// <summary>
/// Duplicate widget
///
/// Required roles:
/// BizAdminFull, InventoryFull
/// </summary>
/// <param name="id">Create a duplicate of this items id</param>
/// <param name="apiVersion">Automatically filled from route path, no need to specify in body</param>
@@ -347,7 +223,7 @@ namespace AyaNova.Api.Controllers
if (!ModelState.IsValid)
return BadRequest(new ApiErrorResponse(ModelState));
var oSrc = await biz.GetNoLogAsync(id);
var oSrc = await biz.GetAsync(id, false);
if (oSrc == null)
return NotFound(new ApiErrorResponse(ApiErrorCode.NOT_FOUND));
@@ -364,11 +240,6 @@ namespace AyaNova.Api.Controllers
/// <summary>
/// Delete widget
///
/// Required roles:
/// BizAdminFull, InventoryFull
///
///
/// </summary>
/// <param name="id"></param>
/// <returns>Ok</returns>
@@ -384,7 +255,7 @@ namespace AyaNova.Api.Controllers
//Instantiate the business object handler
WidgetBiz biz = WidgetBiz.GetBiz(ct, HttpContext);
var o = await biz.GetNoLogAsync(id);
var o = await biz.GetAsync(id, false);
if (o == null)
return NotFound(new ApiErrorResponse(ApiErrorCode.NOT_FOUND));