mirror of
https://github.com/BinaryAlley/Nemera.git
synced 2026-12-03 18:21:10 +00:00
Adds pagination and filtering to the API
This commit is contained in:
1 parent
ad984910a2
commit
ce4ebf36bc
59 files changed
+4423
-242
No files matched your search
+25
@@ -0,0 +1,25 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Lumina.Application.Common.Specifications;
|
||||
using System;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq.Expressions;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Application.Fixtures.Common.Specifications;
|
||||
|
||||
/// <summary>
|
||||
/// Fixture class for generating a <see cref="FilterSpecification{T}"/> instance that is never satisfied, regardless of the entity being evaluated.
|
||||
/// </summary>
|
||||
/// <typeparam name="T">The type of entity to which the specification applies.</typeparam>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public sealed class AlwaysFalseFilterSpecificationFixture<T> : FilterSpecification<T>
|
||||
{
|
||||
/// <summary>
|
||||
/// Creates a LINQ expression that always evaluates to <see langword="false"/>.
|
||||
/// </summary>
|
||||
/// <returns>An expression tree that always evaluates to <see langword="false"/>.</returns>
|
||||
public override Expression<Func<T, bool>> ToExpression()
|
||||
{
|
||||
return entity => false;
|
||||
}
|
||||
}
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Lumina.Application.Common.Specifications;
|
||||
using System;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq.Expressions;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Application.Fixtures.Common.Specifications;
|
||||
|
||||
/// <summary>
|
||||
/// Fixture class for generating a <see cref="FilterSpecification{T}"/> instance that is always satisfied, regardless of the entity being evaluated.
|
||||
/// </summary>
|
||||
/// <typeparam name="T">The type of entity to which the specification applies.</typeparam>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public sealed class AlwaysTrueFilterSpecificationFixture<T> : FilterSpecification<T>
|
||||
{
|
||||
/// <summary>
|
||||
/// Creates a LINQ expression that always evaluates to <see langword="true"/>.
|
||||
/// </summary>
|
||||
/// <returns>An expression tree that always evaluates to <see langword="true"/>.</returns>
|
||||
public override Expression<Func<T, bool>> ToExpression()
|
||||
{
|
||||
return entity => true;
|
||||
}
|
||||
}
|
||||
+36
@@ -0,0 +1,36 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Lumina.Application.Common.Specifications;
|
||||
using System;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq.Expressions;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Application.Fixtures.Common.Specifications;
|
||||
|
||||
/// <summary>
|
||||
/// Fixture class for generating a <see cref="FilterSpecification{T}"/> instance that is satisfied when an integer value exceeds a configured threshold.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public sealed class GreaterThanFilterSpecificationFixture : FilterSpecification<int>
|
||||
{
|
||||
private readonly int _threshold;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="GreaterThanFilterSpecificationFixture"/> class.
|
||||
/// </summary>
|
||||
/// <param name="threshold">The threshold value that an entity must exceed to satisfy the specification.</param>
|
||||
public GreaterThanFilterSpecificationFixture(int threshold)
|
||||
{
|
||||
_threshold = threshold;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a LINQ expression that evaluates whether a value is greater than the configured threshold.
|
||||
/// </summary>
|
||||
/// <returns>An expression tree that evaluates to <see langword="true"/> when the value exceeds the threshold.</returns>
|
||||
public override Expression<Func<int, bool>> ToExpression()
|
||||
{
|
||||
int threshold = _threshold;
|
||||
return value => value > threshold;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user