Skip to content
Open
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
135 changes: 118 additions & 17 deletions MottuFlow/jsonsAPIREST/API - MottuFlow.postman_collection.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"info": {
"_postman_id": "8ba14ee2-7d92-43a3-90b1-6de1d3e44871",
"_postman_id": "2d6678fb-b100-479d-a5ee-a2e5a535dea4",
"name": "API - MottuFlow",
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json",
"_exporter_id": "39334205",
"_collection_link": "https://galactic-resonance-365575.postman.co/workspace/MottuFlow-Endpoints~479ea491-7731-4683-b0a4-56afc7df5c83/collection/39334205-8ba14ee2-7d92-43a3-90b1-6de1d3e44871?action=share&source=collection_link&creator=39334205"
"_collection_link": "https://galactic-resonance-365575.postman.co/workspace/MottuFlow-Endpoints~479ea491-7731-4683-b0a4-56afc7df5c83/collection/39334205-2d6678fb-b100-479d-a5ee-a2e5a535dea4?action=share&source=collection_link&creator=39334205"
},
"item": [
{
Expand All @@ -22,17 +22,7 @@
"type": "noauth"
},
"method": "POST",
"header": [
{
"key": "Content-Type",
"value": "application/json"
},
{
"key": "User-Agent",
"value": "insomnia/11.5.0",
"disabled": true
}
],
"header": [],
"body": {
"mode": "raw",
"raw": "{\n \"email\": \"admin@email.com\",\n \"senha\": \"adminmottu\"\n}",
Expand Down Expand Up @@ -319,14 +309,14 @@
}
},
"url": {
"raw": "{{baseUrl}}/funcionario/editar/2",
"raw": "{{baseUrl}}/funcionario/editar/4",
"host": [
"{{baseUrl}}"
],
"path": [
"funcionario",
"editar",
"2"
"4"
]
}
},
Expand Down Expand Up @@ -850,6 +840,40 @@
},
"response": []
},
{
"name": "Buscar Moto por Modelo (GET)",
"protocolProfileBehavior": {
"followRedirects": true,
"disableUrlEncoding": false,
"disableCookies": false
},
"request": {
"auth": {
"type": "bearer",
"bearer": [
{
"key": "token",
"value": "{{jwt}}",
"type": "string"
}
]
},
"method": "GET",
"header": [],
"url": {
"raw": "{{baseUrl}}/motos/buscar-por-modelo/Mottu Pop",
"host": [
"{{baseUrl}}"
],
"path": [
"motos",
"buscar-por-modelo",
"Mottu Pop"
]
}
},
"response": []
},
{
"name": "Criar Moto (POST)",
"protocolProfileBehavior": {
Expand Down Expand Up @@ -1651,6 +1675,40 @@
},
"response": []
},
{
"name": "Buscar Status por Moto (GET)",
"protocolProfileBehavior": {
"followRedirects": true,
"disableUrlEncoding": false,
"disableCookies": false
},
"request": {
"auth": {
"type": "bearer",
"bearer": [
{
"key": "token",
"value": "{{jwt}}",
"type": "string"
}
]
},
"method": "GET",
"header": [],
"url": {
"raw": "{{baseUrl}}/status/buscar-por-moto/1",
"host": [
"{{baseUrl}}"
],
"path": [
"status",
"buscar-por-moto",
"1"
]
}
},
"response": []
},
{
"name": "Buscar Status por TIpo Status (GET)",
"protocolProfileBehavior": {
Expand Down Expand Up @@ -2263,6 +2321,49 @@
}
}
]
},
{
"name": "MasteringDatabase",
"item": [
{
"name": "DATABASE - relatorioFuncionario",
"request": {
"method": "GET",
"header": [],
"url": {
"raw": "{{baseUrl}}/database/funcionario/1",
"host": [
"{{baseUrl}}"
],
"path": [
"database",
"funcionario",
"1"
]
}
},
"response": []
},
{
"name": "DATABASE - relatorioMoto",
"request": {
"method": "GET",
"header": [],
"url": {
"raw": "{{baseUrl}}/database/moto/1",
"host": [
"{{baseUrl}}"
],
"path": [
"database",
"moto",
"1"
]
}
},
"response": []
}
]
}
],
"auth": {
Expand Down Expand Up @@ -2306,7 +2407,7 @@
},
{
"key": "jwt",
"value": ""
"value": "<mude aqui>"
}
]
}
}
78 changes: 47 additions & 31 deletions MottuFlow/pom.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
Expand All @@ -19,97 +18,114 @@
<description>Projeto MottuFlow para as SPRINTS-2025</description>

