Make amount, user_id and address_id optional in user order update

This commit is contained in:
masoodafar-web
2025-11-28 04:02:00 +03:30
parent 84f08f11e4
commit ce2bf3f1f0
5 changed files with 22 additions and 21 deletions

View File

@@ -6,19 +6,19 @@ public record UpdateUserOrderCommand : IRequest<Unit>
//شناسه
public long Id { get; init; }
//قیمت
public long Amount { get; init; }
public long? Amount { get; init; }
//شناسه پکیج
public long? PackageId { get; init; }
//شناسه تراکنش
public long? TransactionId { get; init; }
//وضعیت پرداخت
public PaymentStatus PaymentStatus { get; init; }
public PaymentStatus? PaymentStatus { get; init; }
//تاریخ پرداخت
public DateTime? PaymentDate { get; init; }
//شناسه کاربر
public long UserId { get; init; }
public long? UserId { get; init; }
//شناسه آدرس کاربر
public long UserAddressId { get; init; }
public long? UserAddressId { get; init; }
//
public PaymentMethod? PaymentMethod { get; init; }
// وضعیت ارسال سفارش

View File

@@ -5,19 +5,19 @@ public class UpdateUserOrderCommandValidator : AbstractValidator<UpdateUserOrder
{
RuleFor(model => model.Id)
.NotNull();
RuleFor(model => model.Amount)
.NotNull();
RuleFor(model => model.PackageId)
.NotNull();
RuleFor(model => model.PaymentStatus)
.IsInEnum()
.NotNull();
RuleFor(model => model.UserId)
.NotNull();
RuleFor(model => model.UserAddressId)
.NotNull();
RuleFor(model => model.PaymentMethod)
.IsInEnum();
// RuleFor(model => model.Amount)
// .NotNull();
// RuleFor(model => model.PackageId)
// .NotNull();
// RuleFor(model => model.PaymentStatus)
// .IsInEnum()
// .NotNull();
// RuleFor(model => model.UserId)
// .NotNull();
// RuleFor(model => model.UserAddressId)
// .NotNull();
// RuleFor(model => model.PaymentMethod)
// .IsInEnum();
}
public Func<object, string, Task<IEnumerable<string>>> ValidateValue => async (model, propertyName) =>
{