2021-02-04 13:51:31 -05:00
|
|
|
|
using PoweredSoft.DynamicQuery;
|
|
|
|
|
using PoweredSoft.DynamicQuery.Core;
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
|
|
|
|
|
namespace PoweredSoft.CQRS.GraphQL.DynamicQuery
|
|
|
|
|
{
|
|
|
|
|
public class GraphQLAdvanceQueryFilter
|
|
|
|
|
{
|
|
|
|
|
public bool? And { get; set; }
|
|
|
|
|
public FilterType Type { get; set; }
|
2021-04-27 14:08:39 -04:00
|
|
|
|
public bool? CaseInsensitive { get; set; }
|
2021-02-04 13:51:31 -05:00
|
|
|
|
public string Path { get; set; }
|
|
|
|
|
public GraphQLVariantInput Value { get; set; }
|
|
|
|
|
public bool? Not { get; set; }
|
|
|
|
|
|
|
|
|
|
public List<GraphQLAdvanceQueryFilter> Filters { get; set; }
|
|
|
|
|
|
|
|
|
|
internal IFilter ToFilter()
|
|
|
|
|
{
|
|
|
|
|
if (Type == FilterType.Composite)
|
|
|
|
|
{
|
|
|
|
|
var ret = new CompositeFilter
|
|
|
|
|
{
|
|
|
|
|
And = And,
|
|
|
|
|
Type = FilterType.Composite
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
if (Filters == null)
|
|
|
|
|
ret.Filters = new List<IFilter>();
|
|
|
|
|
else
|
|
|
|
|
ret.Filters = Filters.Select(t => t.ToFilter()).ToList();
|
|
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
return new SimpleFilter
|
|
|
|
|
{
|
|
|
|
|
And = And,
|
2021-04-27 14:08:39 -04:00
|
|
|
|
CaseInsensitive = CaseInsensitive,
|
2021-02-04 13:51:31 -05:00
|
|
|
|
Type = Type,
|
|
|
|
|
Not = Not,
|
|
|
|
|
Path = Path,
|
|
|
|
|
Value = Value.GetRawObjectValue()
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|