From e362a6734ef9b5e2e431f3a82582116c21351ad6 Mon Sep 17 00:00:00 2001 From: John Cardinal Date: Tue, 14 Jan 2020 20:30:53 +0000 Subject: [PATCH] --- server/AyaNova/biz/DataFilterBiz.cs | 17 +++++++- server/AyaNova/biz/ObjectFields.cs | 64 ++++++++++++++--------------- 2 files changed, 47 insertions(+), 34 deletions(-) diff --git a/server/AyaNova/biz/DataFilterBiz.cs b/server/AyaNova/biz/DataFilterBiz.cs index 82e1209a..9c2c518a 100644 --- a/server/AyaNova/biz/DataFilterBiz.cs +++ b/server/AyaNova/biz/DataFilterBiz.cs @@ -287,12 +287,25 @@ namespace AyaNova.Biz // 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"); // } - if (!ListValidFilterOptions.Exists(x => x.Key == fld && x.Filterable)) + var TheField = ListValidFilterOptions.SingleOrDefault(x => x.PropertyName.ToLowerInvariant() == fld); + + if (TheField == null) { AddError(ApiErrorCode.VALIDATION_INVALID_VALUE, "Filter", $"Filter array item {i}, fld property value \"{fld}\" is not a valid value for ListKey specified"); } + else if (TheField.Filterable == false) + { + AddError(ApiErrorCode.VALIDATION_INVALID_VALUE, "Filter", $"Filter array item {i}, fld property value \"{fld}\" is not filterable"); + } + + } } @@ -350,7 +363,7 @@ namespace AyaNova.Biz if (ListValidFilterOptions != null) { - if (!ListValidFilterOptions.Exists(x => x.Key == fld && x.Filterable)) + if (!ListValidFilterOptions.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"); } diff --git a/server/AyaNova/biz/ObjectFields.cs b/server/AyaNova/biz/ObjectFields.cs index 923ade7e..a1167450 100644 --- a/server/AyaNova/biz/ObjectFields.cs +++ b/server/AyaNova/biz/ObjectFields.cs @@ -62,22 +62,22 @@ namespace AyaNova.Biz l.Add(new ObjectField { Key = "Active", PropertyName = "Active", DataType = AyDataType.Bool, Hideable = false, SharedLTKey = true }); l.Add(new ObjectField { Key = "Tags", PropertyName = "Tags", DataType = AyDataType.Tags, SharedLTKey = true }); - l.Add(new ObjectField { Key = "WidgetCustom1", Custom = true }); - l.Add(new ObjectField { Key = "WidgetCustom2", Custom = true }); - l.Add(new ObjectField { Key = "WidgetCustom3", Custom = true }); - l.Add(new ObjectField { Key = "WidgetCustom4", Custom = true }); - l.Add(new ObjectField { Key = "WidgetCustom5", Custom = true }); - l.Add(new ObjectField { Key = "WidgetCustom6", Custom = true }); - l.Add(new ObjectField { Key = "WidgetCustom7", Custom = true }); - l.Add(new ObjectField { Key = "WidgetCustom8", Custom = true }); - l.Add(new ObjectField { Key = "WidgetCustom9", Custom = true }); - l.Add(new ObjectField { Key = "WidgetCustom10", Custom = true }); - l.Add(new ObjectField { Key = "WidgetCustom11", Custom = true }); - l.Add(new ObjectField { Key = "WidgetCustom12", Custom = true }); - l.Add(new ObjectField { Key = "WidgetCustom13", Custom = true }); - l.Add(new ObjectField { Key = "WidgetCustom14", Custom = true }); - l.Add(new ObjectField { Key = "WidgetCustom15", Custom = true }); - l.Add(new ObjectField { Key = "WidgetCustom16", Custom = true }); + l.Add(new ObjectField { Key = "WidgetCustom1", PropertyName = "WidgetCustom1", Custom = true }); + l.Add(new ObjectField { Key = "WidgetCustom2", PropertyName = "WidgetCustom2", Custom = true }); + l.Add(new ObjectField { Key = "WidgetCustom3", PropertyName = "WidgetCustom3", Custom = true }); + l.Add(new ObjectField { Key = "WidgetCustom4", PropertyName = "WidgetCustom4", Custom = true }); + l.Add(new ObjectField { Key = "WidgetCustom5", PropertyName = "WidgetCustom5", Custom = true }); + l.Add(new ObjectField { Key = "WidgetCustom6", PropertyName = "WidgetCustom6", Custom = true }); + l.Add(new ObjectField { Key = "WidgetCustom7", PropertyName = "WidgetCustom7", Custom = true }); + l.Add(new ObjectField { Key = "WidgetCustom8", PropertyName = "WidgetCustom8", Custom = true }); + l.Add(new ObjectField { Key = "WidgetCustom9", PropertyName = "WidgetCustom9", Custom = true }); + l.Add(new ObjectField { Key = "WidgetCustom10", PropertyName = "WidgetCustom10", Custom = true }); + l.Add(new ObjectField { Key = "WidgetCustom11", PropertyName = "WidgetCustom11", Custom = true }); + l.Add(new ObjectField { Key = "WidgetCustom12", PropertyName = "WidgetCustom12", Custom = true }); + l.Add(new ObjectField { Key = "WidgetCustom13", PropertyName = "WidgetCustom13", Custom = true }); + l.Add(new ObjectField { Key = "WidgetCustom14", PropertyName = "WidgetCustom14", Custom = true }); + l.Add(new ObjectField { Key = "WidgetCustom15", PropertyName = "WidgetCustom15", Custom = true }); + l.Add(new ObjectField { Key = "WidgetCustom16", PropertyName = "WidgetCustom16", Custom = true }); break; case USER_KEY: @@ -89,22 +89,22 @@ namespace AyaNova.Biz l.Add(new ObjectField { Key = "Active", PropertyName = "Active", DataType = AyDataType.Bool, Hideable = false, SharedLTKey = true }); l.Add(new ObjectField { Key = "Tags", PropertyName = "Tags", DataType = AyDataType.Tags, SharedLTKey = true }); - l.Add(new ObjectField { Key = "UserCustom1", Custom = true }); - l.Add(new ObjectField { Key = "UserCustom2", Custom = true }); - l.Add(new ObjectField { Key = "UserCustom3", Custom = true }); - l.Add(new ObjectField { Key = "UserCustom4", Custom = true }); - l.Add(new ObjectField { Key = "UserCustom5", Custom = true }); - l.Add(new ObjectField { Key = "UserCustom6", Custom = true }); - l.Add(new ObjectField { Key = "UserCustom7", Custom = true }); - l.Add(new ObjectField { Key = "UserCustom8", Custom = true }); - l.Add(new ObjectField { Key = "UserCustom9", Custom = true }); - l.Add(new ObjectField { Key = "UserCustom10", Custom = true }); - l.Add(new ObjectField { Key = "UserCustom11", Custom = true }); - l.Add(new ObjectField { Key = "UserCustom12", Custom = true }); - l.Add(new ObjectField { Key = "UserCustom13", Custom = true }); - l.Add(new ObjectField { Key = "UserCustom14", Custom = true }); - l.Add(new ObjectField { Key = "UserCustom15", Custom = true }); - l.Add(new ObjectField { Key = "UserCustom16", Custom = true }); + l.Add(new ObjectField { Key = "UserCustom1", PropertyName = "UserCustom1", Custom = true }); + l.Add(new ObjectField { Key = "UserCustom2", PropertyName = "UserCustom2", Custom = true }); + l.Add(new ObjectField { Key = "UserCustom3", PropertyName = "UserCustom3", Custom = true }); + l.Add(new ObjectField { Key = "UserCustom4", PropertyName = "UserCustom4", Custom = true }); + l.Add(new ObjectField { Key = "UserCustom5", PropertyName = "UserCustom5", Custom = true }); + l.Add(new ObjectField { Key = "UserCustom6", PropertyName = "UserCustom6", Custom = true }); + l.Add(new ObjectField { Key = "UserCustom7", PropertyName = "UserCustom7", Custom = true }); + l.Add(new ObjectField { Key = "UserCustom8", PropertyName = "UserCustom8", Custom = true }); + l.Add(new ObjectField { Key = "UserCustom9", PropertyName = "UserCustom9", Custom = true }); + l.Add(new ObjectField { Key = "UserCustom10", PropertyName = "UserCustom10", Custom = true }); + l.Add(new ObjectField { Key = "UserCustom11", PropertyName = "UserCustom11", Custom = true }); + l.Add(new ObjectField { Key = "UserCustom12", PropertyName = "UserCustom12", Custom = true }); + l.Add(new ObjectField { Key = "UserCustom13", PropertyName = "UserCustom13", Custom = true }); + l.Add(new ObjectField { Key = "UserCustom14", PropertyName = "UserCustom14", Custom = true }); + l.Add(new ObjectField { Key = "UserCustom15", PropertyName = "UserCustom15", Custom = true }); + l.Add(new ObjectField { Key = "UserCustom16", PropertyName = "UserCustom16", Custom = true }); break;