Generator Changes at 9/27/2025 11:07:17 PM

This commit is contained in:
MeysamMoghaddam
2025-09-27 23:48:41 +03:30
parent 447e580a8a
commit a1b6e28d35
45 changed files with 1320 additions and 18 deletions

View File

@@ -1,4 +1,5 @@
using CMSMicroservice.Domain.Events;
using CMSMicroservice.Domain.Events;
using System.Security.Cryptography;
namespace CMSMicroservice.Application.UserCQ.Commands.CreateNewUser;
public class CreateNewUserCommandHandler : IRequestHandler<CreateNewUserCommand, CreateNewUserResponseDto>
{
@@ -13,6 +14,8 @@ public class CreateNewUserCommandHandler : IRequestHandler<CreateNewUserCommand,
CancellationToken cancellationToken)
{
var entity = request.Adapt<User>();
entity.ReferralCode = UtilExtensions.Generate(digits: 10, firstDigitNonZero: true);
await _context.Users.AddAsync(entity, cancellationToken);
entity.AddDomainEvent(new CreateNewUserEvent(entity));
await _context.SaveChangesAsync(cancellationToken);

View File

@@ -7,13 +7,9 @@ public record UpdateUserCommand : IRequest<Unit>
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

@@ -5,8 +5,6 @@ public class UpdateUserCommandValidator : AbstractValidator<UpdateUserCommand>
{
RuleFor(model => model.Id)
.NotNull();
RuleFor(model => model.Mobile)
.NotEmpty();
}
public Func<object, string, Task<IEnumerable<string>>> ValidateValue => async (model, propertyName) =>
{