mirror of
https://github.com/BinaryAlley/Nemera.git
synced 2026-12-03 10:11:10 +00:00
Merge pull request #22 from BinaryAlley/feature/add-thumbnails-query-validator
Adds thumbnails query validator
This commit is contained in:
2 files changed
+26
-2
No files matched your search
+23
@@ -0,0 +1,23 @@
|
|||||||
|
#region ========================================================================= USING =====================================================================================
|
||||||
|
using FluentValidation;
|
||||||
|
using Lumina.Domain.Common.Errors;
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
namespace Lumina.Application.Core.FileManagement.Thumbnails.Queries.GetThumbnail;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Validates the needed validation rules for <see cref="GetThumbnailQuery"/>.
|
||||||
|
/// </summary>
|
||||||
|
public class GetThumbnailQueryValidator : AbstractValidator<GetThumbnailQuery>
|
||||||
|
{
|
||||||
|
#region ====================================================================== CTOR =====================================================================================
|
||||||
|
/// <summary>
|
||||||
|
/// Initializes a new instance of the <see cref="GetThumbnailQueryValidator"/> class.
|
||||||
|
/// </summary>
|
||||||
|
public GetThumbnailQueryValidator()
|
||||||
|
{
|
||||||
|
RuleFor(x => x.Path).NotEmpty().WithMessage(Errors.FileManagement.PathCannotBeEmpty.Code);
|
||||||
|
RuleFor(x => x.Quality).InclusiveBetween(0, 100).WithMessage(Errors.Thumbnails.ImageQaulityMustBeBetweenZeroAndOneHundred.Code);
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
#region ========================================================================= USING =====================================================================================
|
#region ========================================================================= USING =====================================================================================
|
||||||
using ErrorOr;
|
using ErrorOr;
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
@@ -13,6 +13,7 @@ public static partial class Errors
|
|||||||
{
|
{
|
||||||
#region ==================================================================== PROPERTIES =================================================================================
|
#region ==================================================================== PROPERTIES =================================================================================
|
||||||
public static Error NoThumbnail => Error.Failure(nameof(NoThumbnail));
|
public static Error NoThumbnail => Error.Failure(nameof(NoThumbnail));
|
||||||
|
public static Error ImageQaulityMustBeBetweenZeroAndOneHundred => Error.Validation(nameof(ImageQaulityMustBeBetweenZeroAndOneHundred));
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user