This commit is contained in:
King
2025-09-28 15:24:13 +03:30
parent 514b3a5975
commit 4241523443
222 changed files with 8139 additions and 0 deletions

View File

@@ -0,0 +1,17 @@
namespace BackOffice.BFF.Application.UserOrderCQ.Commands.CreateNewUserOrder;
public record CreateNewUserOrderCommand : IRequest<CreateNewUserOrderResponseDto>
{
//قیمت
public long Price { get; init; }
//شناسه پکیج
public long PackageId { get; init; }
//شناسه تراکنش
public long? TransactionId { get; init; }
//وضعیت پرداخت
public bool PaymentStatus { get; init; }
//تاریخ پرداخت
public DateTime? PaymentDate { get; init; }
//شناسه کاربر
public long UserId { get; init; }
}

View File

@@ -0,0 +1,16 @@
namespace BackOffice.BFF.Application.UserOrderCQ.Commands.CreateNewUserOrder;
public class CreateNewUserOrderCommandHandler : IRequestHandler<CreateNewUserOrderCommand, CreateNewUserOrderResponseDto>
{
private readonly IApplicationContractContext _context;
public CreateNewUserOrderCommandHandler(IApplicationContractContext context)
{
_context = context;
}
public async Task<CreateNewUserOrderResponseDto> Handle(CreateNewUserOrderCommand request, CancellationToken cancellationToken)
{
//TODO: Implement your business logic
return new CreateNewUserOrderResponseDto();
}
}

View File

@@ -0,0 +1,22 @@
namespace BackOffice.BFF.Application.UserOrderCQ.Commands.CreateNewUserOrder;
public class CreateNewUserOrderCommandValidator : AbstractValidator<CreateNewUserOrderCommand>
{
public CreateNewUserOrderCommandValidator()
{
RuleFor(model => model.Price)
.NotNull();
RuleFor(model => model.PackageId)
.NotNull();
RuleFor(model => model.PaymentStatus)
.NotNull();
RuleFor(model => model.UserId)
.NotNull();
}
public Func<object, string, Task<IEnumerable<string>>> ValidateValue => async (model, propertyName) =>
{
var result = await ValidateAsync(ValidationContext<CreateNewUserOrderCommand>.CreateWithOptions((CreateNewUserOrderCommand)model, x => x.IncludeProperties(propertyName)));
if (result.IsValid)
return Array.Empty<string>();
return result.Errors.Select(e => e.ErrorMessage);
};
}

View File

@@ -0,0 +1,7 @@
namespace BackOffice.BFF.Application.UserOrderCQ.Commands.CreateNewUserOrder;
public class CreateNewUserOrderResponseDto
{
//شناسه
public long Id { get; set; }
}

View File

@@ -0,0 +1,7 @@
namespace BackOffice.BFF.Application.UserOrderCQ.Commands.DeleteUserOrder;
public record DeleteUserOrderCommand : IRequest<Unit>
{
//شناسه
public long Id { get; init; }
}

View File

@@ -0,0 +1,16 @@
namespace BackOffice.BFF.Application.UserOrderCQ.Commands.DeleteUserOrder;
public class DeleteUserOrderCommandHandler : IRequestHandler<DeleteUserOrderCommand, Unit>
{
private readonly IApplicationContractContext _context;
public DeleteUserOrderCommandHandler(IApplicationContractContext context)
{
_context = context;
}
public async Task<Unit> Handle(DeleteUserOrderCommand request, CancellationToken cancellationToken)
{
//TODO: Implement your business logic
return new Unit();
}
}

View File

@@ -0,0 +1,16 @@
namespace BackOffice.BFF.Application.UserOrderCQ.Commands.DeleteUserOrder;
public class DeleteUserOrderCommandValidator : AbstractValidator<DeleteUserOrderCommand>
{
public DeleteUserOrderCommandValidator()
{
RuleFor(model => model.Id)
.NotNull();
}
public Func<object, string, Task<IEnumerable<string>>> ValidateValue => async (model, propertyName) =>
{
var result = await ValidateAsync(ValidationContext<DeleteUserOrderCommand>.CreateWithOptions((DeleteUserOrderCommand)model, x => x.IncludeProperties(propertyName)));
if (result.IsValid)
return Array.Empty<string>();
return result.Errors.Select(e => e.ErrorMessage);
};
}

View File

@@ -0,0 +1,19 @@
namespace BackOffice.BFF.Application.UserOrderCQ.Commands.UpdateUserOrder;
public record UpdateUserOrderCommand : IRequest<Unit>
{
//شناسه
public long Id { get; init; }
//قیمت
public long Price { get; init; }
//شناسه پکیج
public long PackageId { get; init; }
//شناسه تراکنش
public long? TransactionId { get; init; }
//وضعیت پرداخت
public bool PaymentStatus { get; init; }
//تاریخ پرداخت
public DateTime? PaymentDate { get; init; }
//شناسه کاربر
public long UserId { get; init; }
}

View File

@@ -0,0 +1,16 @@
namespace BackOffice.BFF.Application.UserOrderCQ.Commands.UpdateUserOrder;
public class UpdateUserOrderCommandHandler : IRequestHandler<UpdateUserOrderCommand, Unit>
{
private readonly IApplicationContractContext _context;
public UpdateUserOrderCommandHandler(IApplicationContractContext context)
{
_context = context;
}
public async Task<Unit> Handle(UpdateUserOrderCommand request, CancellationToken cancellationToken)
{
//TODO: Implement your business logic
return new Unit();
}
}

View File

@@ -0,0 +1,24 @@
namespace BackOffice.BFF.Application.UserOrderCQ.Commands.UpdateUserOrder;
public class UpdateUserOrderCommandValidator : AbstractValidator<UpdateUserOrderCommand>
{
public UpdateUserOrderCommandValidator()
{
RuleFor(model => model.Id)
.NotNull();
RuleFor(model => model.Price)
.NotNull();
RuleFor(model => model.PackageId)
.NotNull();
RuleFor(model => model.PaymentStatus)
.NotNull();
RuleFor(model => model.UserId)
.NotNull();
}
public Func<object, string, Task<IEnumerable<string>>> ValidateValue => async (model, propertyName) =>
{
var result = await ValidateAsync(ValidationContext<UpdateUserOrderCommand>.CreateWithOptions((UpdateUserOrderCommand)model, x => x.IncludeProperties(propertyName)));
if (result.IsValid)
return Array.Empty<string>();
return result.Errors.Select(e => e.ErrorMessage);
};
}