diff --git a/PoweredSoft.CQRS.DynamicQuery.AspNetCore/DynamicQuery.cs b/PoweredSoft.CQRS.DynamicQuery.AspNetCore/DynamicQuery.cs index b9e2c83..85c9838 100644 --- a/PoweredSoft.CQRS.DynamicQuery.AspNetCore/DynamicQuery.cs +++ b/PoweredSoft.CQRS.DynamicQuery.AspNetCore/DynamicQuery.cs @@ -33,14 +33,14 @@ namespace PoweredSoft.CQRS.DynamicQuery.AspNetCore public int? Page { get; set; } public int? PageSize { get; set; } public List Sorts { get; set; } - public List Aggregates { get; set; } + public List Aggregates { get; set; } public List Groups { get; set; } public List Filters { get; set; } public List GetAggregates() { - return Aggregates?.AsEnumerable()?.ToList(); + return Aggregates?.Select(t => t.ToAggregate())?.ToList();//.AsEnumerable()?.ToList(); } public List GetFilters() diff --git a/PoweredSoft.CQRS.DynamicQuery.AspNetCore/DynamicQueryAggregate.cs b/PoweredSoft.CQRS.DynamicQuery.AspNetCore/DynamicQueryAggregate.cs new file mode 100644 index 0000000..f803a14 --- /dev/null +++ b/PoweredSoft.CQRS.DynamicQuery.AspNetCore/DynamicQueryAggregate.cs @@ -0,0 +1,22 @@ +using PoweredSoft.DynamicQuery; +using PoweredSoft.DynamicQuery.Core; +using System; + +namespace PoweredSoft.CQRS.DynamicQuery.AspNetCore +{ + public class DynamicQueryAggregate + { + public string Path { get; set; } + public string Type { get; set; } + + public IAggregate ToAggregate() + { + return new Aggregate + { + Type = Enum.Parse(Type), + Path = Path + }; + } + + } +} \ No newline at end of file diff --git a/PoweredSoft.CQRS.DynamicQuery.AspNetCore/DynamicQueryFilter.cs b/PoweredSoft.CQRS.DynamicQuery.AspNetCore/DynamicQueryFilter.cs index c6380ae..c5ff8fb 100644 --- a/PoweredSoft.CQRS.DynamicQuery.AspNetCore/DynamicQueryFilter.cs +++ b/PoweredSoft.CQRS.DynamicQuery.AspNetCore/DynamicQueryFilter.cs @@ -1,6 +1,7 @@ using Microsoft.AspNetCore.Mvc; using PoweredSoft.DynamicQuery; using PoweredSoft.DynamicQuery.Core; +using System; using System.Collections.Generic; using System.Linq; using System.Text.Json; @@ -11,7 +12,7 @@ namespace PoweredSoft.CQRS.DynamicQuery.AspNetCore { public List Filters { get; set; } public bool? And { get; set; } - public FilterType Type { get; set; } + public string Type { get; set; } public bool? Not { get; set; } public string Path { get; set; } public object Value { get; set; } @@ -31,7 +32,8 @@ namespace PoweredSoft.CQRS.DynamicQuery.AspNetCore public IFilter ToFilter() { - if (Type == FilterType.Composite) + var type = Enum.Parse(Type); + if (type == FilterType.Composite) { var compositeFilter = new CompositeFilter { @@ -62,7 +64,7 @@ namespace PoweredSoft.CQRS.DynamicQuery.AspNetCore var simpleFilter = new SimpleFilter { And = And, - Type = Type, + Type = type, Not = Not, Path = Path, Value = value