Generator Changes at 11/22/2025 9:58:16 PM +03:30
This commit is contained in:
+3
-1
@@ -8,12 +8,14 @@ public record CreateNewUserOrderCommand : IRequest<CreateNewUserOrderResponseDto
|
||||
//شناسه تراکنش
|
||||
public long? TransactionId { get; init; }
|
||||
//وضعیت پرداخت
|
||||
public bool PaymentStatus { get; init; }
|
||||
public PaymentStatus PaymentStatus { get; init; }
|
||||
//تاریخ پرداخت
|
||||
public DateTime? PaymentDate { get; init; }
|
||||
//شناسه کاربر
|
||||
public long UserId { get; init; }
|
||||
//شناسه آدرس کاربر
|
||||
public long UserAddressId { get; init; }
|
||||
//
|
||||
public PaymentMethod? PaymentMethod { get; init; }
|
||||
|
||||
}
|
||||
+3
@@ -8,11 +8,14 @@ public class CreateNewUserOrderCommandValidator : AbstractValidator<CreateNewUse
|
||||
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) =>
|
||||
{
|
||||
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
namespace CMSMicroservice.Application.UserOrderCQ.Commands.SubmitShopBuyOrder;
|
||||
public record SubmitShopBuyOrderCommand : IRequest<SubmitShopBuyOrderResponseDto>
|
||||
{
|
||||
//کل مبلغ ورودی
|
||||
public long TotalAmount { get; init; }
|
||||
//شناسه کاربر
|
||||
public long UserId { get; init; }
|
||||
|
||||
}
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
using CMSMicroservice.Domain.Events;
|
||||
namespace CMSMicroservice.Application.UserOrderCQ.Commands.SubmitShopBuyOrder;
|
||||
public class SubmitShopBuyOrderCommandHandler : IRequestHandler<SubmitShopBuyOrderCommand, SubmitShopBuyOrderResponseDto>
|
||||
{
|
||||
private readonly IApplicationDbContext _context;
|
||||
|
||||
public SubmitShopBuyOrderCommandHandler(IApplicationDbContext context)
|
||||
{
|
||||
_context = context;
|
||||
}
|
||||
|
||||
public async Task<SubmitShopBuyOrderResponseDto> Handle(SubmitShopBuyOrderCommand request, CancellationToken cancellationToken)
|
||||
{
|
||||
//TODO: Implement your business logic
|
||||
return new SubmitShopBuyOrderResponseDto();
|
||||
}
|
||||
}
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
namespace CMSMicroservice.Application.UserOrderCQ.Commands.SubmitShopBuyOrder;
|
||||
public class SubmitShopBuyOrderCommandValidator : AbstractValidator<SubmitShopBuyOrderCommand>
|
||||
{
|
||||
public SubmitShopBuyOrderCommandValidator()
|
||||
{
|
||||
RuleFor(model => model.TotalAmount)
|
||||
.NotNull();
|
||||
RuleFor(model => model.UserId)
|
||||
.NotNull();
|
||||
}
|
||||
public Func<object, string, Task<IEnumerable<string>>> ValidateValue => async (model, propertyName) =>
|
||||
{
|
||||
var result = await ValidateAsync(ValidationContext<SubmitShopBuyOrderCommand>.CreateWithOptions((SubmitShopBuyOrderCommand)model, x => x.IncludeProperties(propertyName)));
|
||||
if (result.IsValid)
|
||||
return Array.Empty<string>();
|
||||
return result.Errors.Select(e => e.ErrorMessage);
|
||||
};
|
||||
}
|
||||
+33
@@ -0,0 +1,33 @@
|
||||
namespace CMSMicroservice.Application.UserOrderCQ.Commands.SubmitShopBuyOrder;
|
||||
public class SubmitShopBuyOrderResponseDto
|
||||
{
|
||||
//شناسه
|
||||
public long Id { get; set; }
|
||||
//
|
||||
public PaymentStatus PaymentStatus { get; set; }
|
||||
//
|
||||
public DateTime? Created { get; set; }
|
||||
//
|
||||
public PaymentMethod? PaymentMethod { get; set; }
|
||||
//
|
||||
public string? UserAddressText { get; set; }
|
||||
//
|
||||
public long? TotalAmount { get; set; }
|
||||
//
|
||||
public List<SubmitShopBuyOrderFactorDetail>? FactorDetails { get; set; }
|
||||
|
||||
}public class SubmitShopBuyOrderFactorDetail
|
||||
{
|
||||
//شناسه
|
||||
public long ProductId { get; set; }
|
||||
//
|
||||
public string ProductTitle { get; set; }
|
||||
//
|
||||
public string? ProductThumbnailPath { get; set; }
|
||||
//
|
||||
public long? UnitPrice { get; set; }
|
||||
//
|
||||
public int? Count { get; set; }
|
||||
//
|
||||
public long? UnitDiscountPrice { get; set; }
|
||||
}
|
||||
+3
-1
@@ -10,12 +10,14 @@ public record UpdateUserOrderCommand : IRequest<Unit>
|
||||
//شناسه تراکنش
|
||||
public long? TransactionId { get; init; }
|
||||
//وضعیت پرداخت
|
||||
public bool PaymentStatus { get; init; }
|
||||
public PaymentStatus PaymentStatus { get; init; }
|
||||
//تاریخ پرداخت
|
||||
public DateTime? PaymentDate { get; init; }
|
||||
//شناسه کاربر
|
||||
public long UserId { get; init; }
|
||||
//شناسه آدرس کاربر
|
||||
public long UserAddressId { get; init; }
|
||||
//
|
||||
public PaymentMethod? PaymentMethod { get; init; }
|
||||
|
||||
}
|
||||
+3
@@ -10,11 +10,14 @@ public class UpdateUserOrderCommandValidator : AbstractValidator<UpdateUserOrder
|
||||
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) =>
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user