mirror of
https://github.com/BinaryAlley/Nemera.git
synced 2026-12-03 11:11: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
@@ -0,0 +1,12 @@
|
||||
namespace Lumina.Contracts.DTO.Common.Filtering;
|
||||
|
||||
/// <summary>
|
||||
/// Data transfer object that defines common filter properties used when quering paginated data. Implementations may add additional properties specific to their module or domain.
|
||||
/// </summary>
|
||||
public record BaseFilterDto
|
||||
{
|
||||
/// <summary>
|
||||
/// The search term used to filter results.
|
||||
/// </summary>
|
||||
public string? SearchTerm { get; init; }
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using System;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Contracts.DTO.Common.Filtering;
|
||||
|
||||
/// <summary>
|
||||
/// Data transfer object that represents the parameters required to filter by library data.
|
||||
/// </summary>
|
||||
public record LibraryFilterDto : BaseFilterDto
|
||||
{
|
||||
/// <summary>
|
||||
/// The Id of the media library used to filter data.
|
||||
/// </summary>
|
||||
public required Guid LibraryId { get; init; }
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using System;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Contracts.DTO.Common.Pagination;
|
||||
|
||||
/// <summary>
|
||||
/// Data transfer object for pagination metadata.
|
||||
/// </summary>
|
||||
public sealed record PaginationDataDto
|
||||
{
|
||||
private int perPage = 200;
|
||||
private int currentPage = 1;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the current page number in a paginated collection.
|
||||
/// </summary>
|
||||
public int CurrentPage
|
||||
{
|
||||
get { return currentPage; }
|
||||
set
|
||||
{
|
||||
currentPage = Math.Max(value, 1);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the number of items to include per page in paginated results.
|
||||
/// </summary>
|
||||
public int PerPage
|
||||
{
|
||||
get { return perPage; }
|
||||
set
|
||||
{
|
||||
perPage = Math.Max(value, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user