Skip to content

Commit 8d95053

Browse files
Initial Commit
0 parents  commit 8d95053

15 files changed

+1457
-0
lines changed

.gitignore

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
2+
target/
3+
!.mvn/wrapper/maven-wrapper.jar
4+
!**/src/main/**/target/
5+
!**/src/test/**/target/
6+
7+
### IntelliJ IDEA ###
8+
.idea/modules.xml
9+
.idea/jarRepositories.xml
10+
.idea/compiler.xml
11+
.idea/libraries/
12+
*.iws
13+
*.iml
14+
*.ipr
15+
16+
### Eclipse ###
17+
.apt_generated
18+
.classpath
19+
.factorypath
20+
.project
21+
.settings
22+
.springBeans
23+
.sts4-cache
24+
25+
### NetBeans ###
26+
/nbproject/private/
27+
/nbbuild/
28+
/dist/
29+
/nbdist/
30+
/.nb-gradle/
31+
build/
32+
!**/src/main/**/build/
33+
!**/src/test/**/build/
34+
35+
### VS Code ###
36+
.vscode/
37+
38+
### Mac OS ###
39+
.DS_Store

LICENSE

Lines changed: 661 additions & 0 deletions
Large diffs are not rendered by default.

README.md

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
# Tech Mech Api
2+
3+
Esta é uma API desenvolvida em java para o projeto TechMec.
4+
5+
## Funcionalidade
6+
7+
- Autenticar o usuário
8+
9+
## Requisitos
10+
11+
Certifique-se de ter o **Java** instalado em sua máquina e o **Compilador Java**
12+
13+
## Passos para Instalação e Inicialização do projeto:
14+
15+
1. Clone o repositório:
16+
17+
```bash
18+
git clone https://github.com/felipeclarindo/tech-mech-api.git
19+
```
20+
21+
2. Entre no diretorio da api:
22+
23+
```cd
24+
tech-mech-api
25+
```
26+
27+
3. Inicie o arquivo `Main.java`.
28+
29+
4. Pronto a API está no ar, agora clone o repositório de Front:
30+
31+
```bash
32+
git clone https://github.com/felipeclarindo/tech-mech
33+
```
34+
35+
5. Entre no diretorio:
36+
37+
```bash
38+
cd tech-mech
39+
```
40+
41+
6. instale as dependencias:
42+
43+
```bash
44+
npm install
45+
```
46+
47+
7. Rode o projeto localmente (certifique-se de que a API de java também esteja rodando):
48+
49+
```bash
50+
npm run dev
51+
```
52+
53+
8. Clique no link disponibilizado no terminal, normalmente:
54+
55+
- http://localhost:3000
56+
57+
## Contribuição
58+
59+
Contribuições são bem-vindas! Se você tiver sugestões de melhorias, sinta-se à vontade para abrir uma issue ou enviar um pull request.
60+
61+
## Autores
62+
63+
- [Felipe Clarindo](https://github.com/felipeclarindo)
64+
- [Victor Augusto](https://github.com/victoraugustogfavaro)
65+
- [Jennie Suzuki](https://github.com/jenniesuzuki)
66+
67+
## Licença
68+
69+
Este projeto está licenciado sob a [GNU Affero License](https://www.gnu.org/licenses/agpl-3.0.html).

pom.xml

Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
2+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
3+
4+
<modelVersion>4.0.0</modelVersion>
5+
6+
<groupId>br.com.fiap</groupId>
7+
<artifactId>java-sprint4</artifactId>
8+
<packaging>jar</packaging>
9+
<version>1.0-SNAPSHOT</version>
10+
<name>java-sprint4</name>
11+
12+
<dependencyManagement>
13+
<dependencies>
14+
<dependency>
15+
<groupId>org.glassfish.jersey</groupId>
16+
<artifactId>jersey-bom</artifactId>
17+
<version>${jersey.version}</version>
18+
<type>pom</type>
19+
<scope>import</scope>
20+
</dependency>
21+
</dependencies>
22+
</dependencyManagement>
23+
24+
<dependencies>
25+
<dependency>
26+
<groupId>org.glassfish.jersey.containers</groupId>
27+
<artifactId>jersey-container-grizzly2-http</artifactId>
28+
</dependency>
29+
<dependency>
30+
<groupId>org.glassfish.jersey.inject</groupId>
31+
<artifactId>jersey-hk2</artifactId>
32+
</dependency>
33+
34+
<dependency>
35+
<groupId>org.glassfish.jersey.media</groupId>
36+
<artifactId>jersey-media-json-binding</artifactId>
37+
</dependency>
38+
39+
<dependency>
40+
<groupId>com.oracle.database.jdbc</groupId>
41+
<artifactId>ojdbc11</artifactId>
42+
<version>23.5.0.24.07</version>
43+
</dependency>
44+
45+
<dependency>
46+
<groupId>org.glassfish.jersey.ext</groupId>
47+
<artifactId>jersey-bean-validation</artifactId>
48+
</dependency>
49+
50+
<dependency>
51+
<groupId>org.junit.jupiter</groupId>
52+
<artifactId>junit-jupiter</artifactId>
53+
<version>${junit5.version}</version>
54+
<scope>test</scope>
55+
</dependency>
56+
</dependencies>
57+
58+
<build>
59+
<plugins>
60+
<plugin>
61+
<groupId>org.apache.maven.plugins</groupId>
62+
<artifactId>maven-compiler-plugin</artifactId>
63+
<version>3.13.0</version>
64+
<inherited>true</inherited>
65+
<configuration>
66+
<source>1.8</source>
67+
<target>1.8</target>
68+
</configuration>
69+
</plugin>
70+
<plugin>
71+
<groupId>org.codehaus.mojo</groupId>
72+
<artifactId>exec-maven-plugin</artifactId>
73+
<version>3.2.0</version>
74+
<executions>
75+
<execution>
76+
<goals>
77+
<goal>java</goal>
78+
</goals>
79+
</execution>
80+
</executions>
81+
<configuration>
82+
<mainClass>br.com.fiap.Main</mainClass>
83+
</configuration>
84+
</plugin>
85+
<plugin>
86+
<!-- Surefire support for JUnit-5 -->
87+
<groupId>org.apache.maven.plugins</groupId>
88+
<artifactId>maven-surefire-plugin</artifactId>
89+
<version>3.2.5</version>
90+
</plugin>
91+
</plugins>
92+
</build>
93+
94+
<properties>
95+
<jersey.version>3.1.8</jersey.version>
96+
<junit5.version>5.10.2</junit5.version>
97+
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
98+
</properties>
99+
</project>

src/main/java/Main.java

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
2+
import org.glassfish.grizzly.http.server.HttpServer;
3+
import org.glassfish.jersey.grizzly2.httpserver.GrizzlyHttpServerFactory;
4+
import org.glassfish.jersey.server.ResourceConfig;
5+
6+
import java.io.IOException;
7+
import java.net.URI;
8+
9+
/**
10+
* Main class.
11+
*
12+
*/
13+
public class Main {
14+
// Base URI the Grizzly HTTP server will listen on
15+
public static final String BASE_URI = "http://localhost:8080/";
16+
17+
/**
18+
* Starts Grizzly HTTP server exposing JAX-RS resources defined in this application.
19+
* @return Grizzly HTTP server.
20+
*/
21+
public static HttpServer startServer() {
22+
// create a resource config that scans for JAX-RS resources and providers
23+
// in br.com.fiap package
24+
final ResourceConfig rc = new ResourceConfig().packages("br.com.fiap.resource");
25+
26+
// create and start a new instance of grizzly http server
27+
// exposing the Jersey application at BASE_URI
28+
return GrizzlyHttpServerFactory.createHttpServer(URI.create(BASE_URI), rc);
29+
}
30+
31+
/**
32+
* Main method.
33+
* @param args
34+
* @throws IOException
35+
*/
36+
public static void main(String[] args) throws IOException {
37+
final HttpServer server = startServer();
38+
System.out.println(String.format("Jersey app started with endpoints available at "
39+
+ "%s%nHit Ctrl-C to stop it...", BASE_URI));
40+
System.in.read();
41+
server.stop();
42+
}
43+
}
44+

src/main/java/bo/ClienteBO.java

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
package bo;
2+
3+
import dao.ClienteDAO;
4+
import to.ClienteTO;
5+
import java.util.ArrayList;
6+
7+
public class ClienteBO {
8+
private ClienteDAO clienteDAO;
9+
10+
public ArrayList<ClienteTO> findAllClientes() {
11+
clienteDAO = new ClienteDAO();
12+
return clienteDAO.findAllClientes();
13+
}
14+
15+
public ClienteTO findByCpf(String cpf) {
16+
clienteDAO = new ClienteDAO();
17+
return clienteDAO.findByCpf(cpf);
18+
}
19+
20+
public ClienteTO saveCliente(ClienteTO cliente) {
21+
clienteDAO = new ClienteDAO();
22+
return clienteDAO.saveCliente(cliente);
23+
}
24+
25+
public boolean deleteCliente(String cpf) {
26+
clienteDAO = new ClienteDAO();
27+
return clienteDAO.deleteCliente(cpf);
28+
}
29+
30+
public ClienteTO updateCliente(ClienteTO cliente) {
31+
clienteDAO = new ClienteDAO();
32+
return clienteDAO.updateCliente(cliente);
33+
}
34+
35+
public boolean autenticarCliente(String cpf, String senha) {
36+
clienteDAO = new ClienteDAO();
37+
return clienteDAO.autenticarCliente(cpf, senha);
38+
}
39+
}

0 commit comments

Comments
 (0)