Generator Changes at 11/12/2025 11:18:31 PM +03:30
This commit is contained in:
+13
@@ -0,0 +1,13 @@
|
||||
namespace CMSMicroservice.Application.UserCQ.Commands.SetPasswordForUser;
|
||||
public record SetPasswordForUserCommand : IRequest<Unit>
|
||||
{
|
||||
//شناسه کاربر
|
||||
public long UserId { get; init; }
|
||||
//کلمه عبور فعلی
|
||||
public string? CurrentPassword { get; init; }
|
||||
//کلمه عبور
|
||||
public string NewPassword { get; init; }
|
||||
//تایید کلمه عبور
|
||||
public string ConfirmPassword { get; init; }
|
||||
|
||||
}
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
using CMSMicroservice.Domain.Events;
|
||||
namespace CMSMicroservice.Application.UserCQ.Commands.SetPasswordForUser;
|
||||
public class SetPasswordForUserCommandHandler : IRequestHandler<SetPasswordForUserCommand, Unit>
|
||||
{
|
||||
private readonly IApplicationDbContext _context;
|
||||
|
||||
public SetPasswordForUserCommandHandler(IApplicationDbContext context)
|
||||
{
|
||||
_context = context;
|
||||
}
|
||||
|
||||
public async Task<Unit> Handle(SetPasswordForUserCommand request, CancellationToken cancellationToken)
|
||||
{
|
||||
//TODO: Implement your business logic
|
||||
return new Unit();
|
||||
}
|
||||
}
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
namespace CMSMicroservice.Application.UserCQ.Commands.SetPasswordForUser;
|
||||
public class SetPasswordForUserCommandValidator : AbstractValidator<SetPasswordForUserCommand>
|
||||
{
|
||||
public SetPasswordForUserCommandValidator()
|
||||
{
|
||||
RuleFor(model => model.UserId)
|
||||
.NotNull();
|
||||
RuleFor(model => model.NewPassword)
|
||||
.NotEmpty();
|
||||
RuleFor(model => model.ConfirmPassword)
|
||||
.NotEmpty();
|
||||
}
|
||||
public Func<object, string, Task<IEnumerable<string>>> ValidateValue => async (model, propertyName) =>
|
||||
{
|
||||
var result = await ValidateAsync(ValidationContext<SetPasswordForUserCommand>.CreateWithOptions((SetPasswordForUserCommand)model, x => x.IncludeProperties(propertyName)));
|
||||
if (result.IsValid)
|
||||
return Array.Empty<string>();
|
||||
return result.Errors.Select(e => e.ErrorMessage);
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user