File tree Expand file tree Collapse file tree 4 files changed +16
-12
lines changed Expand file tree Collapse file tree 4 files changed +16
-12
lines changed Original file line number Diff line number Diff line change 1- using mail_api . Data ;
1+ using mail_api . Application . Service ;
2+ using mail_api . Data ;
23using mail_api . Domain . DTO ;
3- using mail_api . Domain . Model ;
4- using Newtonsoft . Json ;
54using mail_api . Domain . Interfaces ;
5+ using mail_api . Domain . Model ;
66using Microsoft . Extensions . Logging ;
7+ using Newtonsoft . Json ;
78
89namespace mail_api . Service
910{
@@ -14,14 +15,15 @@ public class CepService : ICepService
1415 private readonly ICepRepository _cepRepository ;
1516 private readonly ILogger < CepService > _logger ;
1617
17- public CepService ( ICepRepository repository )
18+ public CepService ( IViaCepService viaCepService , ICepRepository repository , ILogger < CepService > logger )
1819 {
19-
20- this . _cepRepository = repository ?? throw new ArgumentNullException ( nameof ( repository ) ) ;
20+ _viaCepService = viaCepService ?? throw new ArgumentNullException ( nameof ( viaCepService ) ) ;
21+ _cepRepository = repository ?? throw new ArgumentNullException ( nameof ( repository ) ) ;
22+ _logger = logger ?? throw new ArgumentNullException ( nameof ( logger ) ) ;
2123 }
2224
2325
24-
26+
2527 public async Task < CepInfo > GetByCep ( string cep )
2628 {
2729
Original file line number Diff line number Diff line change @@ -45,11 +45,6 @@ public async Task<CepInfo> FetchAddressByCep(cepRequest cepRequest)
4545 _logger . LogError ( $ "HttpRequestException occurred while fetching address for CEP { cepRequest . Cep } : { ex . Message } ") ;
4646 throw new Exception ( "Error obtaining address by CEP." , ex ) ;
4747 }
48- catch ( Exception ex )
49- {
50- _logger . LogError ( $ "Unexpected error occurred while fetching address for CEP { cepRequest . Cep } : { ex . Message } ") ;
51- throw new Exception ( "Unexpected error processing request." , ex ) ;
52- }
5348 }
5449 }
5550}
Original file line number Diff line number Diff line change 11using mail_api . Data ;
22using mail_api . Domain . Interfaces ;
33using mail_api . Application . Service ;
4+ using mail_api . Service ;
45
56
67var builder = WebApplication . CreateBuilder ( args ) ;
Original file line number Diff line number Diff line change @@ -5,6 +5,8 @@ VisualStudioVersion = 17.10.35013.160
55MinimumVisualStudioVersion = 10.0.40219.1
66Project ("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}" ) = "mail-api" , "mail-api.csproj" , "{8375F62A-013D-46FF-843F-2B6C4ED00589}"
77EndProject
8+ Project ("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}" ) = "MailApiTest" , "..\MailApiTest\MailApiTest.csproj" , "{7D5390DC-17AE-4ED1-8855-2700AD34E4F3}"
9+ EndProject
810Global
911 GlobalSection (SolutionConfigurationPlatforms ) = preSolution
1012 Debug| Any CPU = Debug| Any CPU
@@ -15,6 +17,10 @@ Global
1517 {8375F62A-013D-46FF-843F-2B6C4ED00589} .Debug| Any CPU .Build .0 = Debug| Any CPU
1618 {8375F62A-013D-46FF-843F-2B6C4ED00589} .Release| Any CPU .ActiveCfg = Release| Any CPU
1719 {8375F62A-013D-46FF-843F-2B6C4ED00589} .Release| Any CPU .Build .0 = Release| Any CPU
20+ {7D5390DC-17AE-4ED1-8855-2700AD34E4F3} .Debug| Any CPU .ActiveCfg = Debug| Any CPU
21+ {7D5390DC-17AE-4ED1-8855-2700AD34E4F3} .Debug| Any CPU .Build .0 = Debug| Any CPU
22+ {7D5390DC-17AE-4ED1-8855-2700AD34E4F3} .Release| Any CPU .ActiveCfg = Release| Any CPU
23+ {7D5390DC-17AE-4ED1-8855-2700AD34E4F3} .Release| Any CPU .Build .0 = Release| Any CPU
1824 EndGlobalSection
1925 GlobalSection (SolutionProperties ) = preSolution
2026 HideSolutionNode = FALSE
You can’t perform that action at this time.
0 commit comments