This commit is contained in:
2020-08-31 21:24:33 +00:00
parent 09150db011
commit 2dd3ee32ab
2 changed files with 40 additions and 1 deletions

View File

@@ -158,7 +158,25 @@ namespace AyaNova.Api.Controllers
/// <summary>
/// Get Report list for object
/// </summary>
/// <param name="ayType">Type of object</param>
/// <returns>Name / id report list of allowed reports for role of requester</returns>
[HttpGet("list/{ayType}")]
public async Task<IActionResult> GetReportList([FromRoute] AyaType ayType)
{
if (!serverState.IsOpen)
return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason));
ReportBiz biz = ReportBiz.GetBiz(ct, HttpContext);
if (!Authorized.HasReadFullRole(HttpContext.Items, biz.BizType))
return StatusCode(403, new ApiNotAuthorizedResponse());
if (!ModelState.IsValid)
return BadRequest(new ApiErrorResponse(ModelState));
var o = await biz.GetReportListAsync(ayType);
if (o == null) return NotFound(new ApiErrorResponse(ApiErrorCode.NOT_FOUND));
return Ok(ApiOkResponse.Response(o));
}
//======================================================================================================