This commit is contained in:
@@ -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
|
Rename objectfieldscontroller / routes
|
||||||
|
|
||||||
MAKE DATALIST ROUTE FOR FETCHING LISTS BY KEY
|
MAKE DATALIST ROUTE FOR FETCHING LISTS BY KEY
|
||||||
|
|||||||
@@ -11,16 +11,12 @@ using AyaNova.Biz;
|
|||||||
|
|
||||||
namespace AyaNova.Api.Controllers
|
namespace AyaNova.Api.Controllers
|
||||||
{
|
{
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Enum pick list controller
|
|
||||||
/// </summary>
|
|
||||||
[ApiController]
|
[ApiController]
|
||||||
[ApiVersion("8.0")]
|
[ApiVersion("8.0")]
|
||||||
[Route("api/v{version:apiVersion}/[controller]")]
|
[Route("api/v{version:apiVersion}/[controller]")]
|
||||||
[Produces("application/json")]
|
[Produces("application/json")]
|
||||||
[Authorize]
|
[Authorize]
|
||||||
public class ObjectFieldsController : ControllerBase
|
public class FormFieldsDefinitionsController : ControllerBase
|
||||||
{
|
{
|
||||||
private readonly AyContext ct;
|
private readonly AyContext ct;
|
||||||
private readonly ILogger<AyaTypeController> log;
|
private readonly ILogger<AyaTypeController> log;
|
||||||
@@ -33,7 +29,7 @@ namespace AyaNova.Api.Controllers
|
|||||||
/// <param name="dbcontext"></param>
|
/// <param name="dbcontext"></param>
|
||||||
/// <param name="logger"></param>
|
/// <param name="logger"></param>
|
||||||
/// <param name="apiServerState"></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;
|
ct = dbcontext;
|
||||||
log = logger;
|
log = logger;
|
||||||
@@ -48,10 +44,10 @@ namespace AyaNova.Api.Controllers
|
|||||||
/// Required roles: Any
|
/// Required roles: Any
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="objectKey"></param>
|
/// <param name="FormFieldDefinitionKey"></param>
|
||||||
/// <returns>List of fields and their properties</returns>
|
/// <returns>List of form fields and their properties</returns>
|
||||||
[HttpGet("ObjectFields/{objectKey}")]
|
[HttpGet("{FormFieldDefinitionKey}")]
|
||||||
public ActionResult GetObjectFields([FromRoute] string objectKey)
|
public ActionResult GetFormFields([FromRoute] string FormFieldDefinitionKey)
|
||||||
{
|
{
|
||||||
if (!serverState.IsOpen)
|
if (!serverState.IsOpen)
|
||||||
return StatusCode(503, new ApiErrorResponse(ApiErrorCode.API_CLOSED, null, serverState.Reason));
|
return StatusCode(503, new ApiErrorResponse(ApiErrorCode.API_CLOSED, null, serverState.Reason));
|
||||||
@@ -59,9 +55,9 @@ namespace AyaNova.Api.Controllers
|
|||||||
if (!ModelState.IsValid)
|
if (!ModelState.IsValid)
|
||||||
return BadRequest(new ApiErrorResponse(ModelState));
|
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
|
else
|
||||||
{
|
{
|
||||||
@@ -35,7 +35,7 @@ namespace AyaNova.Biz
|
|||||||
return AyaFormFieldDefinitionKeys.Contains(key);
|
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
|
***************************** 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
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ namespace AyaNova.Biz
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
var FormTemplate = JArray.Parse(formCustom.Template);
|
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 the customFields string is empty then only validation is if any of the fields are required to be filled in
|
||||||
if (!hasCustomData)
|
if (!hasCustomData)
|
||||||
|
|||||||
@@ -192,7 +192,7 @@ namespace AyaNova.Biz
|
|||||||
if ((!PropertyHasErrors("FormKey") && !string.IsNullOrWhiteSpace(inObj.Template)))
|
if ((!PropertyHasErrors("FormKey") && !string.IsNullOrWhiteSpace(inObj.Template)))
|
||||||
{
|
{
|
||||||
var ValidCustomFieldTypes = CustomFieldType.ValidCustomFieldTypes;
|
var ValidCustomFieldTypes = CustomFieldType.ValidCustomFieldTypes;
|
||||||
var ValidFormFields = AyaFormFieldDefinitions.AyaObjectFields(inObj.FormKey);
|
var ValidFormFields = AyaFormFieldDefinitions.AyaFormFields(inObj.FormKey);
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
//Parse the json, expecting something like this:
|
//Parse the json, expecting something like this:
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ namespace AyaNova.Biz
|
|||||||
//var OuterJson=JObject.Parse(formCustom.Template);
|
//var OuterJson=JObject.Parse(formCustom.Template);
|
||||||
var FormTemplate = JArray.Parse(formCustom.Template);
|
var FormTemplate = JArray.Parse(formCustom.Template);
|
||||||
// var FormTemplate=(JArray)OuterJson["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();
|
// var ThisFormNormalFieldsList = FormFields.Where(x => x.Custom == false).Select(x => x.Key).ToList();
|
||||||
|
|
||||||
foreach (JObject jo in FormTemplate)
|
foreach (JObject jo in FormTemplate)
|
||||||
|
|||||||
Reference in New Issue
Block a user