Skip to content

Commit c781c30

Browse files
RodrigoDevRodrigoDev
authored andcommitted
ajustes
1 parent a23322a commit c781c30

File tree

2 files changed

+19
-5
lines changed

2 files changed

+19
-5
lines changed

.gitignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,10 @@
2121
/Tests/UnitTests/obj
2222
/Api/appsettings.Development.json
2323
/Api/appsettings.Tests.json
24+
/Api/bin/Release/net8.0
25+
/Application/bin/Release/net8.0
26+
/Domain/bin/Release/net8.0
27+
/Infra/bin/Release/net8.0
28+
/IoC/bin/Release/net8.0
29+
/Tests/IntegrationTests/bin/Release/net8.0
30+
/Tests/UnitTests/bin/Release/net8.0

Application/CQRS/Authentication/SendEmailVerification/SendEmailVerificationHandler.cs

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,14 +52,21 @@ public async Task<Operation> Handle(SendEmailVerificationCommand request, Cancel
5252
await _repo.Create(entity);
5353

5454
await _uow.Save();
55-
await _uow.Commit();
5655

57-
await _emailService.SendEmail(
58-
request.Email,
59-
"Email Verification Code",
60-
$"Your email verification code is {entity.Code} and is valid for 15 minutes. Previous codes are no longer valid."
56+
var result = await _emailService.SendEmail(
57+
request.Email,
58+
"Email Verification Code",
59+
$"Your email verification code is {entity.Code} and is valid for 15 minutes. Previous codes are no longer valid."
6160
);
6261

62+
if(!result.Success)
63+
{
64+
await _uow.Rollback();
65+
return Operation.MakeFailure($"Failed to send email: {result.Message}");
66+
}
67+
68+
await _uow.Commit();
69+
6370
return Operation.MakeSuccess();
6471
}
6572
}

0 commit comments

Comments
 (0)