This commit is contained in:
2020-01-23 20:01:54 +00:00
parent 93de4d5112
commit 168d7ac939
3 changed files with 12 additions and 19 deletions

View File

@@ -5,8 +5,6 @@ eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOiIxNTcxODU5OTU0IiwiZXhwIjoiMTU3MjQ
## IMMEDIATE ITEMS ## IMMEDIATE ITEMS
INTEGRATION TEST UPDATE Update tests when appropriate (when it's working fully and not mocked)
- GET ALL TESTS WORKING!
TODO: DataFilter how to distinguish between filtering on specific ID value or on value column TODO: DataFilter how to distinguish between filtering on specific ID value or on value column
- Might need to add a filter on ID type of thing maybe? - Might need to add a filter on ID type of thing maybe?
@@ -30,9 +28,8 @@ CLIENT PROJECT CUSTOM FIELDS CHANGE
- Additional NUMBER is split now between integer and decimal types update control STEP value for inputs to include decimal places or none depending on type - Additional NUMBER is split now between integer and decimal types update control STEP value for inputs to include decimal places or none depending on type
TEST CHANGES TEST CHANGES
- Must use numeric instead of text values now - Need new test for DataList stuff besides the actual lists
- Test datatypes enum picklist - Or, does all the code around that get tested automatically with the list fetch itself?
- New routes for lists
- Test validation code for custom template with bad one (field not exists) - Test validation code for custom template with bad one (field not exists)
- Test insufficient roles to fetch test widget datalist (outside staff) - Test insufficient roles to fetch test widget datalist (outside staff)

View File

@@ -46,11 +46,8 @@ namespace AyaNova.Biz
{ {
case WIDGET_KEY: case WIDGET_KEY:
#region WIDGET_KEY #region WIDGET_KEY
//first column is the non visible Default Id column so that the client knows what to open when there is no field with ID selected that matches underlying record type l.Add(new AyaFormFieldDefinition { LtKey = "WidgetName", FieldKey = "Name", Hideable = false });
//in this case the default of id is sufficient for this list
l.Add(new AyaFormFieldDefinition { LtKey = "df" });
l.Add(new AyaFormFieldDefinition { LtKey = "WidgetName", FieldKey = "Name" });
l.Add(new AyaFormFieldDefinition { LtKey = "WidgetSerial", FieldKey = "Serial" }); l.Add(new AyaFormFieldDefinition { LtKey = "WidgetSerial", FieldKey = "Serial" });
l.Add(new AyaFormFieldDefinition { LtKey = "WidgetDollarAmount", FieldKey = "DollarAmount" }); l.Add(new AyaFormFieldDefinition { LtKey = "WidgetDollarAmount", FieldKey = "DollarAmount" });
l.Add(new AyaFormFieldDefinition { LtKey = "WidgetCount", FieldKey = "Count" }); l.Add(new AyaFormFieldDefinition { LtKey = "WidgetCount", FieldKey = "Count" });
@@ -84,7 +81,6 @@ namespace AyaNova.Biz
#endregion #endregion
case USER_KEY: case USER_KEY:
#region USER_KEY #region USER_KEY
l.Add(new AyaFormFieldDefinition { LtKey = "df" });
l.Add(new AyaFormFieldDefinition { LtKey = "Name", FieldKey = "Name", Hideable = false }); l.Add(new AyaFormFieldDefinition { LtKey = "Name", FieldKey = "Name", Hideable = false });
l.Add(new AyaFormFieldDefinition { LtKey = "UserEmployeeNumber", FieldKey = "EmployeeNumber" }); l.Add(new AyaFormFieldDefinition { LtKey = "UserEmployeeNumber", FieldKey = "EmployeeNumber" });
l.Add(new AyaFormFieldDefinition { LtKey = "AuthorizationRoles", FieldKey = "Roles", Hideable = false }); l.Add(new AyaFormFieldDefinition { LtKey = "AuthorizationRoles", FieldKey = "Roles", Hideable = false });

View File

@@ -215,19 +215,19 @@ namespace AyaNova.Biz
{ {
var fldKey = formFieldItem["fld"].Value<string>(); var fldKey = formFieldItem["fld"].Value<string>();
if (string.IsNullOrWhiteSpace(fldKey)) if (string.IsNullOrWhiteSpace(fldKey))
AddError(ApiErrorCode.VALIDATION_REQUIRED, "Template", $"Template array item {i}, \"fld\" property is empty and required"); AddError(ApiErrorCode.VALIDATION_REQUIRED, "Template", $"Template array item {i}, \"fld\" property exists but is empty, a value is required");
//validate the field name if we can //validate the field name if we can
if (ValidFormFields != null) if (ValidFormFields != null)
{ {
if (!ValidFormFields.Exists(x => x.LtKey == fldKey)) if (!ValidFormFields.Exists(x => x.FieldKey == fldKey))
{ {
AddError(ApiErrorCode.VALIDATION_INVALID_VALUE, "Template", $"Template array item {i}, fld property value \"{fldKey}\" is not a valid form field value for formKey specified"); AddError(ApiErrorCode.VALIDATION_INVALID_VALUE, "Template", $"Template array item {i}, fld property value \"{fldKey}\" is not a valid form field value for formKey specified");
} }
else else
{ {
MasterFormField = ValidFormFields.FirstOrDefault(x => x.LtKey == fldKey); MasterFormField = ValidFormFields.FirstOrDefault(x => x.FieldKey == fldKey);
} }
} }
@@ -241,13 +241,13 @@ namespace AyaNova.Biz
{ {
var fieldHideValue = formFieldItem["hide"].Value<bool>(); var fieldHideValue = formFieldItem["hide"].Value<bool>();
if (!MasterFormField.Hideable && fieldHideValue == true) if (!MasterFormField.Hideable && fieldHideValue == true)
AddError(ApiErrorCode.VALIDATION_INVALID_VALUE, "Template", $"Template array item {i}, \"hide\" property value of \"{fieldHideValue}\" is not valid, this field is core and cannot be hidden"); AddError(ApiErrorCode.VALIDATION_INVALID_VALUE, "Template", $"Template array item {i} (\"{MasterFormField.FieldKey}\"), \"hide\" property value of \"{fieldHideValue}\" is not valid, this field is core and cannot be hidden");
} }
//validate if it's a custom field that it has a type specified //validate if it's a custom field that it has a type specified
if (MasterFormField.IsCustomField && formFieldItem["type"] == null) if (MasterFormField.IsCustomField && formFieldItem["type"] == null)
{ {
AddError(ApiErrorCode.VALIDATION_INVALID_VALUE, "Template", $"Template array item {i}, \"type\" property value is MISSING for custom filed, Custom fields MUST have types specified"); AddError(ApiErrorCode.VALIDATION_INVALID_VALUE, "Template", $"Template array item {i} (\"{MasterFormField.FieldKey}\"), \"type\" property value is MISSING for custom field, Custom fields MUST have types specified");
} }
@@ -255,12 +255,12 @@ namespace AyaNova.Biz
if (formFieldItem["type"] != null) if (formFieldItem["type"] != null)
{ {
if (!MasterFormField.IsCustomField) if (!MasterFormField.IsCustomField)
AddError(ApiErrorCode.VALIDATION_INVALID_VALUE, "Template", $"Template array item {i}, \"type\" property value is not valid, only Custom fields can have types specified"); AddError(ApiErrorCode.VALIDATION_INVALID_VALUE, "Template", $"Template array item {i} (\"{MasterFormField.FieldKey}\"), \"type\" property value is not valid, only Custom fields can have types specified");
else else
{//It is a custom field, is it a valid type value {//It is a custom field, is it a valid type value
var templateFieldCustomTypeValue = formFieldItem["type"].Value<int>(); var templateFieldCustomTypeValue = formFieldItem["type"].Value<int>();
if (!ValidCustomFieldTypes.Contains(templateFieldCustomTypeValue)) if (!ValidCustomFieldTypes.Contains(templateFieldCustomTypeValue))
AddError(ApiErrorCode.VALIDATION_INVALID_VALUE, "Template", $"Template array item {i}, \"type\" property value of \"{templateFieldCustomTypeValue}\" is not a valid custom field type"); AddError(ApiErrorCode.VALIDATION_INVALID_VALUE, "Template", $"Template array item {i} (\"{MasterFormField.FieldKey}\"), \"type\" property value of \"{templateFieldCustomTypeValue}\" is not a valid custom field type");
} }
} }
@@ -268,7 +268,7 @@ namespace AyaNova.Biz
//other code depends on seeing the required value even if it's not set to true //other code depends on seeing the required value even if it's not set to true
if (formFieldItem["required"] == null) if (formFieldItem["required"] == null)
AddError(ApiErrorCode.VALIDATION_REQUIRED, "Template", $"Template array item {i}, object is missing required \"required\" property "); AddError(ApiErrorCode.VALIDATION_REQUIRED, "Template", $"Template array item {i}, object is missing \"required\" property. All items must contain this property. ");
//NOTE: value of nothing, null or empty is a valid value so no checking for it here //NOTE: value of nothing, null or empty is a valid value so no checking for it here