mirror of
https://github.com/BinaryAlley/Nemera.git
synced 2026-12-03 14:11:10 +00:00
Adds alpha picker filtering to the books lite query
This commit is contained in:
1 parent
e72625de7c
commit
6fa154a2e7
12 files changed
+376
-10
No files matched your search
@@ -13,4 +13,17 @@ public record LibraryFilterDto : BaseFilterDto
|
||||
/// The Id of the media library used to filter data.
|
||||
/// </summary>
|
||||
public required Guid LibraryId { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// The alpha key used to filter the data by the first character of the item title, for the alpha picker.
|
||||
/// Can be <see langword="null"/> to disable alpha filtering, a single ASCII letter (case-insensitive) to filter by that letter,
|
||||
/// <see cref="LibraryItemAlphaKeys.NUMBER"/> to filter by titles whose first character is a digit,
|
||||
/// or <see cref="LibraryItemAlphaKeys.SYMBOL"/> to filter by titles whose first character is neither a letter nor a digit.
|
||||
/// </summary>
|
||||
public string? FilterAlphaKey { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Whether the leading "The " prefix of a title should be ignored when computing the alpha key, or not.
|
||||
/// </summary>
|
||||
public bool IgnoreThePrefixForAlphaPicker { get; init; }
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Application.Common.DTO.Filtering;
|
||||
|
||||
/// <summary>
|
||||
/// Collection of the special alpha keys that can be used for alpha filtering, in addition to the single letters.
|
||||
/// </summary>
|
||||
public static class LibraryItemAlphaKeys
|
||||
{
|
||||
/// <summary>
|
||||
/// The alpha key that filters the items by titles whose first character is a digit.
|
||||
/// </summary>
|
||||
public const string NUMBER = "#";
|
||||
|
||||
/// <summary>
|
||||
/// The alpha key that filters the items by titles whose first character is neither a letter nor a digit.
|
||||
/// </summary>
|
||||
public const string SYMBOL = "*";
|
||||
}
|
||||
+3
-1
@@ -30,7 +30,9 @@ public static class GetBooksLiteRequestMapping
|
||||
LibraryFilterDto libraryFilter = new()
|
||||
{
|
||||
LibraryId = request.LibraryId,
|
||||
SearchTerm = request.SearchTerm
|
||||
SearchTerm = request.SearchTerm,
|
||||
FilterAlphaKey = request.FilterAlphaKey,
|
||||
IgnoreThePrefixForAlphaPicker = request.IgnoreThePrefixForAlphaPicker
|
||||
};
|
||||
|
||||
return new GetBooksLiteQuery(paginationData, libraryFilter, request.SortBy, request.SortOrder);
|
||||
|
||||
Reference in new issue
Block a user