This commit is contained in:
2020-01-21 23:57:35 +00:00
parent d9b93bb746
commit c1eeeffc01
2 changed files with 31 additions and 3 deletions

View File

@@ -73,8 +73,6 @@ namespace AyaNova.Api.Controllers
}
}
/// <summary>
/// List of all DataList keys available
///
@@ -92,5 +90,30 @@ namespace AyaNova.Api.Controllers
return Ok(ApiOkResponse.Response(DataListFactory.GetListOfAllDataListKeyNames(), true));
}
/// <summary>
/// List of all fields for data list key specified
///
/// Required roles: Any
/// </summary>
/// <returns>List of DataListFieldDefinition</returns>
[HttpGet("ListFields")]
public ActionResult GetDataListFields([FromQuery] string DataListKey)
{
if (!serverState.IsOpen)
{
return StatusCode(503, new ApiErrorResponse(ApiErrorCode.API_CLOSED, null, serverState.Reason));
}
var DataList = DataListFactory.GetAyaDataList(DataListKey);
//was the name not found as a list?
if (DataList == null)
{
return BadRequest(new ApiErrorResponse(ApiErrorCode.NOT_FOUND, "DataListKey", $"DataList \"{DataListKey}\" specified does not exist"));
}
return Ok(ApiOkResponse.Response(DataList.FieldDefinitions, true));
}
}//eoc
}//ens

View File

@@ -1,4 +1,6 @@
using AyaNova.Biz;
using System.ComponentModel.DataAnnotations;
using Newtonsoft.Json;
namespace AyaNova.DataList
{
@@ -31,8 +33,11 @@ namespace AyaNova.DataList
//CLIENT / SERVER - client display and to indicate what object to open , Server for formatting return object
public int AyaObjectType { get; set; }
//SERVER - for building sql queries
//SERVER - for building sql queries
//don't return these properties when api user fetches field list definitions in DataListController
[JsonIgnore]
public string SqlIdColumnName { get; set; }
[JsonIgnore]
public string SqlValueColumnName { get; set; }