From 48dbe860ff39a9c22f95f928921b4482c4d10fd9 Mon Sep 17 00:00:00 2001 From: John Cardinal Date: Tue, 18 Feb 2020 21:52:28 +0000 Subject: [PATCH] --- .../Controllers/DataListViewController.cs | 32 +++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) diff --git a/server/AyaNova/Controllers/DataListViewController.cs b/server/AyaNova/Controllers/DataListViewController.cs index 262fef44..f5fd3da7 100644 --- a/server/AyaNova/Controllers/DataListViewController.cs +++ b/server/AyaNova/Controllers/DataListViewController.cs @@ -49,7 +49,7 @@ namespace AyaNova.Api.Controllers /// Get full DataListView object /// /// - /// A single DataFilter + /// A single DataListView [HttpGet("{id}")] public async Task GetDataListView([FromRoute] long id) { @@ -152,7 +152,7 @@ namespace AyaNova.Api.Controllers //Instantiate the business object handler DataListViewBiz biz = DataListViewBiz.GetBiz(ct, HttpContext); - //check roles + //check roles if (!Authorized.HasCreateRole(HttpContext.Items, biz.BizType)) return StatusCode(403, new ApiNotAuthorizedResponse()); @@ -200,6 +200,34 @@ namespace AyaNova.Api.Controllers return NoContent(); } + /// + /// Get default ListView for DataList + /// + /// Key of an existing DataList + /// A single DataListView + [HttpGet("/default/{dataListKey}")] + public ActionResult GetDefaultDataListView([FromRoute] string dataListKey) + { + if (serverState.IsClosed) + return StatusCode(503, new ApiErrorResponse(ApiErrorCode.API_CLOSED, null, serverState.Reason)); + + //Instantiate the business object handler + DataListViewBiz biz = DataListViewBiz.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 = AyaNova.DataList.DataListFactory.GetAyaDataList(dataListKey); ; + if (o == null) + return NotFound(new ApiErrorResponse(ApiErrorCode.NOT_FOUND)); + + return Ok(ApiOkResponse.Response(o, true)); + } + + //------------