2018-02-10 06:37:04 +01:00
|
|
|
|
using Microsoft.Extensions.Options;
|
|
|
|
|
using Sieve.Models;
|
|
|
|
|
using Sieve.Services;
|
|
|
|
|
using SieveUnitTests.Entities;
|
|
|
|
|
|
|
|
|
|
namespace SieveUnitTests.Services
|
|
|
|
|
{
|
2018-05-15 01:34:37 +02:00
|
|
|
|
public class ApplicationSieveProcessor : SieveProcessor
|
2018-02-10 06:37:04 +01:00
|
|
|
|
{
|
2018-02-10 07:10:50 +01:00
|
|
|
|
public ApplicationSieveProcessor(
|
2018-05-15 01:34:37 +02:00
|
|
|
|
IOptions<SieveOptions> options,
|
|
|
|
|
ISieveCustomSortMethods customSortMethods,
|
|
|
|
|
ISieveCustomFilterMethods customFilterMethods)
|
2018-02-10 07:10:50 +01:00
|
|
|
|
: base(options, customSortMethods, customFilterMethods)
|
2018-02-10 06:37:04 +01:00
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override SievePropertyMapper MapProperties(SievePropertyMapper mapper)
|
|
|
|
|
{
|
|
|
|
|
mapper.Property<Post>(p => p.ThisHasNoAttributeButIsAccessible)
|
|
|
|
|
.CanSort()
|
|
|
|
|
.CanFilter()
|
|
|
|
|
.HasName("shortname");
|
|
|
|
|
|
2019-01-18 11:45:38 +01:00
|
|
|
|
mapper.Property<Post>(p => p.TopComment.Text)
|
|
|
|
|
.CanFilter();
|
|
|
|
|
|
|
|
|
|
mapper.Property<Post>(p => p.TopComment.Id)
|
|
|
|
|
.CanSort();
|
|
|
|
|
|
2018-02-10 06:37:04 +01:00
|
|
|
|
mapper.Property<Post>(p => p.OnlySortableViaFluentApi)
|
|
|
|
|
.CanSort();
|
|
|
|
|
|
2019-02-03 17:10:34 +01:00
|
|
|
|
mapper.Property<Comment>(c => c.AuthorFirstName.Value)
|
|
|
|
|
.CanFilter()
|
|
|
|
|
.HasName("firstName");
|
|
|
|
|
|
|
|
|
|
mapper.Property<Comment>(c => c.AuthorLastName.Value)
|
|
|
|
|
.CanFilter()
|
|
|
|
|
.HasName("lastName");
|
|
|
|
|
|
2018-02-10 06:37:04 +01:00
|
|
|
|
return mapper;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|