2025-11-25 02:25:35 +03:30
|
|
|
namespace FrontOffice.BFF.Application.UserWalletCQ.Queries.GetAllUserWalletChangeLog;
|
2025-12-02 03:32:50 +03:30
|
|
|
public class GetAllUserWalletChangeLogQueryValidator : AbstractValidator<GetAllUserWalletChangeLogQuery>
|
2025-11-25 02:25:35 +03:30
|
|
|
{
|
|
|
|
|
public GetAllUserWalletChangeLogQueryValidator()
|
|
|
|
|
{
|
2025-12-02 03:32:50 +03:30
|
|
|
RuleFor(x => x.ReferenceId).GreaterThan(0).When(x => x.ReferenceId.HasValue);
|
2025-11-25 02:25:35 +03:30
|
|
|
}
|
|
|
|
|
public Func<object, string, Task<IEnumerable<string>>> ValidateValue => async (model, propertyName) =>
|
|
|
|
|
{
|
2025-12-02 03:32:50 +03:30
|
|
|
var result = await ValidateAsync(ValidationContext<GetAllUserWalletChangeLogQuery>.CreateWithOptions((GetAllUserWalletChangeLogQuery)model, x => x.IncludeProperties(propertyName)));
|
2025-11-25 02:25:35 +03:30
|
|
|
if (result.IsValid)
|
|
|
|
|
return Array.Empty<string>();
|
|
|
|
|
return result.Errors.Select(e => e.ErrorMessage);
|
|
|
|
|
};
|
|
|
|
|
}
|