Skip to content
This repository has been archived by the owner on Nov 8, 2024. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
lucas0headshot committed Jun 3, 2024
2 parents 3ceecea + d59f2a1 commit 50a97c6
Show file tree
Hide file tree
Showing 74 changed files with 577 additions and 397 deletions.
1 change: 1 addition & 0 deletions backend/insomnia/gestao_cursos.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"_type":"export","__export_format":4,"__export_date":"2024-03-21T04:27:35.739Z","__export_source":"insomnia.desktop.app:v8.6.1","resources":[{"_id":"req_7b2291676b9b4c1bb1a3f1e04db2fedf","parentId":"fld_de250e3afd8e4e6d8e6d142d8e21806e","modified":1710989898075,"created":1710989876902,"url":"http://localhost:8080/health","name":"Health","description":"","method":"GET","body":{},"parameters":[],"headers":[{"name":"User-Agent","value":"insomnia/8.6.1"}],"authentication":{},"metaSortKey":-1710989876903,"isPrivate":false,"pathParameters":[],"settingStoreCookies":true,"settingSendCookies":true,"settingDisableRenderRequestBody":false,"settingEncodeUrl":true,"settingRebuildPath":true,"settingFollowRedirects":"global","_type":"request"},{"_id":"fld_de250e3afd8e4e6d8e6d142d8e21806e","parentId":"wrk_307bf11f7b284ddfb9162b0238385a60","modified":1710989872477,"created":1710989872477,"name":"Health","description":"","environment":{},"environmentPropertyOrder":null,"metaSortKey":-1710989872477,"_type":"request_group"},{"_id":"wrk_307bf11f7b284ddfb9162b0238385a60","parentId":null,"modified":1710906266712,"created":1710906259757,"name":"Gestão","description":"","scope":"collection","_type":"workspace"},{"_id":"req_73f6b4a6ccf8451b89adae4cda608b25","parentId":"fld_1d24b799fbed4cc68282770f89629c25","modified":1710994393267,"created":1710994372107,"url":"http://localhost:8080/api/cargo/3","name":"DELETE","description":"","method":"DELETE","body":{},"parameters":[],"headers":[{"name":"User-Agent","value":"insomnia/8.6.1"}],"authentication":{},"metaSortKey":-1710994372107,"isPrivate":false,"pathParameters":[],"settingStoreCookies":true,"settingSendCookies":true,"settingDisableRenderRequestBody":false,"settingEncodeUrl":true,"settingRebuildPath":true,"settingFollowRedirects":"global","_type":"request"},{"_id":"fld_1d24b799fbed4cc68282770f89629c25","parentId":"wrk_307bf11f7b284ddfb9162b0238385a60","modified":1710989556113,"created":1710989556113,"name":"Cargo","description":"","environment":{},"environmentPropertyOrder":null,"metaSortKey":-1710989556113,"_type":"request_group"},{"_id":"req_1f0559dcac324a6b8e19ac44476442e2","parentId":"fld_1d24b799fbed4cc68282770f89629c25","modified":1710994352246,"created":1710994329777,"url":"http://localhost:8080/api/cargo/1","name":"PUT","description":"","method":"PUT","body":{"mimeType":"application/json","text":""},"parameters":[],"headers":[{"name":"Content-Type","value":"application/json"},{"name":"User-Agent","value":"insomnia/8.6.1"}],"authentication":{},"metaSortKey":-1710994329777,"isPrivate":false,"pathParameters":[],"settingStoreCookies":true,"settingSendCookies":true,"settingDisableRenderRequestBody":false,"settingEncodeUrl":true,"settingRebuildPath":true,"settingFollowRedirects":"global","_type":"request"},{"_id":"req_d4d3c02168054233b32d4ad674269775","parentId":"fld_1d24b799fbed4cc68282770f89629c25","modified":1710994302670,"created":1710994269122,"url":"http://localhost:8080/api/cargo/1","name":"GET ID","description":"","method":"GET","body":{},"parameters":[],"headers":[{"name":"User-Agent","value":"insomnia/8.6.1"}],"authentication":{},"metaSortKey":-1710994269122,"isPrivate":false,"pathParameters":[],"settingStoreCookies":true,"settingSendCookies":true,"settingDisableRenderRequestBody":false,"settingEncodeUrl":true,"settingRebuildPath":true,"settingFollowRedirects":"global","_type":"request"},{"_id":"req_620254600a5e4d31b386a3fef21db79a","parentId":"fld_1d24b799fbed4cc68282770f89629c25","modified":1710993960396,"created":1710993944525,"url":"http://localhost:8080/api/cargo","name":"GET","description":"","method":"GET","body":{},"parameters":[],"headers":[{"name":"User-Agent","value":"insomnia/8.6.1"}],"authentication":{},"metaSortKey":-1710993944525,"isPrivate":false,"pathParameters":[],"settingStoreCookies":true,"settingSendCookies":true,"settingDisableRenderRequestBody":false,"settingEncodeUrl":true,"settingRebuildPath":true,"settingFollowRedirects":"global","_type":"request"},{"_id":"req_9b390d0f7d94477595ca90e847de1507","parentId":"fld_1d24b799fbed4cc68282770f89629c25","modified":1710993930976,"created":1710907316812,"url":"http://localhost:8080/api/cargos","name":"POST","description":"","method":"POST","body":{"mimeType":"application/json","text":"{\n\t\t\t\"descricao\": \"Dev\",\n\t\t\t\"nivel\": \"Júnior\",\n\t\t\t\"comissionado\": false\n\t\t}"},"parameters":[],"headers":[{"name":"Content-Type","value":"application/json"},{"name":"User-Agent","value":"insomnia/8.6.1"}],"authentication":{},"metaSortKey":-1710989559127,"isPrivate":false,"pathParameters":[],"settingStoreCookies":true,"settingSendCookies":true,"settingDisableRenderRequestBody":false,"settingEncodeUrl":true,"settingRebuildPath":true,"settingFollowRedirects":"global","_type":"request"},{"_id":"req_79795ee962504e1698c3b27043c77a75","parentId":"fld_47a639dda80f42ebba93f4c225162426","modified":1710994499896,"created":1710994488090,"url":"http://localhost:8080/api/funcionario/3","name":"New Request","description":"","method":"DELETE","body":{},"parameters":[],"headers":[{"name":"User-Agent","value":"insomnia/8.6.1"}],"authentication":{},"metaSortKey":-1710994488090,"isPrivate":false,"pathParameters":[],"settingStoreCookies":true,"settingSendCookies":true,"settingDisableRenderRequestBody":false,"settingEncodeUrl":true,"settingRebuildPath":true,"settingFollowRedirects":"global","_type":"request"},{"_id":"fld_47a639dda80f42ebba93f4c225162426","parentId":"wrk_307bf11f7b284ddfb9162b0238385a60","modified":1710989539244,"created":1710989539244,"name":"Funcionario","description":"","environment":{},"environmentPropertyOrder":null,"metaSortKey":-1710989539244,"_type":"request_group"},{"_id":"req_51c3e4c4b9de4c27b4638269eb8d3c53","parentId":"fld_47a639dda80f42ebba93f4c225162426","modified":1710990758976,"created":1710990201960,"url":"http://localhost:8080/api/funcionario/4","name":"PUT","description":"","method":"PUT","body":{"mimeType":"application/json","text":"{\n\t\"depentendes\": [\n\t\t{\n\t\t\t\"nome\": \"Filho 1\",\n\t\t\t\"dataNasc\": \"2000-01-12\",\n\t\t\t\"escolaridade\": \"MEDIOCOMPLETO\"\n\t\t}\n\t]\n}"},"parameters":[],"headers":[{"name":"Content-Type","value":"application/json"},{"name":"User-Agent","value":"insomnia/8.6.1"}],"authentication":{},"metaSortKey":-1710990201960,"isPrivate":false,"pathParameters":[],"settingStoreCookies":true,"settingSendCookies":true,"settingDisableRenderRequestBody":false,"settingEncodeUrl":true,"settingRebuildPath":true,"settingFollowRedirects":"global","_type":"request"},{"_id":"req_6f5fcc71cc00445e9f46ce940d05faa2","parentId":"fld_47a639dda80f42ebba93f4c225162426","modified":1710990260588,"created":1710906313092,"url":"http://localhost:8080/api/funcionario","name":"GET","description":"","method":"GET","body":{},"parameters":[],"headers":[{"name":"User-Agent","value":"insomnia/8.6.1"}],"authentication":{},"metaSortKey":-1710989547612,"isPrivate":false,"pathParameters":[],"settingStoreCookies":true,"settingSendCookies":true,"settingDisableRenderRequestBody":false,"settingEncodeUrl":true,"settingRebuildPath":true,"settingFollowRedirects":"global","_type":"request"},{"_id":"req_56a34cb3aa5349fdb428942f47372914","parentId":"fld_47a639dda80f42ebba93f4c225162426","modified":1710994515213,"created":1710994511158,"url":"http://localhost:8080/api/funcionario/3","name":"GET ID","description":"","method":"GET","body":{},"parameters":[],"headers":[{"name":"User-Agent","value":"insomnia/8.6.1"}],"authentication":{},"metaSortKey":-1710989547562,"isPrivate":false,"pathParameters":[],"settingStoreCookies":true,"settingSendCookies":true,"settingDisableRenderRequestBody":false,"settingEncodeUrl":true,"settingRebuildPath":true,"settingFollowRedirects":"global","_type":"request"},{"_id":"req_a37f5315e42b4b39a75c3ea7849439f1","parentId":"fld_47a639dda80f42ebba93f4c225162426","modified":1710989547622,"created":1710906957421,"url":"http://localhost:8080/api/funcionario","name":"POST","description":"","method":"POST","body":{"mimeType":"application/json","text":"\n\t{\n\t\t\"nome\": \"Nome do Funcionário\",\n\t\t\"cpf\": \"123.252.989-30\",\n\t\t\"rg\": \"1234567\",\n\t\t\"endereco\": \"Endereço do Funcionário\",\n\t\t\"ctbs\": \"CTBS do Funcionário\",\n\t\t\"salarioContratual\": 2500.0,\n\t\t\"cargaHoraria\": 40,\n\t\t\"modalidadeContratual\": \"CLT\",\n\t\t\"telefone\": \"(00) 1234-5678\",\n\t\t\"estadoCivil\": \"CASADO\",\n\t\t\"tituloEleitor\": \"132848650914\",\n\t\t\"reservista\": \"1234567\",\n\t\t\"dataNasc\": \"1990-01-01\",\n\t\t\"pisPasep\": \"1234567890\",\n\t\t\"registroProfissional\": \"Registro Profissional do Funcionário\",\n\t\t\"email\": \"[email protected]\",\n\t\t\"sindicato\": \"Sindicato do Funcionário\",\n\t\t\"setor\": \"Setor do Funcionário\",\n\t\t\"tipoRH\": \"APOSITIVO\",\n\t\t\"cnh\": \"1234567890\",\n\t\t\"dataAdmissao\": \"2020-01-01\",\n\t\t\n\t\t\"cargo\": {\n\t\t\t\"id\": 1\n\t\t},\n\t\t\n\t\t\"escolaridade\": \"MEDIOCOMPLETO\",\n\t\t\n\t\t\"filiacao\": {\n\t\t\t\"id\": 1\n\t\t},\n\t\t\n\t\t\"dependentes\": {\n\t\t\t\"id\": 1\n\t\t},\n\t\t\n\t\t\"racaCor\": \"Branca\",\n\t\t\"religiao\": \"Religião do Funcionário\",\n\t\t\"doadorSangue\": true,\n\t\t\"genero\": \"MASCULINO\",\n\t\t\"certificacoeses\": [],\n\t\t\"turno\": \"MATUTINO\",\n\t\t\"nacionalidade\": \"Nacionalidade do Funcionário\",\n\t\t\"redeSocial\": \"Rede Social do Funcionário\",\n\t\t\"areaAtuacao\": \"Área de Atuação do Funcionário\",\n\t\t\"matricula\": \"123456\",\n\t\t\"status\": \"TRABALHANDO\",\n\t\t\"expAnteriors\": [],\n\t\t\"idioma\": \"Idioma do Funcionário\",\n\t\t\"dadosBancarioses\": [],\n\t\t\"horaExtra\": 5,\n\t\t\"horaEntrada\": \"08:00:00\",\n\t\t\"horaSaida\": \"17:00:00\"\n\t}"},"parameters":[],"headers":[{"name":"Content-Type","value":"application/json"},{"name":"User-Agent","value":"insomnia/8.6.1"}],"authentication":{},"metaSortKey":-1710989547512,"isPrivate":false,"pathParameters":[],"settingStoreCookies":true,"settingSendCookies":true,"settingDisableRenderRequestBody":false,"settingEncodeUrl":true,"settingRebuildPath":true,"settingFollowRedirects":"global","_type":"request"},{"_id":"env_a7455bad3d98e24fd33d63ef79ba0c7a94d8be54","parentId":"wrk_307bf11f7b284ddfb9162b0238385a60","modified":1710906296997,"created":1710906259763,"name":"Base Environment","data":{"url":"http://localhost:8080/api/"},"dataPropertyOrder":{"&":["url"]},"color":null,"isPrivate":false,"metaSortKey":1710906259764,"_type":"environment"},{"_id":"jar_a7455bad3d98e24fd33d63ef79ba0c7a94d8be54","parentId":"wrk_307bf11f7b284ddfb9162b0238385a60","modified":1710906259769,"created":1710906259769,"name":"Default Jar","cookies":[],"_type":"cookie_jar"}]}
12 changes: 12 additions & 0 deletions backend/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,18 @@
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.hibernate.validator</groupId>
<artifactId>hibernate-validator</artifactId>
<version>7.0.2.Final</version>
</dependency>

<dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
<version>2.0.1.Final</version>
</dependency>
</dependencies>

<build>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package com.senac.gestaocurso.enterprise.exception;



import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.ResponseStatus;



@ResponseStatus(HttpStatus.CONFLICT)
public class BusinessException extends RuntimeException {
public BusinessException(String msg) {
super(msg);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package com.senac.gestaocurso.enterprise.exception;



import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.ResponseStatus;



@ResponseStatus(HttpStatus.UNPROCESSABLE_ENTITY)
public class ValidationException extends RuntimeException {
public ValidationException(String msg) {
super(msg);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package com.senac.gestaocurso.health;



import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;



@RestController
public class HealthCheckController {
@GetMapping("/health")
public String healthCheck() {
return "Aplicação está rodando";
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@



import com.senac.gestaocurso.models.domain.Frequencia;
import jakarta.persistence.*;

import java.util.ArrayList;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@


@Entity
public class DadosBancarios extends EntityID {
public class DadosBancario extends EntityID {
@Column(nullable = false)
private String banco;

Expand All @@ -28,10 +28,10 @@ public class DadosBancarios extends EntityID {



public DadosBancarios() {
public DadosBancario() {
}

public DadosBancarios(String banco, String agencia, String conta, TipoContaBancaria tipoContaBancaria, Funcionario funcionario) {
public DadosBancario(String banco, String agencia, String conta, TipoContaBancaria tipoContaBancaria, Funcionario funcionario) {
this.banco = banco;
this.agencia = agencia;
this.conta = conta;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@


@Entity
public class Dependentes extends EntityID {
public class Dependente extends EntityID {
@Column
private String nome;

Expand All @@ -28,10 +28,10 @@ public class Dependentes extends EntityID {
private Funcionario funcionario;


public Dependentes() {
public Dependente() {
}

public Dependentes(String nome, Escolaridade escolaridade, LocalDate dataNasc, Funcionario funcionario) {
public Dependente(String nome, Escolaridade escolaridade, LocalDate dataNasc, Funcionario funcionario) {
this.nome = nome;
this.escolaridade = escolaridade;
this.dataNasc = dataNasc;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@


@Entity
public class ExpAnterior extends EntityID {
public class ExperienciaAnterior extends EntityID {
@Column(nullable = false)
private String descricao;

Expand All @@ -31,10 +31,10 @@ public class ExpAnterior extends EntityID {



public ExpAnterior() {
public ExperienciaAnterior() {
}

public ExpAnterior(String descricao, Cargo cargo, LocalDate periodoFinal, LocalDate peridoInicial, Funcionario funcionario) {
public ExperienciaAnterior(String descricao, Cargo cargo, LocalDate periodoFinal, LocalDate peridoInicial, Funcionario funcionario) {
this.descricao = descricao;
this.cargo = cargo;
this.periodoFinal = periodoFinal;
Expand Down
32 changes: 16 additions & 16 deletions backend/src/main/java/com/senac/gestaocurso/models/Funcionario.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@


import com.senac.gestaocurso.enums.*;
import com.senac.gestaocurso.models.domain.Certificacao;
import jakarta.persistence.*;
import java.time.LocalDate;
import java.time.LocalTime;
import java.util.ArrayList;
import java.util.List;


Expand Down Expand Up @@ -88,7 +88,7 @@ public class Funcionario extends EntityID {
private Filiacao filiacao;

@OneToMany(mappedBy = "funcionario", cascade = CascadeType.ALL, fetch = FetchType.LAZY, orphanRemoval = true)
private List<Dependentes> dependentes;
private List<Dependente> dependentes;

@Column
private String racaCor;
Expand All @@ -103,7 +103,7 @@ public class Funcionario extends EntityID {
private Genero genero;

@OneToMany(mappedBy = "funcionario", cascade = CascadeType.ALL, fetch = FetchType.LAZY, orphanRemoval = true)
private List<Certificacoes> certificacoes;
private List<Certificacao> certificacoes;

@Enumerated(EnumType.STRING)
private Turno turno;
Expand All @@ -124,13 +124,13 @@ public class Funcionario extends EntityID {
private Status status;

@OneToMany(mappedBy = "funcionario", cascade = CascadeType.ALL, fetch = FetchType.LAZY, orphanRemoval = true)
private List<ExpAnterior> expAnterior;
private List<ExperienciaAnterior> experienciaAnterior;

@Column
private String idioma;

@OneToMany(mappedBy = "funcionario", cascade = CascadeType.ALL, fetch = FetchType.LAZY, orphanRemoval = true)
private List<DadosBancarios> dadosBancarios;
private List<DadosBancario> dadosBancarios;

@Column
private Integer horaExtra;
Expand Down Expand Up @@ -340,11 +340,11 @@ public void setFiliacao(Filiacao filiacao) {
this.filiacao = filiacao;
}

public List<Dependentes> getDependentes() {
public List<Dependente> getDependentes() {
return dependentes;
}

public void setDependentes(List<Dependentes> dependentes) {
public void setDependentes(List<Dependente> dependentes) {
this.dependentes = dependentes;
}

Expand Down Expand Up @@ -380,27 +380,27 @@ public void setGenero(Genero genero) {
this.genero = genero;
}

public List<DadosBancarios> getDadosBancarios() {
public List<DadosBancario> getDadosBancarios() {
return dadosBancarios;
}

public void setDadosBancarios(List<DadosBancarios> dadosBancarios) {
public void setDadosBancarios(List<DadosBancario> dadosBancarios) {
this.dadosBancarios = dadosBancarios;
}

public List<ExpAnterior> getExpAnterior() {
return expAnterior;
public List<ExperienciaAnterior> getExpAnterior() {
return experienciaAnterior;
}

public void setExpAnterior(List<ExpAnterior> expAnterior) {
this.expAnterior = expAnterior;
public void setExpAnterior(List<ExperienciaAnterior> experienciaAnterior) {
this.experienciaAnterior = experienciaAnterior;
}

public List<Certificacoes> getCertificacoes() {
public List<Certificacao> getCertificacoes() {
return certificacoes;
}

public void setCertificacoes(List<Certificacoes> certificacoes) {
public void setCertificacoes(List<Certificacao> certificacoes) {
this.certificacoes = certificacoes;
}

Expand Down Expand Up @@ -525,7 +525,7 @@ public String toString() {
", areaAtuacao='" + areaAtuacao + '\'' +
", matricula='" + matricula + '\'' +
", status=" + status +
", expAnterior=" + expAnterior +
", expAnterior=" + experienciaAnterior +
", idioma='" + idioma + '\'' +
", dadosBancarios=" + dadosBancarios +
", horaExtra=" + horaExtra +
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
package com.senac.gestaocurso.models;
package com.senac.gestaocurso.models.domain;



import com.senac.gestaocurso.models.EntityID;
import com.senac.gestaocurso.models.Funcionario;
import jakarta.persistence.*;

import java.time.LocalDate;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
package com.senac.gestaocurso.models;
package com.senac.gestaocurso.models.domain;



import com.senac.gestaocurso.models.EntityID;
import jakarta.persistence.*;

import javax.validation.constraints.Max;
import javax.validation.constraints.Min;
import java.time.LocalDate;


Expand All @@ -22,6 +24,8 @@ public class Avaliacao extends EntityID {
private String nome;

@Column
@Min(value = 0, message = "A nota deve ser no mínimo 0")
@Max(value = 10, message = "A nota deve ser no máximo 10")
private Integer nota;

@Column(nullable = false)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package com.senac.gestaocurso.models;
package com.senac.gestaocurso.models.domain;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.senac.gestaocurso.models.EntityID;
import com.senac.gestaocurso.models.Funcionario;
import jakarta.persistence.*;


Expand All @@ -9,7 +11,7 @@


@Entity
public class Certificacoes extends EntityID {
public class Certificacao extends EntityID {
@Column(nullable = false)
private String nome;

Expand All @@ -26,10 +28,10 @@ public class Certificacoes extends EntityID {



public Certificacoes() {
public Certificacao() {
}

public Certificacoes(String nome, Integer cargaHoraria, LocalDate dataEmissao, Funcionario funcionario) {
public Certificacao(String nome, Integer cargaHoraria, LocalDate dataEmissao, Funcionario funcionario) {
this.nome = nome;
this.cargaHoraria = cargaHoraria;
this.dataEmissao = dataEmissao;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
package com.senac.gestaocurso.models;
package com.senac.gestaocurso.models.domain;



import com.senac.gestaocurso.models.EntityID;
import com.senac.gestaocurso.models.Funcionario;
import jakarta.persistence.*;


Expand Down
Loading

0 comments on commit 50a97c6

Please sign in to comment.