mirror of
https://github.com/BinaryAlley/Nemera.git
synced 2026-12-03 12: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
+10
@@ -1,4 +1,5 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Lumina.Application.Common.DTO.Filtering;
|
||||
using Lumina.Application.Common.Infrastructure.Validation;
|
||||
using Lumina.Application.Common.Utilities;
|
||||
using Lumina.Domain.Common.Errors;
|
||||
@@ -22,5 +23,14 @@ public class GetBooksLiteQueryValidator : AbstractValidator<GetBooksLiteQuery>
|
||||
.WithError(Errors.Library.LibraryIdCannotBeEmpty)
|
||||
.Must(id => id != Guid.Empty)
|
||||
.WithError(Errors.Library.LibraryIdCannotBeEmpty);
|
||||
|
||||
// the alpha key must be exactly one of the three picker bucket kinds, so that the filter specification can
|
||||
// derive the key of a title unambiguously: no filter, a number bucket, a symbol bucket, or a single ASCII letter
|
||||
RuleFor(query => query.Filter.FilterAlphaKey)
|
||||
.Must(alphaKey => alphaKey is null
|
||||
|| alphaKey == LibraryItemAlphaKeys.NUMBER
|
||||
|| alphaKey == LibraryItemAlphaKeys.SYMBOL
|
||||
|| (alphaKey.Length == 1 && char.IsAsciiLetter(alphaKey[0])))
|
||||
.WithError(Errors.Library.InvalidFilterAlphaKey);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user