fix: sonarqube code smell
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Ardalis.Result;
|
||||
@@ -38,7 +39,7 @@ public class UpdateCustomerCommandHandler(
|
||||
// Instantiating the Email value object.
|
||||
var emailResult = Email.Create(request.Email);
|
||||
if (!emailResult.IsSuccess)
|
||||
return Result.Error([.. emailResult.Errors]);
|
||||
return Result.Error(emailResult.Errors.ToArray());
|
||||
|
||||
// Checking if there is already a customer with the email address.
|
||||
if (await _repository.ExistsByEmailAsync(emailResult.Value, customer.Id))
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using Ardalis.Result;
|
||||
using Shop.Domain.Entities.CustomerAggregate;
|
||||
using Shop.Domain.ValueObjects;
|
||||
@@ -16,7 +17,7 @@ public static class CustomerFactory
|
||||
{
|
||||
var emailResult = Email.Create(email);
|
||||
return !emailResult.IsSuccess
|
||||
? Result<Customer>.Error([.. emailResult.Errors])
|
||||
? Result<Customer>.Error(emailResult.Errors.ToArray())
|
||||
: Result<Customer>.Success(new Customer(firstName, lastName, gender, emailResult.Value, dateOfBirth));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user