Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Criando os Dtos #5

Merged
merged 1 commit into from
Jan 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Veja mais informações das lições aprendidas na [Wiki](https://github.com/jal

* [Configurações Iniciais e tecnologias](https://github.com/jalussa-santos/formacao-spring-boot/issues/1)
* [Lindando com CORS](https://github.com/jalussa-santos/formacao-spring-boot/issues/2)

* [Construindo DTOs com funcções Java](https://github.com/jalussa-santos/formacao-spring-boot/issues/3)

>### Tecnologias:

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
package com.formacao.springbootapi.controller;

public record CadastroMedicoDto(String nome, String email, String crm, Especialidade especialidade, EnderecoDto endereco) {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
package com.formacao.springbootapi.controller;

public record EnderecoDto(String logradouro, String bairro, String cep, String cidade, String uf, String complemento, String numero) {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package com.formacao.springbootapi.controller;

public enum Especialidade {

ORTOPEDIA,
CARDIOLOGIA,
GINECOLOGIA,
DERMATOLOGIA;
}
Original file line number Diff line number Diff line change
@@ -1,40 +1,5 @@
package com.formacao.springbootapi.controller;

import java.util.Objects;
public record TelefoneDto(String ddd, String numero) {

public final class TelefoneDto {

private final String ddd;
private final String numero;

public TelefoneDto(String ddd, String numero) {
this.ddd = ddd;
this.numero = numero;
}

@Override
public int hashCode() {
return Objects.hash(ddd, numero);
}

@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
} else if (!(obj instanceof TelefoneDto)) {
return false;
} else {
TelefoneDto other = (TelefoneDto) obj;
return Objects.equals(ddd, other.ddd)
&& Objects.equals(numero, other.numero);
}
}

public String getDdd() {
return this.ddd;
}

public String getNumero() {
return this.numero;
}
}
}