This commit is contained in:
@@ -263,9 +263,15 @@ namespace AyaNova.Biz
|
||||
AddError(ValidationErrorType.RequiredPropertyEmpty, "Filter", $"Filter array item {i}, object is missing required \"fld\" property ");
|
||||
if (filterItem["op"] == null)
|
||||
AddError(ValidationErrorType.RequiredPropertyEmpty, "Filter", $"Filter array item {i}, object is missing required \"op\" property ");
|
||||
else
|
||||
{
|
||||
var opType = filterItem["op"].Value<string>();
|
||||
if (!FilterComparisonOperator.Operators.Contains(opType))
|
||||
AddError(ValidationErrorType.InvalidValue, "Filter", $"Filter array item {i}, \"op\" value of \"{opType}\" is not a valid FilterComparisonOperator type");
|
||||
}
|
||||
if (filterItem["value"] == null)
|
||||
AddError(ValidationErrorType.RequiredPropertyEmpty, "Filter", $"Filter array item {i}, object is missing required \"value\" property ");
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Newtonsoft.Json.JsonReaderException ex)
|
||||
{
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
using System.Collections.Generic;
|
||||
namespace AyaNova.Biz
|
||||
{
|
||||
public static class FilterComparisonOperator
|
||||
@@ -6,13 +7,39 @@ namespace AyaNova.Biz
|
||||
public const string GreaterThan = ">";
|
||||
public const string GreaterThanOrEqualTo = ">=";
|
||||
public const string LessThan = "<";
|
||||
public const string LessThanOrEqualTo = "<=";
|
||||
public const string NotEqual = "!=";
|
||||
public const string LessThanOrEqualTo = "<=";
|
||||
public const string NotEqual = "!=";
|
||||
public const string NotLike = "!%";
|
||||
public const string StartsWith = "%-";
|
||||
public const string EndsWith = "-%";
|
||||
public const string Contains = "-%-";
|
||||
public const string NotContains = "!-%-";
|
||||
public const string NotContains = "!-%-";
|
||||
|
||||
public static List<string> operators = null;
|
||||
public static List<string> Operators
|
||||
{
|
||||
get
|
||||
{
|
||||
if (operators == null)
|
||||
{
|
||||
operators = new List<string>();
|
||||
operators.Add(Equality);
|
||||
operators.Add(GreaterThan);
|
||||
operators.Add(GreaterThanOrEqualTo);
|
||||
operators.Add(LessThan);
|
||||
operators.Add(LessThanOrEqualTo);
|
||||
operators.Add(NotEqual);
|
||||
operators.Add(NotLike);
|
||||
operators.Add(StartsWith);
|
||||
operators.Add(EndsWith);
|
||||
operators.Add(Contains);
|
||||
operators.Add(NotContains);
|
||||
|
||||
}
|
||||
return operators;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user