This commit is contained in:
2020-01-22 00:34:54 +00:00
parent 3981e395d5
commit bee5fe85f9
6 changed files with 12 additions and 23 deletions

View File

@@ -7,13 +7,6 @@ eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOiIxNTcxODU5OTU0IiwiZXhwIjoiMTU3MjQ
Clean up AyaObjectField definition for FORM FIELD STUFF:
Used for form customization
available fields to select for show etc
Extracted from ayaobjectfielddefinitions
Essentially the same thing as it is now, so maybe just rename the existing one
Rename objectfieldscontroller / routes
MAKE DATALIST ROUTE FOR FETCHING LISTS BY KEY

View File

@@ -11,16 +11,12 @@ using AyaNova.Biz;
namespace AyaNova.Api.Controllers
{
/// <summary>
/// Enum pick list controller
/// </summary>
[ApiController]
[ApiVersion("8.0")]
[Route("api/v{version:apiVersion}/[controller]")]
[Produces("application/json")]
[Authorize]
public class ObjectFieldsController : ControllerBase
public class FormFieldsDefinitionsController : ControllerBase
{
private readonly AyContext ct;
private readonly ILogger<AyaTypeController> log;
@@ -33,7 +29,7 @@ namespace AyaNova.Api.Controllers
/// <param name="dbcontext"></param>
/// <param name="logger"></param>
/// <param name="apiServerState"></param>
public ObjectFieldsController(AyContext dbcontext, ILogger<AyaTypeController> logger, ApiServerState apiServerState)
public FormFieldsDefinitionsController(AyContext dbcontext, ILogger<AyaTypeController> logger, ApiServerState apiServerState)
{
ct = dbcontext;
log = logger;
@@ -48,10 +44,10 @@ namespace AyaNova.Api.Controllers
/// Required roles: Any
///
/// </summary>
/// <param name="objectKey"></param>
/// <returns>List of fields and their properties</returns>
[HttpGet("ObjectFields/{objectKey}")]
public ActionResult GetObjectFields([FromRoute] string objectKey)
/// <param name="FormFieldDefinitionKey"></param>
/// <returns>List of form fields and their properties</returns>
[HttpGet("{FormFieldDefinitionKey}")]
public ActionResult GetFormFields([FromRoute] string FormFieldDefinitionKey)
{
if (!serverState.IsOpen)
return StatusCode(503, new ApiErrorResponse(ApiErrorCode.API_CLOSED, null, serverState.Reason));
@@ -59,9 +55,9 @@ namespace AyaNova.Api.Controllers
if (!ModelState.IsValid)
return BadRequest(new ApiErrorResponse(ModelState));
if (AyaFormFieldDefinitions.IsValidFormFieldDefinitionKey(objectKey))
if (AyaFormFieldDefinitions.IsValidFormFieldDefinitionKey(FormFieldDefinitionKey))
{
return Ok(ApiOkResponse.Response(AyaFormFieldDefinitions.AyaObjectFields(objectKey), true));
return Ok(ApiOkResponse.Response(AyaFormFieldDefinitions.AyaFormFields(FormFieldDefinitionKey), true));
}
else
{

View File

@@ -35,7 +35,7 @@ namespace AyaNova.Biz
return AyaFormFieldDefinitionKeys.Contains(key);
}
public static List<AyaFormFieldDefinition> AyaObjectFields(string key)
public static List<AyaFormFieldDefinition> AyaFormFields(string key)
{
/*
***************************** WARNING: Be careful here, if a standard field is hideable and also it's DB SCHEMA is set to NON NULLABLE then the CLIENT end needs to set a default

View File

@@ -16,7 +16,7 @@ namespace AyaNova.Biz
return;
var FormTemplate = JArray.Parse(formCustom.Template);
var ThisFormCustomFieldsList = AyaFormFieldDefinitions.AyaObjectFields(formCustom.FormKey).Where(x => x.IsCustomField == true).Select(x => x.LtKey).ToList();
var ThisFormCustomFieldsList = AyaFormFieldDefinitions.AyaFormFields(formCustom.FormKey).Where(x => x.IsCustomField == true).Select(x => x.LtKey).ToList();
//If the customFields string is empty then only validation is if any of the fields are required to be filled in
if (!hasCustomData)

View File

@@ -192,7 +192,7 @@ namespace AyaNova.Biz
if ((!PropertyHasErrors("FormKey") && !string.IsNullOrWhiteSpace(inObj.Template)))
{
var ValidCustomFieldTypes = CustomFieldType.ValidCustomFieldTypes;
var ValidFormFields = AyaFormFieldDefinitions.AyaObjectFields(inObj.FormKey);
var ValidFormFields = AyaFormFieldDefinitions.AyaFormFields(inObj.FormKey);
try
{
//Parse the json, expecting something like this:

View File

@@ -18,7 +18,7 @@ namespace AyaNova.Biz
//var OuterJson=JObject.Parse(formCustom.Template);
var FormTemplate = JArray.Parse(formCustom.Template);
// var FormTemplate=(JArray)OuterJson["template"];
var FormFields = AyaFormFieldDefinitions.AyaObjectFields(formCustom.FormKey);
var FormFields = AyaFormFieldDefinitions.AyaFormFields(formCustom.FormKey);
// var ThisFormNormalFieldsList = FormFields.Where(x => x.Custom == false).Select(x => x.Key).ToList();
foreach (JObject jo in FormTemplate)