Generator Changes at 11/22/2025 9:58:16 PM +03:30
This commit is contained in:
@@ -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; }
|
||||
|
||||
}
|
||||
@@ -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) =>
|
||||
{
|
||||
|
||||
@@ -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; }
|
||||
|
||||
}
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
@@ -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);
|
||||
};
|
||||
}
|
||||
@@ -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; }
|
||||
}
|
||||
@@ -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; }
|
||||
|
||||
}
|
||||
@@ -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) =>
|
||||
{
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
using CMSMicroservice.Domain.Events;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
||||
namespace CMSMicroservice.Application.UserOrderCQ.EventHandlers;
|
||||
|
||||
public class SubmitShopBuyOrderEventHandler : INotificationHandler<SubmitShopBuyOrderEvent>
|
||||
{
|
||||
private readonly ILogger<
|
||||
SubmitShopBuyOrderEventHandler> _logger;
|
||||
|
||||
public SubmitShopBuyOrderEventHandler(ILogger<SubmitShopBuyOrderEventHandler> logger)
|
||||
{
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
public Task Handle(SubmitShopBuyOrderEvent notification, CancellationToken cancellationToken)
|
||||
{
|
||||
_logger.LogInformation("Domain Event: {DomainEvent}", notification.GetType().Name);
|
||||
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
}
|
||||
@@ -10,20 +10,22 @@ public record GetAllUserOrderByFilterQuery : IRequest<GetAllUserOrderByFilterRes
|
||||
|
||||
}public class GetAllUserOrderByFilterFilter
|
||||
{
|
||||
//شناسه
|
||||
//شناسه
|
||||
public long? Id { get; set; }
|
||||
//قیمت
|
||||
//قیمت
|
||||
public long? Price { get; set; }
|
||||
//شناسه پکیج
|
||||
//شناسه پکیج
|
||||
public long? PackageId { get; set; }
|
||||
//شناسه تراکنش
|
||||
//شناسه تراکنش
|
||||
public long? TransactionId { get; set; }
|
||||
//وضعیت پرداخت
|
||||
public int? PaymentStatus { get; set; }
|
||||
//تاریخ پرداخت
|
||||
//وضعیت پرداخت
|
||||
public PaymentStatus? PaymentStatus { get; set; }
|
||||
//تاریخ پرداخت
|
||||
public DateTime? PaymentDate { get; set; }
|
||||
//شناسه کاربر
|
||||
//شناسه کاربر
|
||||
public long? UserId { get; set; }
|
||||
//شناسه آدرس کاربر
|
||||
//شناسه آدرس کاربر
|
||||
public long? UserAddressId { get; set; }
|
||||
//
|
||||
public PaymentMethod? PaymentMethod { get; set; }
|
||||
}
|
||||
|
||||
@@ -8,20 +8,26 @@ public class GetAllUserOrderByFilterResponseDto
|
||||
|
||||
}public class GetAllUserOrderByFilterResponseModel
|
||||
{
|
||||
//شناسه
|
||||
//شناسه
|
||||
public long Id { get; set; }
|
||||
//قیمت
|
||||
//قیمت
|
||||
public long Price { get; set; }
|
||||
//شناسه پکیج
|
||||
//شناسه پکیج
|
||||
public long PackageId { get; set; }
|
||||
//شناسه تراکنش
|
||||
//شناسه تراکنش
|
||||
public long? TransactionId { get; set; }
|
||||
//وضعیت پرداخت
|
||||
public int PaymentStatus { get; set; }
|
||||
//تاریخ پرداخت
|
||||
//وضعیت پرداخت
|
||||
public PaymentStatus PaymentStatus { get; set; }
|
||||
//تاریخ پرداخت
|
||||
public DateTime? PaymentDate { get; set; }
|
||||
//شناسه کاربر
|
||||
//شناسه کاربر
|
||||
public long UserId { get; set; }
|
||||
//شناسه آدرس کاربر
|
||||
//شناسه آدرس کاربر
|
||||
public long UserAddressId { get; set; }
|
||||
//
|
||||
public PaymentMethod? PaymentMethod { get; set; }
|
||||
//
|
||||
public string? UserAddressText { get; set; }
|
||||
//
|
||||
public long? TotalAmount { get; set; }
|
||||
}
|
||||
|
||||
@@ -10,12 +10,18 @@ public class GetUserOrderResponseDto
|
||||
//شناسه تراکنش
|
||||
public long? TransactionId { get; set; }
|
||||
//وضعیت پرداخت
|
||||
public bool PaymentStatus { get; set; }
|
||||
public PaymentStatus PaymentStatus { get; set; }
|
||||
//تاریخ پرداخت
|
||||
public DateTime? PaymentDate { get; set; }
|
||||
//شناسه کاربر
|
||||
public long UserId { get; set; }
|
||||
//شناسه آدرس کاربر
|
||||
public long UserAddressId { get; set; }
|
||||
//
|
||||
public PaymentMethod? PaymentMethod { get; set; }
|
||||
//
|
||||
public long? TotalAmount { get; set; }
|
||||
//
|
||||
public string? UserAddressText { get; set; }
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user