Merge branch 'newmain'

This commit is contained in:
masoodafar-web
2025-11-21 10:27:20 +03:30
parent a32de7ebc7
commit cd7b9e4ad2
7 changed files with 149 additions and 23 deletions

View File

@@ -0,0 +1,7 @@
namespace FrontOffice.BFF.Application.UserOrderCQ.Commands.SubmitShopBuyOrder;
public record SubmitShopBuyOrderCommand : IRequest<SubmitShopBuyOrderResponseDto>
{
//کل مبلغ قابل پرداخت
public long TotalAmount { get; init; }
}

View File

@@ -0,0 +1,16 @@
namespace FrontOffice.BFF.Application.UserOrderCQ.Commands.SubmitShopBuyOrder;
public class SubmitShopBuyOrderCommandHandler : IRequestHandler<SubmitShopBuyOrderCommand, SubmitShopBuyOrderResponseDto>
{
private readonly IApplicationContractContext _context;
public SubmitShopBuyOrderCommandHandler(IApplicationContractContext 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,16 @@
namespace FrontOffice.BFF.Application.UserOrderCQ.Commands.SubmitShopBuyOrder;
public class SubmitShopBuyOrderCommandValidator : AbstractValidator<SubmitShopBuyOrderCommand>
{
public SubmitShopBuyOrderCommandValidator()
{
RuleFor(model => model.TotalAmount)
.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 FrontOffice.BFF.Application.UserOrderCQ.Commands.SubmitShopBuyOrder;
public class SubmitShopBuyOrderResponseDto
{
//شناسه
public long OrderId { get; set; }
//
public string PaymentStatus { get; set; }
//
public DateTime? Created { get; set; }
//
public string? 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; }
}