This commit is contained in:
MeysamMoghaddam
2025-09-28 00:45:26 +03:30
parent 314e2ab425
commit c8924255ac
69 changed files with 398 additions and 1213 deletions

View File

@@ -1,16 +1,22 @@
using CMSMicroservice.Protobuf.Protos.OtpToken;
namespace FrontOffice.BFF.Application.UserCQ.Commands.CreateNewOtpToken;
public class CreateNewOtpTokenCommandHandler : IRequestHandler<CreateNewOtpTokenCommand, CreateNewOtpTokenResponseDto>
{
private readonly IApplicationContractContext _context;
private readonly IKavenegarService _kavenegarService;
public CreateNewOtpTokenCommandHandler(IApplicationContractContext context)
public CreateNewOtpTokenCommandHandler(IApplicationContractContext context, IKavenegarService kavenegarService)
{
_context = context;
_kavenegarService = kavenegarService;
}
public async Task<CreateNewOtpTokenResponseDto> Handle(CreateNewOtpTokenCommand request, CancellationToken cancellationToken)
{
//TODO: Implement your business logic
return new CreateNewOtpTokenResponseDto();
var response = await _context.OtpToken.CreateNewOtpTokenAsync(request: request.Adapt<CreateNewOtpTokenRequest>(), cancellationToken: cancellationToken);
if (response.Success && !string.IsNullOrWhiteSpace(response.Code))
await _kavenegarService.VerifyLookup(mobile: request.Mobile, response.Code);
return response.Adapt<CreateNewOtpTokenResponseDto>();
}
}

View File

@@ -1,17 +0,0 @@
namespace FrontOffice.BFF.Application.UserCQ.Commands.CreateNewUser;
public record CreateNewUserCommand : IRequest<CreateNewUserResponseDto>
{
//نام
public string? FirstName { get; init; }
//نام خانوادگی
public string? LastName { get; init; }
//شماره موبایل
public string Mobile { get; init; }
//کد ملی
public string? NationalCode { get; init; }
//آدرس آواتار
public string? AvatarPath { get; init; }
//شناسه والد
public long? ParentId { get; init; }
}

View File

@@ -1,16 +0,0 @@
namespace FrontOffice.BFF.Application.UserCQ.Commands.CreateNewUser;
public class CreateNewUserCommandHandler : IRequestHandler<CreateNewUserCommand, CreateNewUserResponseDto>
{
private readonly IApplicationContractContext _context;
public CreateNewUserCommandHandler(IApplicationContractContext context)
{
_context = context;
}
public async Task<CreateNewUserResponseDto> Handle(CreateNewUserCommand request, CancellationToken cancellationToken)
{
//TODO: Implement your business logic
return new CreateNewUserResponseDto();
}
}

View File

@@ -1,16 +0,0 @@
namespace FrontOffice.BFF.Application.UserCQ.Commands.CreateNewUser;
public class CreateNewUserCommandValidator : AbstractValidator<CreateNewUserCommand>
{
public CreateNewUserCommandValidator()
{
RuleFor(model => model.Mobile)
.NotEmpty();
}
public Func<object, string, Task<IEnumerable<string>>> ValidateValue => async (model, propertyName) =>
{
var result = await ValidateAsync(ValidationContext<CreateNewUserCommand>.CreateWithOptions((CreateNewUserCommand)model, x => x.IncludeProperties(propertyName)));
if (result.IsValid)
return Array.Empty<string>();
return result.Errors.Select(e => e.ErrorMessage);
};
}

View File

@@ -1,7 +0,0 @@
namespace FrontOffice.BFF.Application.UserCQ.Commands.CreateNewUser;
public class CreateNewUserResponseDto
{
//شناسه
public long Id { get; set; }
}