public User(string email, HashedPassword hashedPassword, Role role) { ValidateEmail(email); Email = email; HashedPassword = hashedPassword ?? throw new IdentityDomainException($"'{nameof(hashedPassword)}' cannot be null"); Role = role ?? throw new IdentityDomainException($"'{nameof(hashedPassword)}' cannot be null"); CreatedAt = DateTime.UtcNow; UpdatedAt = DateTime.UtcNow; }
public void SetPassword(HashedPassword newPassword) { HashedPassword = newPassword ?? throw new ArgumentNullException(nameof(newPassword)); UpdatedAt = DateTime.UtcNow; }