- Add nullable annotations across discovery interfaces, dynamic query models, and filter/aggregate types to eliminate CS8600-series warnings - Replace unsafe cast in DynamicQueryHandlerBase with pattern match - Add CI workflow (build --warnaserror + test on JP branch) - Add weekly security vulnerability scan workflow - Extend .gitignore with secret/credential patterns (.env, *.key, secrets/, credentials.json) Co-Authored-By: Svrnty Inc. <eng@svrnty.com>
69 lines
1.6 KiB
C#
69 lines
1.6 KiB
C#
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using Svrnty.CQRS.DynamicQuery.Abstractions;
|
|
using PoweredSoft.DynamicQuery;
|
|
using PoweredSoft.DynamicQuery.Core;
|
|
|
|
namespace Svrnty.CQRS.DynamicQuery;
|
|
|
|
public class DynamicQuery<TSource, TDestination> : DynamicQuery, IDynamicQuery<TSource, TDestination>
|
|
where TSource : class
|
|
where TDestination : class
|
|
{
|
|
|
|
}
|
|
|
|
public class DynamicQuery<TSource, TDestination, TParams> : DynamicQuery, IDynamicQuery<TSource, TDestination, TParams>
|
|
where TSource : class
|
|
where TDestination : class
|
|
where TParams : class
|
|
{
|
|
public TParams? Params { get; set; }
|
|
|
|
public TParams? GetParams()
|
|
{
|
|
return Params;
|
|
}
|
|
}
|
|
|
|
public class DynamicQuery : IDynamicQuery
|
|
{
|
|
public int? Page { get; set; }
|
|
public int? PageSize { get; set; }
|
|
public List<Sort>? Sorts { get; set; }
|
|
public List<DynamicQueryAggregate>? Aggregates { get; set; }
|
|
public List<Group>? Groups { get; set; }
|
|
public List<DynamicQueryFilter>? Filters { get; set; }
|
|
|
|
|
|
public List<IAggregate>? GetAggregates()
|
|
{
|
|
return Aggregates?.Select(t => t.ToAggregate())?.ToList();
|
|
}
|
|
|
|
public List<IFilter>? GetFilters()
|
|
{
|
|
return Filters?.Select(t => t.ToFilter())?.ToList();
|
|
}
|
|
|
|
public List<IGroup>? GetGroups()
|
|
{
|
|
return this.Groups?.AsEnumerable<IGroup>()?.ToList();
|
|
}
|
|
|
|
public int? GetPage()
|
|
{
|
|
return this.Page;
|
|
}
|
|
|
|
public int? GetPageSize()
|
|
{
|
|
return this.PageSize;
|
|
}
|
|
|
|
public List<ISort>? GetSorts()
|
|
{
|
|
return this.Sorts?.AsEnumerable<ISort>()?.ToList();
|
|
}
|
|
}
|