Generator Changes at 11/22/2025 9:58:16 PM +03:30

This commit is contained in:
masoodafar-web
2025-11-22 22:02:04 +03:30
parent fb9d2f6a9c
commit 56478c79c2
22 changed files with 281 additions and 31 deletions

View File

@@ -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; }
}

View File

@@ -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();
}
}

View File

@@ -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);
};
}

View File

@@ -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; }
}