This commit is contained in:
2020-01-14 23:03:16 +00:00
parent 596a9adeb9
commit e6c7bd3a13
2 changed files with 6 additions and 26 deletions

View File

@@ -247,17 +247,15 @@ namespace AyaNova.Biz
AddError(ApiErrorCode.VALIDATION_REQUIRED, "ListKey");
List<ObjectField> ListValidFilterOptions = null;
List<ObjectField> FieldList = null;
if (!ObjectFields.IsValidObjectKey(inObj.ListKey))
{
AddError(ApiErrorCode.VALIDATION_INVALID_VALUE, "ListKey", $"ListKey \"{inObj.ListKey}\" is empty or in-valid");
}
else
{
ListValidFilterOptions = ObjectFields.ObjectFieldsList(inObj.ListKey);
FieldList = ObjectFields.ObjectFieldsList(inObj.ListKey);
}
// FilterOptions ListValidFilterOptions = FilterOptionsFromObjectKey.Get(inObj.ListKey);
// if (ListValidFilterOptions == null)
if (inObj.ListKey.Length > 255)
@@ -281,20 +279,10 @@ namespace AyaNova.Biz
AddError(ApiErrorCode.VALIDATION_REQUIRED, "Filter", $"Filter array item {i}, \"fld\" property is empty and required");
//validate the field name if we can
if (ListValidFilterOptions != null)
if (FieldList != null)
{
// if (!ListValidFilterOptions.Flds.Exists(x => x.Fld == fld))
// {
// AddError(ApiErrorCode.VALIDATION_INVALID_VALUE, "Filter", $"Filter array item {i}, fld property value \"{fld}\" is not a valid value for ListKey specified");
// }
// if (!ListValidFilterOptions.Exists(x => x.PropertyName.ToLowerInvariant() == fld && x.Filterable))
// {
// AddError(ApiErrorCode.VALIDATION_INVALID_VALUE, "Filter", $"Filter array item {i}, fld property value \"{fld}\" is not a valid value for ListKey specified");
// }
var TheField = ListValidFilterOptions.SingleOrDefault(x => x.PropertyName.ToLowerInvariant() == fld);
var TheField = FieldList.SingleOrDefault(x => x.PropertyName.ToLowerInvariant() == fld);
if (TheField == null)
{
@@ -360,10 +348,10 @@ namespace AyaNova.Biz
AddError(ApiErrorCode.VALIDATION_REQUIRED, "Sort", $"Sort array item {i}, \"fld\" property is empty and required");
//validate the field name if we can
if (ListValidFilterOptions != null)
if (FieldList != null)
{
if (!ListValidFilterOptions.Exists(x => x.PropertyName.ToLowerInvariant() == fld && x.Filterable))
if (!FieldList.Exists(x => x.PropertyName.ToLowerInvariant() == fld && x.Filterable))
{
AddError(ApiErrorCode.VALIDATION_INVALID_VALUE, "Sort", $"Sort array item {i}, fld property value \"{fld}\" is not a valid value for ListKey specified");
}