Skip to content

Commit 144ceb6

Browse files
committed
Refatoração de da API de Clientes e outros ajustes
1 parent cdcdc33 commit 144ceb6

File tree

66 files changed

+991
-1380
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

66 files changed

+991
-1380
lines changed

JS.Enterprise.sln

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "JSE.Pedidos.API", "src\serv
3737
EndProject
3838
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "JSE.WebApp.MVC", "src\web\JSE.WebApp.MVC\JSE.WebApp.MVC.csproj", "{2305CFC3-FEEC-4C9F-954E-4622F87AC3E9}"
3939
EndProject
40-
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Client", "Client", "{B89AEBFA-BA86-4AC4-A0B4-117C29036158}"
41-
EndProject
42-
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "JSE.Client.API", "src\services\JSE.Client.API\JSE.Client.API.csproj", "{072FD5A4-520E-4FC0-AC39-B2C914F8A483}"
40+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Cliente", "Cliente", "{B89AEBFA-BA86-4AC4-A0B4-117C29036158}"
4341
EndProject
4442
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "JSE.Catalogo.API", "src\services\JSE.Catalogo.API\JSE.Catalogo.API.csproj", "{E419E8F2-679C-4B4C-B524-4965768DB97D}"
4543
EndProject
@@ -57,9 +55,11 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Compras", "Compras", "{06D8
5755
EndProject
5856
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "JSE.Bff.Compras", "src\api gateways\JSE.Bff.Compras\JSE.Bff.Compras.csproj", "{203A9878-A87F-4A75-9E91-BD1B4845BD6E}"
5957
EndProject
60-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "JSE.Pedidos.Domain", "src\services\JSE.Pedido.Domain\JSE.Pedidos.Domain.csproj", "{42556C73-9ABF-45D0-911F-16E74D2919EB}"
58+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "JSE.Pedidos.Domain", "src\services\JSE.Pedido.Domain\JSE.Pedidos.Domain.csproj", "{42556C73-9ABF-45D0-911F-16E74D2919EB}"
59+
EndProject
60+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "JSE.Pedidos.Infra", "src\services\JSE.Pedido.Infra\JSE.Pedidos.Infra.csproj", "{2BB79FC1-2E45-486B-AC1E-F680B3C54BCD}"
6161
EndProject
62-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "JSE.Pedidos.Infra", "src\services\JSE.Pedido.Infra\JSE.Pedidos.Infra.csproj", "{2BB79FC1-2E45-486B-AC1E-F680B3C54BCD}"
62+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "JSE.Clientes.API", "src\services\JSE.Clientes.API\JSE.Clientes.API.csproj", "{AC75EECB-1BC5-4653-AB42-E8148D5B05D9}"
6363
EndProject
6464
Global
6565
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -91,10 +91,6 @@ Global
9191
{2305CFC3-FEEC-4C9F-954E-4622F87AC3E9}.Debug|Any CPU.Build.0 = Debug|Any CPU
9292
{2305CFC3-FEEC-4C9F-954E-4622F87AC3E9}.Release|Any CPU.ActiveCfg = Release|Any CPU
9393
{2305CFC3-FEEC-4C9F-954E-4622F87AC3E9}.Release|Any CPU.Build.0 = Release|Any CPU
94-
{072FD5A4-520E-4FC0-AC39-B2C914F8A483}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
95-
{072FD5A4-520E-4FC0-AC39-B2C914F8A483}.Debug|Any CPU.Build.0 = Debug|Any CPU
96-
{072FD5A4-520E-4FC0-AC39-B2C914F8A483}.Release|Any CPU.ActiveCfg = Release|Any CPU
97-
{072FD5A4-520E-4FC0-AC39-B2C914F8A483}.Release|Any CPU.Build.0 = Release|Any CPU
9894
{E419E8F2-679C-4B4C-B524-4965768DB97D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
9995
{E419E8F2-679C-4B4C-B524-4965768DB97D}.Debug|Any CPU.Build.0 = Debug|Any CPU
10096
{E419E8F2-679C-4B4C-B524-4965768DB97D}.Release|Any CPU.ActiveCfg = Release|Any CPU
@@ -119,6 +115,10 @@ Global
119115
{2BB79FC1-2E45-486B-AC1E-F680B3C54BCD}.Debug|Any CPU.Build.0 = Debug|Any CPU
120116
{2BB79FC1-2E45-486B-AC1E-F680B3C54BCD}.Release|Any CPU.ActiveCfg = Release|Any CPU
121117
{2BB79FC1-2E45-486B-AC1E-F680B3C54BCD}.Release|Any CPU.Build.0 = Release|Any CPU
118+
{AC75EECB-1BC5-4653-AB42-E8148D5B05D9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
119+
{AC75EECB-1BC5-4653-AB42-E8148D5B05D9}.Debug|Any CPU.Build.0 = Debug|Any CPU
120+
{AC75EECB-1BC5-4653-AB42-E8148D5B05D9}.Release|Any CPU.ActiveCfg = Release|Any CPU
121+
{AC75EECB-1BC5-4653-AB42-E8148D5B05D9}.Release|Any CPU.Build.0 = Release|Any CPU
122122
EndGlobalSection
123123
GlobalSection(SolutionProperties) = preSolution
124124
HideSolutionNode = FALSE
@@ -141,7 +141,6 @@ Global
141141
{FCDB1D73-2DEA-41F9-87B7-67112E8B73C0} = {856468DF-3B1E-4BAB-AD97-2D72FB744435}
142142
{2305CFC3-FEEC-4C9F-954E-4622F87AC3E9} = {79FC29BE-B38A-4985-A451-AF95471DA401}
143143
{B89AEBFA-BA86-4AC4-A0B4-117C29036158} = {B7B256E8-0247-4E6A-B054-E60A043AF1ED}
144-
{072FD5A4-520E-4FC0-AC39-B2C914F8A483} = {B89AEBFA-BA86-4AC4-A0B4-117C29036158}
145144
{E419E8F2-679C-4B4C-B524-4965768DB97D} = {C0A0CFCE-065D-44AA-8032-7FD5FAE9814A}
146145
{1D1290CB-337B-4F69-BB49-32157A26CFD4} = {8B809ED7-C372-43C9-90C6-B9B55EFA7A6E}
147146
{546E76D9-2A53-4ED5-919E-7D7847FDE04F} = {1D1290CB-337B-4F69-BB49-32157A26CFD4}
@@ -152,6 +151,7 @@ Global
152151
{203A9878-A87F-4A75-9E91-BD1B4845BD6E} = {06D8DDAB-AB2C-4780-B990-1610B78B1739}
153152
{42556C73-9ABF-45D0-911F-16E74D2919EB} = {856468DF-3B1E-4BAB-AD97-2D72FB744435}
154153
{2BB79FC1-2E45-486B-AC1E-F680B3C54BCD} = {856468DF-3B1E-4BAB-AD97-2D72FB744435}
154+
{AC75EECB-1BC5-4653-AB42-E8148D5B05D9} = {B89AEBFA-BA86-4AC4-A0B4-117C29036158}
155155
EndGlobalSection
156156
GlobalSection(ExtensibilityGlobals) = postSolution
157157
SolutionGuid = {F19279BD-86B0-48AF-9FA4-26C84BD715EB}

src/building blocks/JSE.Core/DomainObjects/ClientDocument.cs renamed to src/building blocks/JSE.Core/DomainObjects/Cpf.cs

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,24 +2,23 @@
22

33
namespace JSE.Core.DomainObjects
44
{
5-
public class ClientDocument
5+
public class Cpf
66
{
7-
public const int DocumentMaxLength = 11;
8-
public string DocumentNumber { get; private set; }
7+
public const int CpfMaxLength = 11;
8+
public string Numero { get; private set; }
99

10-
// Constructor EntityFramework
11-
protected ClientDocument() { }
10+
//Construtor do EntityFramework
11+
protected Cpf() { }
1212

13-
public ClientDocument(string documentNumber)
13+
public Cpf(string numero)
1414
{
15-
if(!ValidarCpf(documentNumber)) throw new DomainException("CPF inválido");
16-
17-
DocumentNumber = documentNumber;
15+
if (!Validar(numero)) throw new DomainException("CPF inválido");
16+
Numero = numero;
1817
}
1918

20-
public static bool ValidarCpf(string cpf)
19+
public static bool Validar(string cpf)
2120
{
22-
cpf = cpf.NumberOnly(cpf);
21+
cpf = cpf.ApenasNumeros(cpf);
2322

2423
if (cpf.Length > 11)
2524
return false;
@@ -71,4 +70,4 @@ public static bool ValidarCpf(string cpf)
7170
return true;
7271
}
7372
}
74-
}
73+
}

src/building blocks/JSE.Core/Utils/Email.cs renamed to src/building blocks/JSE.Core/DomainObjects/Email.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,20 @@ namespace JSE.Core.DomainObjects
44
{
55
public class Email
66
{
7-
public const int EmailMaxLength = 254;
8-
public const int EmailMinLength = 5;
9-
public string EmailAddress { get; private set; }
7+
public const int EnderecoMaxLength = 254;
8+
public const int EnderecoMinLength = 5;
9+
public string Endereco { get; private set; }
1010

1111
//Construtor do EntityFramework
1212
protected Email() { }
1313

14-
public Email(string emailAddress)
14+
public Email(string endereco)
1515
{
16-
if (!Validate(emailAddress)) throw new DomainException("E-mail inválido");
17-
EmailAddress = emailAddress;
16+
if (!Validar(endereco)) throw new DomainException("E-mail inválido");
17+
Endereco = endereco;
1818
}
1919

20-
public static bool Validate(string email)
20+
public static bool Validar(string email)
2121
{
2222
var regexEmail = new Regex(@"^(?("")("".+?""@)|(([0-9a-zA-Z]((\.(?!\.))|[-!#\$%&'\*\+/=\?\^`\{\}\|~\w])*)(?<=[0-9a-zA-Z])@))(?(\[)(\[(\d{1,3}\.){3}\d{1,3}\])|(([0-9a-zA-Z][-\w]*[0-9a-zA-Z]\.)+[a-zA-Z]{2,6}))$");
2323
return regexEmail.IsMatch(email);

src/building blocks/JSE.Core/DomainObjects/Entity.cs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -11,27 +11,26 @@ protected Entity()
1111
Id = Guid.NewGuid();
1212
}
1313

14-
private List<Event> _events;
15-
public IReadOnlyCollection<Event> Events => _events?.AsReadOnly();
14+
private List<Event> _notificacoes;
15+
public IReadOnlyCollection<Event> Notificacoes => _notificacoes?.AsReadOnly();
1616

17-
public void AddEvent(Event events)
17+
public void AdicionarEvento(Event evento)
1818
{
19-
_events = _events ?? new List<Event>();
20-
_events.Add(events);
19+
_notificacoes = _notificacoes ?? new List<Event>();
20+
_notificacoes.Add(evento);
2121
}
2222

23-
public void RemoveEvent(Event eventItem)
23+
public void RemoverEvento(Event eventItem)
2424
{
25-
_events?.Remove(eventItem);
25+
_notificacoes?.Remove(eventItem);
2626
}
2727

28-
public void ClearEvents()
28+
public void LimparEventos()
2929
{
30-
_events?.Clear();
30+
_notificacoes?.Clear();
3131
}
3232

33-
#region Comparations
34-
33+
#region Comparações
3534

3635
public override bool Equals(object obj)
3736
{
@@ -68,6 +67,7 @@ public override string ToString()
6867
{
6968
return $"{GetType().Name} [Id={Id}]";
7069
}
70+
7171
#endregion
7272
}
73-
}
73+
}

src/building blocks/JSE.Core/Messages/Command.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ protected Command()
1313
Timestamp = DateTime.Now;
1414
}
1515

16-
public virtual bool IsValid()
16+
public virtual bool EhValido()
1717
{
1818
throw new NotImplementedException();
1919
}

src/building blocks/JSE.Core/Messages/Integration/UsuarioRegistradoIntegrationEvent.cs

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,26 +3,16 @@
33
public class UsuarioRegistradoIntegrationEvent : IntegrationEvent
44
{
55
public Guid Id { get; private set; }
6-
public string FirstName { get; private set; }
7-
public string LastName { get; private set; }
8-
public string Surname { get; private set; }
9-
public Guid GenderId { get; private set; }
6+
public string Nome { get; private set; }
107
public string Email { get; private set; }
11-
public string Phone { get; private set; }
12-
public DateTime BirthdayDate { get; private set; }
13-
public string DocumentNumber { get; private set; }
8+
public string Cpf { get; private set; }
149

15-
public UsuarioRegistradoIntegrationEvent(Guid id, string firstName, string lastName, string surname, Guid genderId, string email, string phone, DateTime birthdayDate, string documentNumber)
10+
public UsuarioRegistradoIntegrationEvent(Guid id, string nome, string email, string cpf)
1611
{
1712
Id = id;
18-
FirstName = firstName;
19-
LastName = lastName;
20-
Surname = surname;
21-
GenderId = genderId;
13+
Nome = nome;
2214
Email = email;
23-
Phone = phone;
24-
BirthdayDate = birthdayDate;
25-
DocumentNumber = documentNumber;
15+
Cpf = cpf;
2616
}
2717
}
28-
}
18+
}

src/building blocks/JSE.Core/Utils/StringUtils.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
{
33
public static class StringUtils
44
{
5-
public static string NumberOnly(this string str, string input)
5+
public static string ApenasNumeros(this string str, string input)
66
{
77
return new string(input.Where(char.IsDigit).ToArray());
88
}

src/services/JSE.Client.API/Application/Commands/ClientCommandHandler.cs

Lines changed: 0 additions & 43 deletions
This file was deleted.

src/services/JSE.Client.API/Application/Commands/RegisterClientCommand.cs

Lines changed: 0 additions & 75 deletions
This file was deleted.

src/services/JSE.Client.API/Application/Events/ClientEventHandler.cs

Lines changed: 0 additions & 12 deletions
This file was deleted.

0 commit comments

Comments
 (0)