using PoweredSoft.CQRS.DynamicQuery.Abstractions; using PoweredSoft.CQRS.GraphQL.DynamicQuery; using PoweredSoft.DynamicQuery.Core; using System.Collections.Generic; using System.Linq; namespace PoweredSoft.CQRS.GraphQL.DynamicQuery { public class GraphQLDynamicQuery : GraphQLDynamicQuery, IDynamicQuery where TSource : class where TDestination : class { } public class GraphQLDynamicQuery : GraphQLDynamicQuery, IDynamicQuery where TSource : class where TDestination : class where TParams : class { public TParams Params { get; set; } public TParams GetParams() => Params; } public class GraphQLDynamicQuery : IDynamicQuery { public int? Page { get; set; } public int? PageSize { get; set; } public List Sorts { get; set; } public List Filters { get; set; } public List Groups { get; set; } public List Aggregates { get; set; } public List GetAggregates() { if (Aggregates == null) return new List(); return Aggregates.Select(a => a.ToAggregate()).ToList(); } public List GetFilters() { if (Filters == null) return new List(); return Filters.Select(t => t.ToFilter()).ToList(); } public List GetGroups() { if (Groups == null) return new List(); return Groups.Select(t => t.ToGroup()).ToList(); } public int? GetPage() => Page; public int? GetPageSize() => PageSize; public List GetSorts() { if (Sorts == null) return new List(); return Sorts.Select(t => t.ToSort()).ToList(); } } }