From 5c9bac4c48b9c7d2914c1099d5ffae20da2ca5d1 Mon Sep 17 00:00:00 2001 From: Felipe Acelino Date: Mon, 8 Feb 2021 01:01:44 -0300 Subject: [PATCH] (#7) - model --- .gitignore | 3 ++ pom.xml | 21 +++++++++--- .../competence/jpa/CompetenceRepository.java | 10 ++++++ .../api/v1/competence/model/Competence.java | 32 +++++++++++++++++++ .../hatcher/api/v1/competence/model/Type.java | 8 +++++ 5 files changed, 70 insertions(+), 4 deletions(-) create mode 100644 src/main/java/org/ayty/hatcher/api/v1/competence/jpa/CompetenceRepository.java create mode 100644 src/main/java/org/ayty/hatcher/api/v1/competence/model/Competence.java create mode 100644 src/main/java/org/ayty/hatcher/api/v1/competence/model/Type.java diff --git a/.gitignore b/.gitignore index 1dd5f46..8d0998c 100644 --- a/.gitignore +++ b/.gitignore @@ -14,6 +14,8 @@ local.properties .settings/ .loadpath .recommenders +.classpath +.project # External tool builders .externalToolBuilders/ @@ -207,3 +209,4 @@ hs_err_pid* *.code-workspace # End of https://www.toptal.com/developers/gitignore/api/java,intellij,vscode,eclipse +/target/ diff --git a/pom.xml b/pom.xml index 0782b47..361aff1 100644 --- a/pom.xml +++ b/pom.xml @@ -1,12 +1,13 @@ - 4.0.0 org.springframework.boot spring-boot-starter-parent 2.4.2 - + org.ayty hatcher-api @@ -20,7 +21,7 @@ org.springframework.boot spring-boot-starter-data-jpa - 2.4.2 + 2.4.2 @@ -45,7 +46,7 @@ com.h2database h2 - test + provided 1.4.200 @@ -97,6 +98,18 @@ springfox-swagger-ui 2.9.2 + + + javax.validation + validation-api + 2.0.1.Final + + + + org.hibernate.validator + hibernate-validator + 6.0.13.Final + diff --git a/src/main/java/org/ayty/hatcher/api/v1/competence/jpa/CompetenceRepository.java b/src/main/java/org/ayty/hatcher/api/v1/competence/jpa/CompetenceRepository.java new file mode 100644 index 0000000..2b1d705 --- /dev/null +++ b/src/main/java/org/ayty/hatcher/api/v1/competence/jpa/CompetenceRepository.java @@ -0,0 +1,10 @@ +package org.ayty.hatcher.api.v1.competence.jpa; + +import org.ayty.hatcher.api.v1.competence.model.Competence; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.stereotype.Repository; + +@Repository +public interface CompetenceRepository extends JpaRepository { + +} diff --git a/src/main/java/org/ayty/hatcher/api/v1/competence/model/Competence.java b/src/main/java/org/ayty/hatcher/api/v1/competence/model/Competence.java new file mode 100644 index 0000000..c463f07 --- /dev/null +++ b/src/main/java/org/ayty/hatcher/api/v1/competence/model/Competence.java @@ -0,0 +1,32 @@ +package org.ayty.hatcher.api.v1.competence.model; + +import javax.persistence.Entity; +import javax.persistence.EnumType; +import javax.persistence.Enumerated; +import javax.persistence.Id; +import javax.validation.constraints.NotEmpty; +import javax.validation.constraints.Size; + +import lombok.Data; + +@Data +@Entity +public class Competence { + + @Id + private Long id; + + @NotEmpty(message="O campo nome não pode estar vazio.") + @Size(min=10, max=200, message="O nome deve ter entre 10 e 200 caracteres.") + private String name; + + @NotEmpty(message="O campo descrição não pode estar vazio.") + @Size(min=10, max=1000, message="A descrição deve ter entre 10 e 1000 caracteres.") + private String description; + + @Enumerated(EnumType.STRING) + private Type type; + + //falta o relacionamento com a entidade Projeto + +} diff --git a/src/main/java/org/ayty/hatcher/api/v1/competence/model/Type.java b/src/main/java/org/ayty/hatcher/api/v1/competence/model/Type.java new file mode 100644 index 0000000..879bf2c --- /dev/null +++ b/src/main/java/org/ayty/hatcher/api/v1/competence/model/Type.java @@ -0,0 +1,8 @@ +package org.ayty.hatcher.api.v1.competence.model; + +public enum Type { + + TECHNIC, + SOFT_SKILLS + +}