<properties>
<java.version>21</java.version>
<java.version>17</java.version>
</properties>

<dependencies>
<!-- Web e REST -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>

<!-- JPA / Validação / Segurança / JWT -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>

<dependency>
<groupId>com.auth0</groupId>
<artifactId>java-jwt</artifactId>
<version>4.5.0</version>
</dependency>

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-validation</artifactId>
</dependency>

<!-- Thymeleaf (opcional) -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>

<!-- JDBC / Oracle -->
<dependency>
<groupId>com.oracle.database.jdbc</groupId>
<artifactId>ojdbc11</artifactId>
<version>23.9.0.25.07</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<scope>runtime</scope>
<optional>true</optional>
<artifactId>spring-boot-starter-jdbc</artifactId>
</dependency>

<!-- Flyway Oracle -->
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<optional>true</optional>
<groupId>org.flywaydb</groupId>
<artifactId>flyway-core</artifactId>
</dependency>

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
<groupId>org.flywaydb</groupId>
<artifactId>flyway-database-oracle</artifactId>
<version>11.15.0</version>
<scope>runtime</scope>
</dependency>


<!-- OpenAPI / Swagger -->
<dependency>
<groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-starter-webmvc-ui</artifactId>
<version>2.8.11</version>
</dependency>

<dependency>
<groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-data-rest</artifactId>
<version>1.7.0</version>
</dependency>

<!-- Testes -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-test</artifactId>
<scope>test</scope>
</dependency>

<!-- Lombok -->
<dependency>
<groupId>com.mysql</groupId>
<artifactId>mysql-connector-j</artifactId>
<scope>runtime</scope>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<optional>true</optional>
</dependency>

<!-- Jackson (manipulação de JSON) -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
</dependency>


<!-- DevTools -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>

<dependency>
<groupId>org.flywaydb</groupId>
<artifactId>flyway-core</artifactId>
<artifactId>spring-boot-devtools</artifactId>
<scope>runtime</scope>
<optional>true</optional>
</dependency>

<!-- Actuator -->
<dependency>
<groupId>org.flywaydb</groupId>
<artifactId>flyway-mysql</artifactId>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
</dependencies>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import com.sprint.MottuFlow.domain.funcionario.Funcionario;
import com.sprint.MottuFlow.domain.funcionario.FuncionarioService;

import io.swagger.v3.oas.annotations.security.SecurityRequirements;
import jakarta.validation.Valid;
import org.springframework.http.ResponseEntity;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
Expand All @@ -30,6 +31,7 @@ public AutenticacaoRestController( AuthenticationManager aM, TokenService tS, Fu
this.fS = fS;
}

@SecurityRequirements()
@PostMapping( "/login" )
public ResponseEntity<DadosToken> efetuarLogin( @Valid @RequestBody DadosLogin dados ) {
var authToken = new UsernamePasswordAuthenticationToken( dados.email(), dados.senha() );
Expand All @@ -46,6 +48,7 @@ public ResponseEntity<DadosToken> efetuarLogin( @Valid @RequestBody DadosLogin d
return ResponseEntity.ok( new DadosToken( tokenAcesso, refreshToken, expiracaoRefresh ) );
}

@SecurityRequirements()
@PostMapping( "/atualizar-token" )
public ResponseEntity<DadosToken> atualizarToken( @Valid @RequestBody DadosRefreshToken dados ) {
Funcionario funcionario = fS.validarRefreshTokenFuncionario( dados.refreshToken() );
Expand All @@ -58,6 +61,7 @@ public ResponseEntity<DadosToken> atualizarToken( @Valid @RequestBody DadosRefre
return ResponseEntity.ok(new DadosToken(tokenAcesso, refreshTokenExistente, expiracaoRefresh));
}

@SecurityRequirements()
@PostMapping("/verificar-jwt")
public ResponseEntity<String> verificarJwt(@RequestBody Map<String, String> body) {
String tokenAcesso = body.get("tokenAcesso");
Expand Down
Loading