Skip to content

Commit e142b04

Browse files
chore: apply new architecture
1 parent 83ebf21 commit e142b04

File tree

7 files changed

+9
-10
lines changed

7 files changed

+9
-10
lines changed
File renamed without changes.

Service/ViaCepService.cs renamed to Application/Service/ViaCepService.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
using mail_api.Domain.Interfaces;
66

77

8-
namespace mail_api.Service
8+
namespace mail_api.Application.Service
99
{
10-
public class ViaCepService: IViaCepService
10+
public class ViaCepService : IViaCepService
1111
{
1212
private readonly HttpClient _httpClient;
1313
private readonly ILogger<ViaCepService> _logger;

Application/controller.cs renamed to Application/controller/controller.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
using mail_api.Domain.Interfaces;
44
using mail_api.Domain.Model;
55

6-
namespace mail_api.controller
6+
namespace mail_api.Application.controller
77
{
88

99
[ApiController]
@@ -23,7 +23,7 @@ public async Task<IActionResult> GetCep(cepRequest cepRequest)
2323
try
2424
{
2525

26-
26+
2727
if (!Request.Headers.ContainsKey("Cep"))
2828
{
2929
return BadRequest("CEP header is missing.");
@@ -53,21 +53,21 @@ public async Task<IActionResult> PostAsync([FromBody] cepRequest cepRequest)
5353
{
5454
try
5555
{
56-
56+
5757
bool isCepInDatabase = await _cepService.PostAddressByCep(cepRequest);
5858

5959
if (!isCepInDatabase)
6060
{
61-
61+
6262
return Conflict("CEP already exists in the database.");
6363
}
6464

65-
65+
6666
return Ok("Data successfully saved");
6767
}
6868
catch (Exception ex)
6969
{
70-
70+
7171
return StatusCode(500, $"Internal error: {ex.Message}");
7272
}
7373
}

Domain/interface/IViaCepService.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ public interface IViaCepService
77
{
88
Task<CepInfo> FetchAddressByCep(cepRequest cep);
99
}
10-
1110
}
1211

1312

Program.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
using mail_api.Data;
2-
using mail_api.Service;
32
using mail_api.Domain.Interfaces;
3+
using mail_api.Application.Service;
44

55

66
var builder = WebApplication.CreateBuilder(args);
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)