f0f48118e7
- Implemented Create, Delete, Get, and Update validators for Product Galleries. - Added Create, Delete, Get, and Update validators for Product Tags. - Created service classes for handling Discount Categories, Discount Orders, Discount Products, Discount Shopping Cart, Product Categories, Product Galleries, and Product Tags. - Each service class integrates with CQRS for command and query handling. - Established mapping profiles for Product Galleries.
35 lines
1.3 KiB
C#
35 lines
1.3 KiB
C#
using FluentValidation;
|
|
|
|
namespace CMSMicroservice.Application.ManualPaymentCQ.Commands.CreateManualPayment;
|
|
|
|
public class CreateManualPaymentCommandValidator : AbstractValidator<CreateManualPaymentCommand>
|
|
{
|
|
public CreateManualPaymentCommandValidator()
|
|
{
|
|
RuleFor(x => x.UserId)
|
|
.GreaterThan(0)
|
|
.WithMessage("شناسه کاربر باید بزرگتر از صفر باشد");
|
|
|
|
RuleFor(x => x.Amount)
|
|
.GreaterThan(0)
|
|
.WithMessage("مبلغ باید بزرگتر از صفر باشد")
|
|
.LessThanOrEqualTo(1_000_000_000)
|
|
.WithMessage("مبلغ نمیتواند بیشتر از 1 میلیارد ریال باشد");
|
|
|
|
RuleFor(x => x.Type)
|
|
.IsInEnum()
|
|
.WithMessage("نوع تراکنش نامعتبر است");
|
|
|
|
RuleFor(x => x.Description)
|
|
.NotEmpty()
|
|
.WithMessage("توضیحات الزامی است")
|
|
.MaximumLength(1000)
|
|
.WithMessage("توضیحات نمیتواند بیشتر از 1000 کاراکتر باشد");
|
|
|
|
RuleFor(x => x.ReferenceNumber)
|
|
.MaximumLength(100)
|
|
.WithMessage("شماره مرجع نمیتواند بیشتر از 100 کاراکتر باشد")
|
|
.When(x => !string.IsNullOrEmpty(x.ReferenceNumber));
|
|
}
|
|
}
|