This commit is contained in:
2020-01-14 19:06:48 +00:00
parent d4a5827b65
commit 539ab97998
3 changed files with 22 additions and 9 deletions

View File

@@ -223,7 +223,7 @@ namespace AyaNova.Biz
AddError(ApiErrorCode.VALIDATION_REQUIRED, "UserId"); AddError(ApiErrorCode.VALIDATION_REQUIRED, "UserId");
} }
//Name required //Name required
if (string.IsNullOrWhiteSpace(inObj.Name)) if (string.IsNullOrWhiteSpace(inObj.Name))
@@ -246,11 +246,19 @@ namespace AyaNova.Biz
if (string.IsNullOrWhiteSpace(inObj.ListKey)) if (string.IsNullOrWhiteSpace(inObj.ListKey))
AddError(ApiErrorCode.VALIDATION_REQUIRED, "ListKey"); AddError(ApiErrorCode.VALIDATION_REQUIRED, "ListKey");
FilterOptions ListValidFilterOptions = FilterOptionsFromListKey.Get(inObj.ListKey);
if (ListValidFilterOptions == null) List<ObjectField> ListValidFilterOptions = null;
if (!ObjectFields.IsValidObjectKey(inObj.ListKey))
{ {
AddError(ApiErrorCode.VALIDATION_INVALID_VALUE, "ListKey", $"ListKey \"{inObj.ListKey}\" is empty or in-valid"); AddError(ApiErrorCode.VALIDATION_INVALID_VALUE, "ListKey", $"ListKey \"{inObj.ListKey}\" is empty or in-valid");
} }
else
{
ListValidFilterOptions = ObjectFields.ObjectFieldsList(inObj.ListKey);
}
// FilterOptions ListValidFilterOptions = FilterOptionsFromObjectKey.Get(inObj.ListKey);
// if (ListValidFilterOptions == null)
if (inObj.ListKey.Length > 255) if (inObj.ListKey.Length > 255)
AddError(ApiErrorCode.VALIDATION_LENGTH_EXCEEDED, "ListKey", "255 max"); AddError(ApiErrorCode.VALIDATION_LENGTH_EXCEEDED, "ListKey", "255 max");
@@ -276,7 +284,12 @@ namespace AyaNova.Biz
if (ListValidFilterOptions != null) if (ListValidFilterOptions != null)
{ {
if (!ListValidFilterOptions.Flds.Exists(x => x.Fld == fld)) // 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.Key == fld))
{ {
AddError(ApiErrorCode.VALIDATION_INVALID_VALUE, "Filter", $"Filter array item {i}, fld property value \"{fld}\" is not a valid value for ListKey specified"); AddError(ApiErrorCode.VALIDATION_INVALID_VALUE, "Filter", $"Filter array item {i}, fld property value \"{fld}\" is not a valid value for ListKey specified");
} }
@@ -337,7 +350,7 @@ namespace AyaNova.Biz
if (ListValidFilterOptions != null) if (ListValidFilterOptions != null)
{ {
if (!ListValidFilterOptions.Flds.Exists(x => x.Fld == fld)) if (!ListValidFilterOptions.Exists(x => x.Key == fld))
{ {
AddError(ApiErrorCode.VALIDATION_INVALID_VALUE, "Sort", $"Sort array item {i}, fld property value \"{fld}\" is not a valid value for ListKey specified"); AddError(ApiErrorCode.VALIDATION_INVALID_VALUE, "Sort", $"Sort array item {i}, fld property value \"{fld}\" is not a valid value for ListKey specified");
} }

View File

@@ -6,18 +6,18 @@ using AyaNova.Biz;
namespace AyaNova.Biz namespace AyaNova.Biz
{ {
public class FilterOptions public class DEPRECATED_FilterOptions
{ {
public string Key { get; set; } public string Key { get; set; }
public List<FilterField> Flds { get; set; } public List<FilterField> Flds { get; set; }
public FilterOptions(string key) public DEPRECATED_FilterOptions(string key)
{ {
Flds = new List<FilterField>(); Flds = new List<FilterField>();
Key = key; Key = key;
} }
public FilterOptions AddField(string FieldName, string LocaleKey, string DataType) public DEPRECATED_FilterOptions AddField(string FieldName, string LocaleKey, string DataType)
{ {
Flds.Add(new FilterField(FieldName, LocaleKey, DataType)); Flds.Add(new FilterField(FieldName, LocaleKey, DataType));
return this; return this;

View File

@@ -1,6 +1,6 @@
namespace AyaNova.Biz namespace AyaNova.Biz
{ {
internal static class FilterOptionsFromListKey internal static class FilterOptionsFromObjectKey
{ {
internal static FilterOptions Get(string listKey) internal static FilterOptions Get(string listKey)
{ {