From 0de7b69b1b70ac20df45eff5ed940d1a1c0eef33 Mon Sep 17 00:00:00 2001 From: Anthony Debucquoy Date: Thu, 29 Feb 2024 08:53:33 +0100 Subject: [PATCH 1/2] enable jpa library for managing data --- backend/build.gradle.kts | 1 + 1 file changed, 1 insertion(+) diff --git a/backend/build.gradle.kts b/backend/build.gradle.kts index 91c7679..007222b 100644 --- a/backend/build.gradle.kts +++ b/backend/build.gradle.kts @@ -17,6 +17,7 @@ repositories { dependencies { implementation("org.springframework.boot:spring-boot-starter-jdbc") + implementation("org.springframework.boot:spring-boot-starter-data-jpa") implementation("org.springframework.boot:spring-boot-starter-mail") implementation("org.springframework.boot:spring-boot-starter-web") // implementation("org.springframework.session:spring-session-jdbc") From caf11b5b197dfb68ec9cfcd09b7ef1c7cd2e57fe Mon Sep 17 00:00:00 2001 From: Anthony Debucquoy Date: Fri, 1 Mar 2024 18:43:56 +0100 Subject: [PATCH 2/2] Refactoring backend (#42) removing cors fails. refactoring ping as a proposal for rest endpoints locations Reviewed-on: https://git.herisson.ovh/PGL/Clyde/pulls/42 Reviewed-by: Maxime <231026@umons.ac.be> Co-authored-by: Anthony Debucquoy Co-committed-by: Anthony Debucquoy --- .../ovh/herisson/Clyde/EndPoints/PingController.java | 6 +++--- .../src/main/java/ovh/herisson/Clyde/JdbcConfig.java | 12 ------------ backend/src/main/java/ovh/herisson/Clyde/Ping.java | 3 --- .../ovh/herisson/Clyde/Responses/PingResponse.java | 3 +++ 4 files changed, 6 insertions(+), 18 deletions(-) delete mode 100644 backend/src/main/java/ovh/herisson/Clyde/Ping.java create mode 100644 backend/src/main/java/ovh/herisson/Clyde/Responses/PingResponse.java diff --git a/backend/src/main/java/ovh/herisson/Clyde/EndPoints/PingController.java b/backend/src/main/java/ovh/herisson/Clyde/EndPoints/PingController.java index b937610..f0f26d3 100644 --- a/backend/src/main/java/ovh/herisson/Clyde/EndPoints/PingController.java +++ b/backend/src/main/java/ovh/herisson/Clyde/EndPoints/PingController.java @@ -4,15 +4,15 @@ import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.CrossOrigin; import org.springframework.web.bind.annotation.RestController; -import ovh.herisson.Clyde.Ping; +import ovh.herisson.Clyde.Responses.PingResponse; @RestController @CrossOrigin(origins = "http://localhost:5173") public class PingController { @GetMapping("/ping") - public Ping ping(){ - return new Ping(1, "pong"); + public PingResponse ping(){ + return new PingResponse(1, "pong"); } } diff --git a/backend/src/main/java/ovh/herisson/Clyde/JdbcConfig.java b/backend/src/main/java/ovh/herisson/Clyde/JdbcConfig.java index 84c808f..c310d52 100644 --- a/backend/src/main/java/ovh/herisson/Clyde/JdbcConfig.java +++ b/backend/src/main/java/ovh/herisson/Clyde/JdbcConfig.java @@ -34,16 +34,4 @@ public class JdbcConfig { return source; } - - - @Bean - public WebMvcConfigurer corsConfigurer() { - return new WebMvcConfigurer() { - @Override - public void addCorsMappings(CorsRegistry registry) { - registry.addMapping("/greeting-javaconfig").allowedOrigins("*"); - } - }; - } - } diff --git a/backend/src/main/java/ovh/herisson/Clyde/Ping.java b/backend/src/main/java/ovh/herisson/Clyde/Ping.java deleted file mode 100644 index 757b1e2..0000000 --- a/backend/src/main/java/ovh/herisson/Clyde/Ping.java +++ /dev/null @@ -1,3 +0,0 @@ -package ovh.herisson.Clyde; - -public record Ping(int id, String txt){}; diff --git a/backend/src/main/java/ovh/herisson/Clyde/Responses/PingResponse.java b/backend/src/main/java/ovh/herisson/Clyde/Responses/PingResponse.java new file mode 100644 index 0000000..a68d19d --- /dev/null +++ b/backend/src/main/java/ovh/herisson/Clyde/Responses/PingResponse.java @@ -0,0 +1,3 @@ +package ovh.herisson.Clyde.Responses; + +public record PingResponse(int id, String txt){};