From 184642a7507e142809da1b71091d7ce2608a4f69 Mon Sep 17 00:00:00 2001 From: Pierre Tellier Date: Wed, 12 Feb 2025 11:32:41 +0100 Subject: [PATCH 01/19] fix: coherent syntax --- MyINPulse-back/build.gradle | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/MyINPulse-back/build.gradle b/MyINPulse-back/build.gradle index 5d1c2fd..abb4635 100644 --- a/MyINPulse-back/build.gradle +++ b/MyINPulse-back/build.gradle @@ -21,8 +21,8 @@ dependencies { implementation 'org.springframework.boot:spring-boot-starter-oauth2-resource-server' implementation 'org.springframework.boot:spring-boot-starter-web' implementation 'org.springframework.boot:spring-boot-starter-data-jpa' - implementation('org.springframework.boot:spring-boot-starter-validation') - implementation('org.springframework.boot:spring-boot-starter-data-rest') + implementation 'org.springframework.boot:spring-boot-starter-validation' + implementation 'org.springframework.boot:spring-boot-starter-data-rest' implementation 'org.postgresql:postgresql' testImplementation 'org.springframework.boot:spring-boot-starter-test' testRuntimeOnly 'org.junit.platform:junit-platform-launcher' From e7cb8cf469dc414ca640f9c309cd54c838b3b591 Mon Sep 17 00:00:00 2001 From: Pierre Tellier Date: Wed, 12 Feb 2025 11:34:11 +0100 Subject: [PATCH 02/19] feat: single .env file --- Makefile | 22 +++++++++++-------- .../src/main/resources/application.properties | 9 +++----- config/{frontdev.main.env => backdev.env} | 8 +++++++ config/backdev.front.env | 5 ----- config/{backdev.main.env => frontdev.env} | 10 ++++++++- config/frontdev.front.env | 5 ----- config/{prod.main.env => prod.env} | 8 +++++++ config/prod.front.env | 5 ----- 8 files changed, 41 insertions(+), 31 deletions(-) rename config/{frontdev.main.env => backdev.env} (64%) delete mode 100644 config/backdev.front.env rename config/{backdev.main.env => frontdev.env} (56%) delete mode 100644 config/frontdev.front.env rename config/{prod.main.env => prod.env} (61%) delete mode 100644 config/prod.front.env diff --git a/Makefile b/Makefile index 26d5ccb..1e3a808 100644 --- a/Makefile +++ b/Makefile @@ -7,7 +7,7 @@ clean: @rm -f docker-compose.yaml @rm -f .env @rm -f front/MyINPulse-front/.env - + @rm -f MyINPulse-back/.env # Install npm packages front/MyINPulse-front/.installed: @@ -18,24 +18,28 @@ vite: ./front/MyINPulse-front/.installed dev-front: clean vite - @cp config/frontdev.front.env front/MyINPulse-front/.env - @cp config/frontdev.main.env .env + @cp config/frontdev.env front/MyINPulse-front/.env + @cp config/frontdev.env .env + @cp config/frontdev.env MyINPulse-back/.env @cp config/frontdev.docker-compose.yaml docker-compose.yaml @docker compose up -d --build @cd ./front/MyINPulse-front/ && npm run dev prod: clean - @cp config/prod.front.env front/MyINPulse-front/.env - @cp config/prod.main.env .env + @cp config/prod.env front/MyINPulse-front/.env + @cp config/prod.env .env + @cp config/prod.env .env @cp config/prod.docker-compose.yaml docker-compose.yaml @docker compose up -d --build dev-back: - @cp config/backdev.front.env front/MyINPulse-front/.env - @cp config/backdev.main.env .env + @cp config/backdev.env front/MyINPulse-front/.env + @cp config/backdev.env .env + @cp config/backdev.env MyINPulse-back/.env @cp config/backdev.docker-compose.yaml docker-compose.yaml @docker compose up -d --build - @echo "cd MyINPulse-back" - @echo "./gradlew bootRun --args='--server.port=8081'" \ No newline at end of file + @echo "cd MyINPulse-back" && echo 'export $$(cat .env | xargs)' + @echo "./gradlew bootRun --args='--server.port=8081'" + \ No newline at end of file diff --git a/MyINPulse-back/src/main/resources/application.properties b/MyINPulse-back/src/main/resources/application.properties index e67e4f6..cc1afe6 100644 --- a/MyINPulse-back/src/main/resources/application.properties +++ b/MyINPulse-back/src/main/resources/application.properties @@ -2,11 +2,8 @@ spring.application.name=myinpulse spring.security.oauth2.resourceserver.jwt.jwk-set-uri=http://localhost:7080/realms/test/protocol/openid-connect/certs spring.security.oauth2.resourceserver.jwt.issuer-uri=http://localhost:7080/realms/test logging.level.org.springframework.security=DEBUG -#spring.datasource.url=jdbc:postgresql://postgres/${POSTGRES_DB} -spring.datasource.url=jdbc:postgresql://localhost:5433/backend_db -spring.datasource.username=backend_db_user -spring.datasource.password=backend_db_user_password +spring.datasource.url=jdbc:postgresql://${DATABASE_URL}/${BACKEND_DB} +spring.datasource.username=${BACKEND_USER} +spring.datasource.password=${BACKEND_PASSWORD} spring.jpa.hibernate.ddl-auto=update spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.PostgreSQLDialect - -spring.data.rest.base-path=/my/base/path \ No newline at end of file diff --git a/config/frontdev.main.env b/config/backdev.env similarity index 64% rename from config/frontdev.main.env rename to config/backdev.env index 26c2803..a7e5517 100644 --- a/config/frontdev.main.env +++ b/config/backdev.env @@ -12,3 +12,11 @@ KEYCLOAK_PASSWORD=keycloak_db_user_password BACKEND_DB=backend_db BACKEND_USER=backend_db_user BACKEND_PASSWORD=backend_db_user_password + +DATABASE_URL=localhost:5433 + +VITE_KEYCLOAK_URL=http://localhost:7080 +VITE_KEYCLOAK_CLIENT_ID=myinpulse +VITE_KEYCLOAK_REALM=test +VITE_APP_URL=http://localhost:8080 +VITE_BACKEND_URL=http://localhost:8081/ diff --git a/config/backdev.front.env b/config/backdev.front.env deleted file mode 100644 index 27cf54e..0000000 --- a/config/backdev.front.env +++ /dev/null @@ -1,5 +0,0 @@ -VITE_KEYCLOAK_URL=http://localhost:7080 -VITE_KEYCLOAK_CLIENT_ID=myinpulse -VITE_KEYCLOAK_REALM=test -VITE_APP_URL=http://localhost:8080 -VITE_BACKEND_URL=http://localhost:8081/ diff --git a/config/backdev.main.env b/config/frontdev.env similarity index 56% rename from config/backdev.main.env rename to config/frontdev.env index 2a597c3..ed4a23b 100644 --- a/config/backdev.main.env +++ b/config/frontdev.env @@ -11,4 +11,12 @@ KEYCLOAK_PASSWORD=keycloak_db_user_password BACKEND_DB=backend_db BACKEND_USER=backend_db_user -BACKEND_PASSWORD=backend_db_user_password \ No newline at end of file +BACKEND_PASSWORD=backend_db_user_password + +DATABASE_URL=MyINPulse-DB + +VITE_KEYCLOAK_URL=http://localhost:7080 +VITE_KEYCLOAK_CLIENT_ID=myinpulse-dev +VITE_KEYCLOAK_REALM=test +VITE_APP_URL=http://localhost:5173 +VITE_BACKEND_URL=http://localhost:8081/ diff --git a/config/frontdev.front.env b/config/frontdev.front.env deleted file mode 100644 index 5eba221..0000000 --- a/config/frontdev.front.env +++ /dev/null @@ -1,5 +0,0 @@ -VITE_KEYCLOAK_URL=http://localhost:7080 -VITE_KEYCLOAK_CLIENT_ID=myinpulse-dev -VITE_KEYCLOAK_REALM=test -VITE_APP_URL=http://localhost:5173 -VITE_BACKEND_URL=http://localhost:8081/ diff --git a/config/prod.main.env b/config/prod.env similarity index 61% rename from config/prod.main.env rename to config/prod.env index 179d92c..2fb8da9 100644 --- a/config/prod.main.env +++ b/config/prod.env @@ -12,3 +12,11 @@ KEYCLOAK_PASSWORD=keycloak_db_user_password BACKEND_DB=backend_db BACKEND_USER=backend_db_user BACKEND_PASSWORD=backend_db_user_password + +DATABASE_URL=MyINPulse-DB + +VITE_KEYCLOAK_URL=https://0549cd63f912d5dc9b31278d6f.eirb.fr +VITE_KEYCLOAK_CLIENT_ID=myinpulse-eirb +VITE_KEYCLOAK_REALM=test +VITE_APP_URL=https://0549cd63f912d5dc9b31278d6f.piair.dev +VITE_BACKEND_URL=http://TODO/ diff --git a/config/prod.front.env b/config/prod.front.env deleted file mode 100644 index cb42a37..0000000 --- a/config/prod.front.env +++ /dev/null @@ -1,5 +0,0 @@ -VITE_KEYCLOAK_URL=https://0549cd63f912d5dc9b31278d6f.eirb.fr -VITE_KEYCLOAK_CLIENT_ID=myinpulse-eirb -VITE_KEYCLOAK_REALM=test -VITE_APP_URL=https://0549cd63f912d5dc9b31278d6f.piair.dev -VITE_BACKEND_URL=http://TODO/ From 013b97cec0268cbaa7a60f9b23c4f03015c775d7 Mon Sep 17 00:00:00 2001 From: Pierre Tellier Date: Wed, 12 Feb 2025 11:34:57 +0100 Subject: [PATCH 03/19] test: check if the action is now red --- .../myinpulse/config/WebSecurityCustomConfiguration.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MyINPulse-back/src/main/java/enseirb/myinpulse/config/WebSecurityCustomConfiguration.java b/MyINPulse-back/src/main/java/enseirb/myinpulse/config/WebSecurityCustomConfiguration.java index 43a9889..b3525af 100644 --- a/MyINPulse-back/src/main/java/enseirb/myinpulse/config/WebSecurityCustomConfiguration.java +++ b/MyINPulse-back/src/main/java/enseirb/myinpulse/config/WebSecurityCustomConfiguration.java @@ -15,7 +15,7 @@ import java.util.List; import static org.springframework.security.authorization.AuthorityAuthorizationManager.hasRole; @Configuration -public class WebSecurityCustomConfiguration { +public class WebSecurityCustomConfiguration{ // CORS configuration // TODO: make sure to only accept our own domains @Bean From 1ed976b039468cb5ac17a0d73f4893a189f84fa9 Mon Sep 17 00:00:00 2001 From: Pierre Tellier Date: Wed, 12 Feb 2025 11:42:16 +0100 Subject: [PATCH 04/19] fix: now only show the incorrect files --- .gitea/workflows/back.yaml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.gitea/workflows/back.yaml b/.gitea/workflows/back.yaml index bd6f476..10718aa 100644 --- a/.gitea/workflows/back.yaml +++ b/.gitea/workflows/back.yaml @@ -14,6 +14,4 @@ jobs: java-version: '21' - uses: axel-op/googlejavaformat-action@v3 with: - args: "--set-exit-if-changed --skip-sorting-imports --aosp" - - name: Print diffs - run: git --no-pager diff --exit-code \ No newline at end of file + args: "--set-exit-if-changed --skip-sorting-imports --aosp -n" From 6e5651c527019ccfbfcd8152fa457a89ff657e59 Mon Sep 17 00:00:00 2001 From: Pierre Tellier Date: Wed, 12 Feb 2025 12:04:19 +0100 Subject: [PATCH 05/19] fix: remove dialect to supress a warning --- MyINPulse-back/src/main/resources/application.properties | 1 - 1 file changed, 1 deletion(-) diff --git a/MyINPulse-back/src/main/resources/application.properties b/MyINPulse-back/src/main/resources/application.properties index cc1afe6..08dccb9 100644 --- a/MyINPulse-back/src/main/resources/application.properties +++ b/MyINPulse-back/src/main/resources/application.properties @@ -6,4 +6,3 @@ spring.datasource.url=jdbc:postgresql://${DATABASE_URL}/${BACKEND_DB} spring.datasource.username=${BACKEND_USER} spring.datasource.password=${BACKEND_PASSWORD} spring.jpa.hibernate.ddl-auto=update -spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.PostgreSQLDialect From 07f66f65ed4764ab12b0dacbcac92d6db263c939 Mon Sep 17 00:00:00 2001 From: Pierre Tellier Date: Wed, 12 Feb 2025 12:04:59 +0100 Subject: [PATCH 06/19] feat: comments and security comfiguration improved. --- .../WebSecurityCustomConfiguration.java | 35 ++++++++++++++----- 1 file changed, 27 insertions(+), 8 deletions(-) diff --git a/MyINPulse-back/src/main/java/enseirb/myinpulse/config/WebSecurityCustomConfiguration.java b/MyINPulse-back/src/main/java/enseirb/myinpulse/config/WebSecurityCustomConfiguration.java index b3525af..637b6c2 100644 --- a/MyINPulse-back/src/main/java/enseirb/myinpulse/config/WebSecurityCustomConfiguration.java +++ b/MyINPulse-back/src/main/java/enseirb/myinpulse/config/WebSecurityCustomConfiguration.java @@ -1,6 +1,7 @@ package enseirb.myinpulse.config; import enseirb.myinpulse.security.KeycloakJwtRolesConverter; +import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.security.config.annotation.web.builders.HttpSecurity; @@ -14,37 +15,55 @@ import java.util.List; import static org.springframework.security.authorization.AuthorityAuthorizationManager.hasRole; + @Configuration -public class WebSecurityCustomConfiguration{ +public class WebSecurityCustomConfiguration { // CORS configuration - // TODO: make sure to only accept our own domains + + @Value("${VITE_APP_URL}") + private String frontendUrl; + + /** + * Configure the CORS (Cross Origin Ressource Sharing -- a security feature) configuration. + * The only allowed website is the frontend, defined in the .env file. + * + * @return the CORS configuration used by the backend + */ @Bean public CorsConfigurationSource corsConfigurationSource() { CorsConfiguration configuration = new CorsConfiguration(); - configuration.setAllowedOrigins(List.of("*")); + configuration.setAllowedOrigins(List.of(frontendUrl)); configuration.setAllowedMethods(Arrays.asList("GET", "OPTIONS")); configuration.setAllowedHeaders( Arrays.asList( "authorization", "content-type", - "x-auth-token")); // Do not remove, this fixes the CORS errors when - // unauthenticated + "x-auth-token")); UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource(); source.registerCorsConfiguration("/**", configuration); return source; } + /** + * Configure the authorisation required for each path. + * admin endpoints are under /admin/* and entrepreneur are under /entrepreneur/* + * If endpoints dont require authentication, they are under /unauth/ + * + * @param http automatically filled in by spring. + * @return a securityfilterchain, automatically used by spring. + * @throws Exception TODO: figure out when the exception are raised + */ @Bean public SecurityFilterChain filterChain(HttpSecurity http) throws Exception { http.authorizeHttpRequests( authorize -> authorize - .requestMatchers("/random2") + .requestMatchers("/entrepreneur/**") .access(hasRole("REALM_MyINPulse-entrepreneur")) - .requestMatchers("/random") + .requestMatchers("/admin/**") .access(hasRole("REALM_MyINPulse-admin")) - .requestMatchers("/random3") + .requestMatchers("/unauth/**") .permitAll() .anyRequest() .authenticated()) From 43aadac5031bdbc95479099992142dae9d65c1d1 Mon Sep 17 00:00:00 2001 From: Pierre Tellier Date: Wed, 12 Feb 2025 12:23:04 +0100 Subject: [PATCH 07/19] feat: reflected changes of path change --- .../enseirb/myinpulse/api/GetUserInfo.java | 25 +++---------------- 1 file changed, 3 insertions(+), 22 deletions(-) diff --git a/MyINPulse-back/src/main/java/enseirb/myinpulse/api/GetUserInfo.java b/MyINPulse-back/src/main/java/enseirb/myinpulse/api/GetUserInfo.java index 63aef48..ad008f0 100644 --- a/MyINPulse-back/src/main/java/enseirb/myinpulse/api/GetUserInfo.java +++ b/MyINPulse-back/src/main/java/enseirb/myinpulse/api/GetUserInfo.java @@ -1,43 +1,24 @@ package enseirb.myinpulse.api; import org.springframework.boot.autoconfigure.SpringBootApplication; -import org.springframework.security.core.context.SecurityContextHolder; import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RestController; -import org.springframework.web.bind.annotation.CrossOrigin; - -import java.security.Principal; @SpringBootApplication @RestController public class GetUserInfo { - // TODO: understand how to get data - @GetMapping("/getUserInfo") - public Object user(Principal principal) { - System.out.println("GetUserInfo + " + principal); - System.out.println(SecurityContextHolder.getContext().getAuthentication()); - return SecurityContextHolder.getContext().getAuthentication().getPrincipal(); - } - - @CrossOrigin(methods = {RequestMethod.GET, RequestMethod.OPTIONS}) - @GetMapping("/random") + @GetMapping("/unauth/random") public boolean rand() { - System.err.println("HELLO"); return Math.random() > 0.5; } - @CrossOrigin(methods = {RequestMethod.GET, RequestMethod.OPTIONS}) - @GetMapping("/random2") + @GetMapping("/admin/random") public boolean rand2() { - System.err.println("HELLO2"); return Math.random() > 0.5; } - @CrossOrigin(methods = {RequestMethod.GET, RequestMethod.OPTIONS}) - @GetMapping("/random3") + @GetMapping("/entrepreneur/random") public boolean rand3() { - System.err.println("HELLO"); return Math.random() > 0.5; } } From 525f98a05480d7e2839819be55445e63a2b60617 Mon Sep 17 00:00:00 2001 From: Pierre Tellier Date: Wed, 12 Feb 2025 12:23:53 +0100 Subject: [PATCH 08/19] feat: new makefile option --- Makefile | 16 +++++++++-- config/dev.docker-compose.yaml | 52 ++++++++++++++++++++++++++++++++++ config/dev.env | 22 ++++++++++++++ 3 files changed, 88 insertions(+), 2 deletions(-) create mode 100644 config/dev.docker-compose.yaml create mode 100644 config/dev.env diff --git a/Makefile b/Makefile index 1e3a808..617387b 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,10 @@ help: - @echo "make [clean dev-front prod dev-back]" + @echo "make [clean dev-front prod dev-back dev]" clean: + @cp config/frontdev.env front/MyINPulse-front/.env + @cp config/frontdev.env .env + @cp config/frontdev.env MyINPulse-back/.env @cp config/prod.docker-compose.yaml docker-compose.yaml @docker compose down @rm -f docker-compose.yaml @@ -42,4 +45,13 @@ dev-back: @docker compose up -d --build @echo "cd MyINPulse-back" && echo 'export $$(cat .env | xargs)' @echo "./gradlew bootRun --args='--server.port=8081'" - \ No newline at end of file + +dev: clean vite + @cp config/dev.env front/MyINPulse-front/.env + @cp config/dev.env .env + @cp config/dev.env MyINPulse-back/.env + @cp config/dev.docker-compose.yaml docker-compose.yaml + @docker compose up -d --build + @echo "cd MyINPulse-back" && echo 'export $$(cat .env | xargs)' + @echo "./gradlew bootRun --args='--server.port=8081'" + @cd ./front/MyINPulse-front/ && npm run dev & diff --git a/config/dev.docker-compose.yaml b/config/dev.docker-compose.yaml new file mode 100644 index 0000000..d66d92a --- /dev/null +++ b/config/dev.docker-compose.yaml @@ -0,0 +1,52 @@ +services: + postgres: + env_file: .env + build: + context: postgres/ + dockerfile: Dockerfile + container_name: MyINPulse-DB + ports: + - 5433:5432 + volumes: + - ./postgres/data:/var/lib/postgresql/data + + + keycloak: + container_name: MyINPulse-keycloak + build: + context: ./keycloak + dockerfile: Dockerfile + args: + KC_DB: postgres + KC_DB_URL: jdbc:postgresql://postgres/${POSTGRES_DB} + KC_DB_USERNAME: ${POSTGRES_USER} + KC_DB_PASSWORD: ${POSTGRES_PASSWORD} + environment: + KC_HOSTNAME_PORT: 7080 + KC_HOSTNAME_STRICT_BACKCHANNEL: "true" + KC_BOOTSTRAP_ADMIN_USERNAME: ${KEYCLOAK_ADMIN} + KC_BOOTSTRAP_ADMIN_PASSWORD: ${KEYCLOAK_ADMIN_PASSWORD} + KC_LOG_LEVEL: info + command: ["start-dev", "--http-port", "7080", "--https-port", "7443", "--hostname", "${KEYCLOAK_HOSTNAME}"] + ports: + - "7080:7080" + - "7443:7443" + depends_on: + - postgres + + #front: + # build: + # context: ./front/ + # dockerfile: Dockerfile + # container_name: MyINPulse-front + # ports: + # - "8080:80" + + #back: + # build: + # context: ./MyINPulse-back/ + # dockerfile: Dockerfile + # container_name: MyINPulse-back + # ports: + # - "8081:8080" + \ No newline at end of file diff --git a/config/dev.env b/config/dev.env new file mode 100644 index 0000000..bcd45f3 --- /dev/null +++ b/config/dev.env @@ -0,0 +1,22 @@ +POSTGRES_DB=postgres_db +POSTGRES_USER=postgres +POSTGRES_PASSWORD=postgres_db_user_password + +KEYCLOAK_ADMIN=admin +KEYCLOAK_ADMIN_PASSWORD=admin +KEYCLOAK_HOSTNAME=localhost +KEYCLOAK_DB=keycloak_db +KEYCLOAK_USER=keycloak_db_user +KEYCLOAK_PASSWORD=keycloak_db_user_password + +BACKEND_DB=backend_db +BACKEND_USER=backend_db_user +BACKEND_PASSWORD=backend_db_user_password + +DATABASE_URL=localhost:5433 + +VITE_KEYCLOAK_URL=http://localhost:7080 +VITE_KEYCLOAK_CLIENT_ID=myinpulse-dev +VITE_KEYCLOAK_REALM=test +VITE_APP_URL=http://localhost:5173 +VITE_BACKEND_URL=http://localhost:8081/ From d77f38b405f78df57b4af909dcade88ac79da487 Mon Sep 17 00:00:00 2001 From: Pierre Tellier Date: Wed, 12 Feb 2025 12:24:15 +0100 Subject: [PATCH 09/19] fix: removed exposed ports on the frontend --- config/prod.docker-compose.yaml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/config/prod.docker-compose.yaml b/config/prod.docker-compose.yaml index 51f2d76..496efb3 100644 --- a/config/prod.docker-compose.yaml +++ b/config/prod.docker-compose.yaml @@ -30,10 +30,10 @@ services: KC_BOOTSTRAP_ADMIN_USERNAME: ${KEYCLOAK_ADMIN} KC_BOOTSTRAP_ADMIN_PASSWORD: ${KEYCLOAK_ADMIN_PASSWORD} KC_LOG_LEVEL: info - command: ["start-dev", "--http-port", "7080", "--https-port", "7443", "--hostname", "${KEYCLOAK_HOSTNAME}"] - ports: - - "7080:7080" - - "7443:7443" + command: ["start-dev", "--http-port", "7080", "--https-port", "7443", "--hostname", "${KEYCLOAK_HOSTNAME}"] # TODO: remove start-dev + #ports: + # - "7080:7080" + # - "7443:7443" depends_on: - postgres @@ -50,6 +50,6 @@ services: context: ./MyINPulse-back/ dockerfile: Dockerfile container_name: MyINPulse-back - ports: - - "8081:8080" + #ports: + # - "8081:8080" \ No newline at end of file From 208cbbfa1d59b9b8dbc80a232cef92e4a5552d4e Mon Sep 17 00:00:00 2001 From: Pierre Tellier Date: Wed, 12 Feb 2025 14:51:37 +0100 Subject: [PATCH 10/19] feat: now uses intellij --- .gitea/workflows/back.yaml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.gitea/workflows/back.yaml b/.gitea/workflows/back.yaml index 10718aa..ee533f9 100644 --- a/.gitea/workflows/back.yaml +++ b/.gitea/workflows/back.yaml @@ -12,6 +12,7 @@ jobs: with: distribution: 'temurin' # See 'Supported distributions' for available options java-version: '21' - - uses: axel-op/googlejavaformat-action@v3 + - uses: findologic/intellij-format-action@v1.1.0 with: - args: "--set-exit-if-changed --skip-sorting-imports --aosp -n" + include-glob: '*.kt,*.java' + path: . From b00c28a02ac589f749cf33e4c68322fb06413697 Mon Sep 17 00:00:00 2001 From: Pierre Tellier Date: Wed, 12 Feb 2025 14:54:27 +0100 Subject: [PATCH 11/19] fix: now uses the correct version --- .gitea/workflows/back.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitea/workflows/back.yaml b/.gitea/workflows/back.yaml index ee533f9..5211e51 100644 --- a/.gitea/workflows/back.yaml +++ b/.gitea/workflows/back.yaml @@ -12,7 +12,7 @@ jobs: with: distribution: 'temurin' # See 'Supported distributions' for available options java-version: '21' - - uses: findologic/intellij-format-action@v1.1.0 + - uses: findologic/intellij-format-action@v1.0.1 with: include-glob: '*.kt,*.java' path: . From dacb0dd179974c8c28db4d7bd5913e708bdf6a35 Mon Sep 17 00:00:00 2001 From: Pierre Tellier Date: Wed, 12 Feb 2025 14:56:09 +0100 Subject: [PATCH 12/19] fix: now uses another library --- .gitea/workflows/back.yaml | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/.gitea/workflows/back.yaml b/.gitea/workflows/back.yaml index 5211e51..e8d3617 100644 --- a/.gitea/workflows/back.yaml +++ b/.gitea/workflows/back.yaml @@ -12,7 +12,10 @@ jobs: with: distribution: 'temurin' # See 'Supported distributions' for available options java-version: '21' - - uses: findologic/intellij-format-action@v1.0.1 + - name: Check IntelliJ Formatting + uses: sidhant92/intellij-format-action@v1 with: - include-glob: '*.kt,*.java' - path: . + tool_name: 'IntelliJ Diff' + fail_on_changes: true + path: './MyINPulse-back/' + file_mask: '*.java' From c739b4d26d669c0e1df353fb3e792dc98f2467bb Mon Sep 17 00:00:00 2001 From: Pierre Tellier Date: Wed, 12 Feb 2025 15:07:36 +0100 Subject: [PATCH 13/19] test: syntax validataion --- .gitea/workflows/back.yaml | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/.gitea/workflows/back.yaml b/.gitea/workflows/back.yaml index e8d3617..80b451a 100644 --- a/.gitea/workflows/back.yaml +++ b/.gitea/workflows/back.yaml @@ -13,9 +13,8 @@ jobs: distribution: 'temurin' # See 'Supported distributions' for available options java-version: '21' - name: Check IntelliJ Formatting - uses: sidhant92/intellij-format-action@v1 + uses: findologic/intellij-format-action with: - tool_name: 'IntelliJ Diff' - fail_on_changes: true - path: './MyINPulse-back/' - file_mask: '*.java' + include-glob: '*.kt,*.java' + path: . + fail-on-changes: true From db094a8d86d173e300bf6317267af40ac1b40081 Mon Sep 17 00:00:00 2001 From: Pierre Tellier Date: Wed, 12 Feb 2025 15:09:42 +0100 Subject: [PATCH 14/19] test: syntax validataion --- .gitea/workflows/back.yaml | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/.gitea/workflows/back.yaml b/.gitea/workflows/back.yaml index 80b451a..2d6b648 100644 --- a/.gitea/workflows/back.yaml +++ b/.gitea/workflows/back.yaml @@ -13,8 +13,6 @@ jobs: distribution: 'temurin' # See 'Supported distributions' for available options java-version: '21' - name: Check IntelliJ Formatting - uses: findologic/intellij-format-action - with: - include-glob: '*.kt,*.java' - path: . - fail-on-changes: true + - uses: joutvhu/intellij-format@v1 + with: + verify: true \ No newline at end of file From 6befd10735550b7a2ff9488de3d22fad26b117d7 Mon Sep 17 00:00:00 2001 From: Pierre Tellier Date: Wed, 12 Feb 2025 15:10:59 +0100 Subject: [PATCH 15/19] test: syntax validation --- .gitea/workflows/back.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitea/workflows/back.yaml b/.gitea/workflows/back.yaml index 2d6b648..bf333ae 100644 --- a/.gitea/workflows/back.yaml +++ b/.gitea/workflows/back.yaml @@ -12,7 +12,7 @@ jobs: with: distribution: 'temurin' # See 'Supported distributions' for available options java-version: '21' - - name: Check IntelliJ Formatting + - uses: joutvhu/intellij-format@v1 with: verify: true \ No newline at end of file From 8b24456b487a2725e1ce66f5fa4069e2a07a44b1 Mon Sep 17 00:00:00 2001 From: Pierre Tellier Date: Wed, 12 Feb 2025 15:14:48 +0100 Subject: [PATCH 16/19] feat: back to google as I can't make the other one work --- .gitea/workflows/back.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.gitea/workflows/back.yaml b/.gitea/workflows/back.yaml index bf333ae..31aa219 100644 --- a/.gitea/workflows/back.yaml +++ b/.gitea/workflows/back.yaml @@ -13,6 +13,6 @@ jobs: distribution: 'temurin' # See 'Supported distributions' for available options java-version: '21' - - uses: joutvhu/intellij-format@v1 - with: - verify: true \ No newline at end of file + - uses: axel-op/googlejavaformat-action@v3 + with: + args: "--set-exit-if-changed --skip-sorting-imports --aosp -n" \ No newline at end of file From 746fa97cf3148038b62abb3e218a521281613592 Mon Sep 17 00:00:00 2001 From: Pierre Tellier Date: Wed, 12 Feb 2025 15:29:12 +0100 Subject: [PATCH 17/19] fix: applied formatter (on all import as well :) --- .../WebSecurityCustomConfiguration.java | 21 ++- .../controller/AdministrateursController.java | 4 +- .../controller/ComptesRendusController.java | 4 +- .../controller/EntrepreneursController.java | 4 +- .../controller/ProjetsController.java | 6 +- .../controller/RendezVousController.java | 8 +- .../controller/SectionsController.java | 6 +- .../controller/UtilisateursController.java | 4 +- .../postgres_db/model/Administrateurs.java | 1 + .../myinpulse/postgres_db/model/Projets.java | 1 + .../postgres_db/model/RendezVous.java | 41 ++--- .../repository/AdministrateursRepository.java | 1 + .../repository/ComptesRendusRepository.java | 1 + .../repository/EntrepreneursRepository.java | 1 + .../repository/ProjetsRepository.java | 1 + .../repository/RendezVousRepository.java | 1 + .../repository/SectionsRepository.java | 1 + .../repository/UtilisateursRepository.java | 1 + .../security/KeycloakJwtRolesConverter.java | 4 +- MyINPulse-back/src/main/resources/data.sql | 96 +++++++----- MyINPulse-back/src/main/resources/schema.sql | 148 ++++++++++-------- 21 files changed, 197 insertions(+), 158 deletions(-) diff --git a/MyINPulse-back/src/main/java/enseirb/myinpulse/config/WebSecurityCustomConfiguration.java b/MyINPulse-back/src/main/java/enseirb/myinpulse/config/WebSecurityCustomConfiguration.java index 637b6c2..b8f0e4f 100644 --- a/MyINPulse-back/src/main/java/enseirb/myinpulse/config/WebSecurityCustomConfiguration.java +++ b/MyINPulse-back/src/main/java/enseirb/myinpulse/config/WebSecurityCustomConfiguration.java @@ -1,6 +1,9 @@ package enseirb.myinpulse.config; +import static org.springframework.security.authorization.AuthorityAuthorizationManager.hasRole; + import enseirb.myinpulse.security.KeycloakJwtRolesConverter; + import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; @@ -13,9 +16,6 @@ import org.springframework.web.cors.UrlBasedCorsConfigurationSource; import java.util.Arrays; import java.util.List; -import static org.springframework.security.authorization.AuthorityAuthorizationManager.hasRole; - - @Configuration public class WebSecurityCustomConfiguration { // CORS configuration @@ -24,8 +24,8 @@ public class WebSecurityCustomConfiguration { private String frontendUrl; /** - * Configure the CORS (Cross Origin Ressource Sharing -- a security feature) configuration. - * The only allowed website is the frontend, defined in the .env file. + * Configure the CORS (Cross Origin Ressource Sharing -- a security feature) configuration. The + * only allowed website is the frontend, defined in the .env file. * * @return the CORS configuration used by the backend */ @@ -35,10 +35,7 @@ public class WebSecurityCustomConfiguration { configuration.setAllowedOrigins(List.of(frontendUrl)); configuration.setAllowedMethods(Arrays.asList("GET", "OPTIONS")); configuration.setAllowedHeaders( - Arrays.asList( - "authorization", - "content-type", - "x-auth-token")); + Arrays.asList("authorization", "content-type", "x-auth-token")); UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource(); source.registerCorsConfiguration("/**", configuration); @@ -47,8 +44,10 @@ public class WebSecurityCustomConfiguration { /** * Configure the authorisation required for each path. - * admin endpoints are under /admin/* and entrepreneur are under /entrepreneur/* - * If endpoints dont require authentication, they are under /unauth/ + * + *

admin endpoints are under /admin/* and entrepreneur are under /entrepreneur/* + * + *

If endpoints dont require authentication, they are under /unauth/ * * @param http automatically filled in by spring. * @return a securityfilterchain, automatically used by spring. diff --git a/MyINPulse-back/src/main/java/enseirb/myinpulse/postgres_db/controller/AdministrateursController.java b/MyINPulse-back/src/main/java/enseirb/myinpulse/postgres_db/controller/AdministrateursController.java index 2a5d05e..b9a8259 100644 --- a/MyINPulse-back/src/main/java/enseirb/myinpulse/postgres_db/controller/AdministrateursController.java +++ b/MyINPulse-back/src/main/java/enseirb/myinpulse/postgres_db/controller/AdministrateursController.java @@ -2,12 +2,14 @@ package enseirb.myinpulse.postgres_db.controller; import enseirb.myinpulse.postgres_db.model.Administrateurs; import enseirb.myinpulse.postgres_db.repository.AdministrateursRepository; -import java.util.Optional; + import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; import org.springframework.web.bind.annotation.*; import org.springframework.web.server.ResponseStatusException; +import java.util.Optional; + @RestController public class AdministrateursController { diff --git a/MyINPulse-back/src/main/java/enseirb/myinpulse/postgres_db/controller/ComptesRendusController.java b/MyINPulse-back/src/main/java/enseirb/myinpulse/postgres_db/controller/ComptesRendusController.java index 312ae9e..5d35227 100644 --- a/MyINPulse-back/src/main/java/enseirb/myinpulse/postgres_db/controller/ComptesRendusController.java +++ b/MyINPulse-back/src/main/java/enseirb/myinpulse/postgres_db/controller/ComptesRendusController.java @@ -2,12 +2,14 @@ package enseirb.myinpulse.postgres_db.controller; import enseirb.myinpulse.postgres_db.model.ComptesRendus; import enseirb.myinpulse.postgres_db.repository.ComptesRendusRepository; -import java.util.Optional; + import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; import org.springframework.web.bind.annotation.*; import org.springframework.web.server.ResponseStatusException; +import java.util.Optional; + @RestController public class ComptesRendusController { diff --git a/MyINPulse-back/src/main/java/enseirb/myinpulse/postgres_db/controller/EntrepreneursController.java b/MyINPulse-back/src/main/java/enseirb/myinpulse/postgres_db/controller/EntrepreneursController.java index f789e0d..3124257 100644 --- a/MyINPulse-back/src/main/java/enseirb/myinpulse/postgres_db/controller/EntrepreneursController.java +++ b/MyINPulse-back/src/main/java/enseirb/myinpulse/postgres_db/controller/EntrepreneursController.java @@ -2,12 +2,14 @@ package enseirb.myinpulse.postgres_db.controller; import enseirb.myinpulse.postgres_db.model.Entrepreneurs; import enseirb.myinpulse.postgres_db.repository.EntrepreneursRepository; -import java.util.Optional; + import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; import org.springframework.web.bind.annotation.*; import org.springframework.web.server.ResponseStatusException; +import java.util.Optional; + @RestController public class EntrepreneursController { diff --git a/MyINPulse-back/src/main/java/enseirb/myinpulse/postgres_db/controller/ProjetsController.java b/MyINPulse-back/src/main/java/enseirb/myinpulse/postgres_db/controller/ProjetsController.java index f3a469c..62dfce2 100644 --- a/MyINPulse-back/src/main/java/enseirb/myinpulse/postgres_db/controller/ProjetsController.java +++ b/MyINPulse-back/src/main/java/enseirb/myinpulse/postgres_db/controller/ProjetsController.java @@ -2,13 +2,15 @@ package enseirb.myinpulse.postgres_db.controller; import enseirb.myinpulse.postgres_db.model.Projets; import enseirb.myinpulse.postgres_db.repository.ProjetsRepository; -import java.time.LocalDate; -import java.util.Optional; + import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; import org.springframework.web.bind.annotation.*; import org.springframework.web.server.ResponseStatusException; +import java.time.LocalDate; +import java.util.Optional; + @RestController public class ProjetsController { diff --git a/MyINPulse-back/src/main/java/enseirb/myinpulse/postgres_db/controller/RendezVousController.java b/MyINPulse-back/src/main/java/enseirb/myinpulse/postgres_db/controller/RendezVousController.java index 6f2a39f..027b394 100644 --- a/MyINPulse-back/src/main/java/enseirb/myinpulse/postgres_db/controller/RendezVousController.java +++ b/MyINPulse-back/src/main/java/enseirb/myinpulse/postgres_db/controller/RendezVousController.java @@ -2,14 +2,16 @@ package enseirb.myinpulse.postgres_db.controller; import enseirb.myinpulse.postgres_db.model.RendezVous; import enseirb.myinpulse.postgres_db.repository.RendezVousRepository; -import java.time.LocalDate; -import java.time.LocalDateTime; -import java.util.Optional; + import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; import org.springframework.web.bind.annotation.*; import org.springframework.web.server.ResponseStatusException; +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.util.Optional; + @RestController public class RendezVousController { diff --git a/MyINPulse-back/src/main/java/enseirb/myinpulse/postgres_db/controller/SectionsController.java b/MyINPulse-back/src/main/java/enseirb/myinpulse/postgres_db/controller/SectionsController.java index 5b4df39..7aaf15f 100644 --- a/MyINPulse-back/src/main/java/enseirb/myinpulse/postgres_db/controller/SectionsController.java +++ b/MyINPulse-back/src/main/java/enseirb/myinpulse/postgres_db/controller/SectionsController.java @@ -2,13 +2,15 @@ package enseirb.myinpulse.postgres_db.controller; import enseirb.myinpulse.postgres_db.model.Sections; import enseirb.myinpulse.postgres_db.repository.SectionsRepository; -import java.time.LocalDateTime; -import java.util.Optional; + import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; import org.springframework.web.bind.annotation.*; import org.springframework.web.server.ResponseStatusException; +import java.time.LocalDateTime; +import java.util.Optional; + @RestController public class SectionsController { diff --git a/MyINPulse-back/src/main/java/enseirb/myinpulse/postgres_db/controller/UtilisateursController.java b/MyINPulse-back/src/main/java/enseirb/myinpulse/postgres_db/controller/UtilisateursController.java index a6c128d..c6c8878 100644 --- a/MyINPulse-back/src/main/java/enseirb/myinpulse/postgres_db/controller/UtilisateursController.java +++ b/MyINPulse-back/src/main/java/enseirb/myinpulse/postgres_db/controller/UtilisateursController.java @@ -2,12 +2,14 @@ package enseirb.myinpulse.postgres_db.controller; import enseirb.myinpulse.postgres_db.model.Utilisateurs; import enseirb.myinpulse.postgres_db.repository.UtilisateursRepository; -import java.util.Optional; + import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; import org.springframework.web.bind.annotation.*; import org.springframework.web.server.ResponseStatusException; +import java.util.Optional; + @RestController public class UtilisateursController { diff --git a/MyINPulse-back/src/main/java/enseirb/myinpulse/postgres_db/model/Administrateurs.java b/MyINPulse-back/src/main/java/enseirb/myinpulse/postgres_db/model/Administrateurs.java index 30b70d1..ac42bdb 100644 --- a/MyINPulse-back/src/main/java/enseirb/myinpulse/postgres_db/model/Administrateurs.java +++ b/MyINPulse-back/src/main/java/enseirb/myinpulse/postgres_db/model/Administrateurs.java @@ -3,6 +3,7 @@ package enseirb.myinpulse.postgres_db.model; import jakarta.persistence.*; import jakarta.persistence.PrimaryKeyJoinColumn; import jakarta.persistence.Table; + import java.util.ArrayList; import java.util.List; diff --git a/MyINPulse-back/src/main/java/enseirb/myinpulse/postgres_db/model/Projets.java b/MyINPulse-back/src/main/java/enseirb/myinpulse/postgres_db/model/Projets.java index b49c12f..e543549 100644 --- a/MyINPulse-back/src/main/java/enseirb/myinpulse/postgres_db/model/Projets.java +++ b/MyINPulse-back/src/main/java/enseirb/myinpulse/postgres_db/model/Projets.java @@ -2,6 +2,7 @@ package enseirb.myinpulse.postgres_db.model; import jakarta.persistence.*; import jakarta.validation.constraints.NotNull; + import java.time.LocalDate; import java.util.ArrayList; import java.util.List; diff --git a/MyINPulse-back/src/main/java/enseirb/myinpulse/postgres_db/model/RendezVous.java b/MyINPulse-back/src/main/java/enseirb/myinpulse/postgres_db/model/RendezVous.java index e1625e5..b1cc5a2 100644 --- a/MyINPulse-back/src/main/java/enseirb/myinpulse/postgres_db/model/RendezVous.java +++ b/MyINPulse-back/src/main/java/enseirb/myinpulse/postgres_db/model/RendezVous.java @@ -12,31 +12,6 @@ import java.util.List; @Table(name = "rendez_vous") public class RendezVous { - @Id - @NotNull - @GeneratedValue(strategy = GenerationType.IDENTITY) - private Long id_rdv; - - private LocalDate date_rdv; - - private LocalDateTime heure_rdv; - - private LocalDateTime duree_rdv; - - @Column(length = 255) - private String lieu_rdv; - - private String sujet_rdv; - - @OneToMany(mappedBy = "rendezVousEntrepreneurs", fetch = FetchType.LAZY, orphanRemoval = true) - private List ListEntrepreneurs = new ArrayList<>(); - - @OneToMany(mappedBy = "rendezVousAdministrateurs", fetch = FetchType.LAZY, orphanRemoval = true) - private List ListAdministrateurs = new ArrayList<>(); - - @OneToMany(mappedBy = "rendezVousComptesRendus", fetch = FetchType.LAZY, orphanRemoval = true) - private List ListComptesRendus = new ArrayList<>(); - @ManyToMany( fetch = FetchType.LAZY, cascade = {CascadeType.ALL}) @@ -45,6 +20,22 @@ public class RendezVous { joinColumns = @JoinColumn(name = "id_rdv"), inverseJoinColumns = @JoinColumn(name = "id_section")) List ListSections = new ArrayList<>(); + @Id + @NotNull + @GeneratedValue(strategy = GenerationType.IDENTITY) + private Long id_rdv; + private LocalDate date_rdv; + private LocalDateTime heure_rdv; + private LocalDateTime duree_rdv; + @Column(length = 255) + private String lieu_rdv; + private String sujet_rdv; + @OneToMany(mappedBy = "rendezVousEntrepreneurs", fetch = FetchType.LAZY, orphanRemoval = true) + private List ListEntrepreneurs = new ArrayList<>(); + @OneToMany(mappedBy = "rendezVousAdministrateurs", fetch = FetchType.LAZY, orphanRemoval = true) + private List ListAdministrateurs = new ArrayList<>(); + @OneToMany(mappedBy = "rendezVousComptesRendus", fetch = FetchType.LAZY, orphanRemoval = true) + private List ListComptesRendus = new ArrayList<>(); public RendezVous() {} diff --git a/MyINPulse-back/src/main/java/enseirb/myinpulse/postgres_db/repository/AdministrateursRepository.java b/MyINPulse-back/src/main/java/enseirb/myinpulse/postgres_db/repository/AdministrateursRepository.java index b59d2c0..0454e64 100644 --- a/MyINPulse-back/src/main/java/enseirb/myinpulse/postgres_db/repository/AdministrateursRepository.java +++ b/MyINPulse-back/src/main/java/enseirb/myinpulse/postgres_db/repository/AdministrateursRepository.java @@ -1,6 +1,7 @@ package enseirb.myinpulse.postgres_db.repository; import enseirb.myinpulse.postgres_db.model.Administrateurs; + import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.rest.core.annotation.RepositoryRestResource; diff --git a/MyINPulse-back/src/main/java/enseirb/myinpulse/postgres_db/repository/ComptesRendusRepository.java b/MyINPulse-back/src/main/java/enseirb/myinpulse/postgres_db/repository/ComptesRendusRepository.java index e4de376..168fd87 100644 --- a/MyINPulse-back/src/main/java/enseirb/myinpulse/postgres_db/repository/ComptesRendusRepository.java +++ b/MyINPulse-back/src/main/java/enseirb/myinpulse/postgres_db/repository/ComptesRendusRepository.java @@ -1,6 +1,7 @@ package enseirb.myinpulse.postgres_db.repository; import enseirb.myinpulse.postgres_db.model.ComptesRendus; + import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.rest.core.annotation.RepositoryRestResource; diff --git a/MyINPulse-back/src/main/java/enseirb/myinpulse/postgres_db/repository/EntrepreneursRepository.java b/MyINPulse-back/src/main/java/enseirb/myinpulse/postgres_db/repository/EntrepreneursRepository.java index bb09b74..fc288f5 100644 --- a/MyINPulse-back/src/main/java/enseirb/myinpulse/postgres_db/repository/EntrepreneursRepository.java +++ b/MyINPulse-back/src/main/java/enseirb/myinpulse/postgres_db/repository/EntrepreneursRepository.java @@ -1,6 +1,7 @@ package enseirb.myinpulse.postgres_db.repository; import enseirb.myinpulse.postgres_db.model.Entrepreneurs; + import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.rest.core.annotation.RepositoryRestResource; diff --git a/MyINPulse-back/src/main/java/enseirb/myinpulse/postgres_db/repository/ProjetsRepository.java b/MyINPulse-back/src/main/java/enseirb/myinpulse/postgres_db/repository/ProjetsRepository.java index 37f5d8e..d9d2e59 100644 --- a/MyINPulse-back/src/main/java/enseirb/myinpulse/postgres_db/repository/ProjetsRepository.java +++ b/MyINPulse-back/src/main/java/enseirb/myinpulse/postgres_db/repository/ProjetsRepository.java @@ -1,6 +1,7 @@ package enseirb.myinpulse.postgres_db.repository; import enseirb.myinpulse.postgres_db.model.Projets; + import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.rest.core.annotation.RepositoryRestResource; diff --git a/MyINPulse-back/src/main/java/enseirb/myinpulse/postgres_db/repository/RendezVousRepository.java b/MyINPulse-back/src/main/java/enseirb/myinpulse/postgres_db/repository/RendezVousRepository.java index 93074f8..2856de3 100644 --- a/MyINPulse-back/src/main/java/enseirb/myinpulse/postgres_db/repository/RendezVousRepository.java +++ b/MyINPulse-back/src/main/java/enseirb/myinpulse/postgres_db/repository/RendezVousRepository.java @@ -1,6 +1,7 @@ package enseirb.myinpulse.postgres_db.repository; import enseirb.myinpulse.postgres_db.model.RendezVous; + import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.rest.core.annotation.RepositoryRestResource; diff --git a/MyINPulse-back/src/main/java/enseirb/myinpulse/postgres_db/repository/SectionsRepository.java b/MyINPulse-back/src/main/java/enseirb/myinpulse/postgres_db/repository/SectionsRepository.java index cc25ab1..4d68027 100644 --- a/MyINPulse-back/src/main/java/enseirb/myinpulse/postgres_db/repository/SectionsRepository.java +++ b/MyINPulse-back/src/main/java/enseirb/myinpulse/postgres_db/repository/SectionsRepository.java @@ -1,6 +1,7 @@ package enseirb.myinpulse.postgres_db.repository; import enseirb.myinpulse.postgres_db.model.Sections; + import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.rest.core.annotation.RepositoryRestResource; diff --git a/MyINPulse-back/src/main/java/enseirb/myinpulse/postgres_db/repository/UtilisateursRepository.java b/MyINPulse-back/src/main/java/enseirb/myinpulse/postgres_db/repository/UtilisateursRepository.java index 28aca29..de8371c 100644 --- a/MyINPulse-back/src/main/java/enseirb/myinpulse/postgres_db/repository/UtilisateursRepository.java +++ b/MyINPulse-back/src/main/java/enseirb/myinpulse/postgres_db/repository/UtilisateursRepository.java @@ -1,6 +1,7 @@ package enseirb.myinpulse.postgres_db.repository; import enseirb.myinpulse.postgres_db.model.Utilisateurs; + import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.rest.core.annotation.RepositoryRestResource; diff --git a/MyINPulse-back/src/main/java/enseirb/myinpulse/security/KeycloakJwtRolesConverter.java b/MyINPulse-back/src/main/java/enseirb/myinpulse/security/KeycloakJwtRolesConverter.java index dba41cc..c73b82a 100644 --- a/MyINPulse-back/src/main/java/enseirb/myinpulse/security/KeycloakJwtRolesConverter.java +++ b/MyINPulse-back/src/main/java/enseirb/myinpulse/security/KeycloakJwtRolesConverter.java @@ -1,5 +1,7 @@ package enseirb.myinpulse.security; +import static java.util.stream.Collectors.toSet; + import org.springframework.core.convert.converter.Converter; import org.springframework.security.authentication.AbstractAuthenticationToken; import org.springframework.security.core.GrantedAuthority; @@ -14,8 +16,6 @@ import java.util.Map; import java.util.stream.Collectors; import java.util.stream.Stream; -import static java.util.stream.Collectors.toSet; - public class KeycloakJwtRolesConverter implements Converter { /** Prefix used for realm level roles. */ public static final String PREFIX_REALM_ROLE = "ROLE_REALM_"; diff --git a/MyINPulse-back/src/main/resources/data.sql b/MyINPulse-back/src/main/resources/data.sql index 4014267..788f9dd 100644 --- a/MyINPulse-back/src/main/resources/data.sql +++ b/MyINPulse-back/src/main/resources/data.sql @@ -1,50 +1,62 @@ -INSERT INTO projets (nom_projet, logo, date_creation, status_projet) VALUES -('Eau du robinet', decode('013d7d16d7ad4fefb61bd95b765c8ceb', 'hex'), TO_DATE('01-OCT-2023', 'DD-MON-YYYY'), 'En cours'), -('Air oxygéné', decode('150647a0984e8f228cd14b54', 'hex'), TO_DATE('04-APR-2024', 'DD-MON-YYYY'), 'En cours'), -('Débat concours', decode('022024abd5486e245c145dda65116f', 'hex'), TO_DATE('22-NOV-2023', 'DD-MON-YYYY'), 'Suspendu'), -('HDeirbMI', decode('ab548d6c1d595a2975e6476f544d14c55a', 'hex'), TO_DATE('07-DEC-2024', 'DD-MON-YYYY'), 'Lancement'); +INSERT INTO projets (nom_projet, logo, date_creation, status_projet) +VALUES ('Eau du robinet', decode('013d7d16d7ad4fefb61bd95b765c8ceb', 'hex'), TO_DATE('01-OCT-2023', 'DD-MON-YYYY'), + 'En cours'), + ('Air oxygéné', decode('150647a0984e8f228cd14b54', 'hex'), TO_DATE('04-APR-2024', 'DD-MON-YYYY'), 'En cours'), + ('Débat concours', decode('022024abd5486e245c145dda65116f', 'hex'), TO_DATE('22-NOV-2023', 'DD-MON-YYYY'), + 'Suspendu'), + ('HDeirbMI', decode('ab548d6c1d595a2975e6476f544d14c55a', 'hex'), TO_DATE('07-DEC-2024', 'DD-MON-YYYY'), + 'Lancement'); -INSERT INTO utilisateurs (nom_utilisateur, prenom_utilisateur, mail_principal, mail_secondaire, numero_telephone) VALUES -('Dupont', 'Dupond', 'super@mail.fr', 'super2@mail.fr', '06 45 72 45 98'), -('Martin', 'Matin', 'genial@mail.fr', 'genial2@mail.fr', '06 52 14 58 73'), -('Charvet', 'Lautre', 'mieux@tmail.fr', 'mieux2@tmail.fr', '07 49 82 16 35'), -('Leguez', 'Theo', 'bof@mesmails.fr', 'bof2@mesmails.fr', '+33 6 78 14 25 29'), -('Kia', 'Bi', 'special@mail.fr', 'special2@mail.fr', '07 65 31 38 95'); +INSERT INTO utilisateurs (nom_utilisateur, prenom_utilisateur, mail_principal, mail_secondaire, numero_telephone) +VALUES ('Dupont', 'Dupond', 'super@mail.fr', 'super2@mail.fr', '06 45 72 45 98'), + ('Martin', 'Matin', 'genial@mail.fr', 'genial2@mail.fr', '06 52 14 58 73'), + ('Charvet', 'Lautre', 'mieux@tmail.fr', 'mieux2@tmail.fr', '07 49 82 16 35'), + ('Leguez', 'Theo', 'bof@mesmails.fr', 'bof2@mesmails.fr', '+33 6 78 14 25 29'), + ('Kia', 'Bi', 'special@mail.fr', 'special2@mail.fr', '07 65 31 38 95'); -INSERT INTO entrepreneurs (ecole, filiere, status_snee) VALUES -('ENSEIRB-MATMECA', 'INFO', TRUE), -('ENSC', 'Cognitique', TRUE), -('ENSEIRB-MATMECA', 'MATMECA', FALSE), -('SupOptique', 'Classique', TRUE), -('ENSEGID', 'Géoscience', FALSE), -('ENSMAC', 'Matériaux composites - Mécanique', FALSE); +INSERT INTO entrepreneurs (ecole, filiere, status_snee) +VALUES ('ENSEIRB-MATMECA', 'INFO', TRUE), + ('ENSC', 'Cognitique', TRUE), + ('ENSEIRB-MATMECA', 'MATMECA', FALSE), + ('SupOptique', 'Classique', TRUE), + ('ENSEGID', 'Géoscience', FALSE), + ('ENSMAC', 'Matériaux composites - Mécanique', FALSE); -INSERT INTO sections (titre, contenu_section, date_modification) VALUES -("Problème", "les problèmes...", TO_DATE('15-JAN-2025', 'DD-MON-YYYY')), -("Segment de client", "Le segment AB passant le client n°8 est de longueur 32mm. - Le segment BC a quant à lui un longueur de 28mm. Quelle la longueur du segment AC ?", TO_DATE('12-OCT-2022', 'DD-MON-YYYY')), -("Proposition de valeur unique", "'Son prix est de 2594€' 'Ah oui c'est unique en effet'", TO_DATE('25-MAY-2024', 'DD-MON-YYYY')), -("Solution", "Un problème ? Une solution", TO_DATE('08-FEB-2024', 'DD-MON-YYYY')), -("Canaux", "Ici nous avons la Seine, là-bas le Rhin, oh et plus loin le canal de Suez", TO_DATE('19-JUL-2023', 'DD-MON-YYYY')), -("Sources de revenus", "Y'en n'a pas on est pas payé. Enfin y'a du café quoi", TO_DATE('12-JAN-2025', 'DD-MON-YYYY')), -("Structure des coûts", "'Ah oui là ça va faire au moins 1000€ par mois', Eirbware", TO_DATE('06-FEB-2025', 'DD-MON-YYYY')), -("Indicateurs clés", "On apprend les clés comme des badges, ça se fait", TO_DATE('05-FEB-2025', 'DD-MON-YYYY')), -("Avantages concurrentiel", "On est meilleur", TO_DATE('23-APR-2024', 'DD-MON-YYYY')); +INSERT INTO sections (titre, contenu_section, date_modification) +VALUES ("Problème", "les problèmes...", TO_DATE('15-JAN-2025', 'DD-MON-YYYY')), + ("Segment de client", "Le segment AB passant le client n°8 est de longueur 32mm. + Le segment BC a quant à lui un longueur de 28mm. Quelle la longueur du segment AC ?", + TO_DATE('12-OCT-2022', 'DD-MON-YYYY')), + ("Proposition de valeur unique", "'Son prix est de 2594€' 'Ah oui c'est unique en effet'", + TO_DATE('25-MAY-2024', 'DD-MON-YYYY')), + ("Solution", "Un problème ? Une solution", TO_DATE('08-FEB-2024', 'DD-MON-YYYY')), + ("Canaux", "Ici nous avons la Seine, là-bas le Rhin, oh et plus loin le canal de Suez", + TO_DATE('19-JUL-2023', 'DD-MON-YYYY')), + ("Sources de revenus", "Y'en n'a pas on est pas payé. Enfin y'a du café quoi", + TO_DATE('12-JAN-2025', 'DD-MON-YYYY')), + ("Structure des coûts", "'Ah oui là ça va faire au moins 1000€ par mois', Eirbware", + TO_DATE('06-FEB-2025', 'DD-MON-YYYY')), + ("Indicateurs clés", "On apprend les clés comme des badges, ça se fait", TO_DATE('05-FEB-2025', 'DD-MON-YYYY')), + ("Avantages concurrentiel", "On est meilleur", TO_DATE('23-APR-2024', 'DD-MON-YYYY')); -INSERT INTO rendez_vous (date_rdv, heure_rdv, duree_rdv, lieu_rdv, sujet_rdv) VALUES -(TO_DATE('24-DEC-2023', 'DD-MON-YYYY'), '00:00:00', '00:37:53', "À la maison", "Ouvrir les cadeaux"), -(TO_DATE('15-AUG-2024', 'DD-MON-YYYY'), '22:35:00', '00:12:36', "Sur les quais ou dans un champ probablement", "BOUM BOUM les feux d'artifices (on fête quoi déjà ?)"), -(TO_DATE('29-FEB-2023', 'DD-MON-YYYY'), '14:20:00', '00:20:00', "Salle TD 15", "Ah mince c'est pas une année bissextile !"), -(TO_DATE('23-JAN-2024', 'DD-MON-YYYY'), '12:56:27', '11:03:33', "Là où le vent nous porte", "Journée la plus importante de l'année"), -(TO_DATE('25-AUG-2025', 'DD-MON-YYYY'), '00:09:00', '01:00:00', "Euh c'est par où l'amphi 56 ?", "Rentrée scolaire (il fait trop froid c'est quoi ça on est en août)"); +INSERT INTO rendez_vous (date_rdv, heure_rdv, duree_rdv, lieu_rdv, sujet_rdv) +VALUES (TO_DATE('24-DEC-2023', 'DD-MON-YYYY'), '00:00:00', '00:37:53', "À la maison", "Ouvrir les cadeaux"), + (TO_DATE('15-AUG-2024', 'DD-MON-YYYY'), '22:35:00', '00:12:36', "Sur les quais ou dans un champ probablement", + "BOUM BOUM les feux d'artifices (on fête quoi déjà ?)"), + (TO_DATE('29-FEB-2023', 'DD-MON-YYYY'), '14:20:00', '00:20:00', "Salle TD 15", + "Ah mince c'est pas une année bissextile !"), + (TO_DATE('23-JAN-2024', 'DD-MON-YYYY'), '12:56:27', '11:03:33', "Là où le vent nous porte", + "Journée la plus importante de l'année"), + (TO_DATE('25-AUG-2025', 'DD-MON-YYYY'), '00:09:00', '01:00:00', "Euh c'est par où l'amphi 56 ?", + "Rentrée scolaire (il fait trop froid c'est quoi ça on est en août)"); -INSERT INTO comptes_rendus (contenu_compte_rendu) VALUES -("Ah oui ça c'est super, ah ouais j'aime bien, bien vu de penser à ça"), -("Bonne réunion"), -("Ouais, j'ai rien compris mais niquel on fait comme vous avez dit"), -("Non non ça va pas du tout ce que tu me proposes, faut tout refaire"), -("Réponse de la DSI : non"), -("Trop dommage qu'Apple ait sorti leur logiciel avant nous, on avait la même idée et tout on aurait tellement pu leur faire de la concurrence"); +INSERT INTO comptes_rendus (contenu_compte_rendu) +VALUES ("Ah oui ça c'est super, ah ouais j'aime bien, bien vu de penser à ça"), + ("Bonne réunion"), + ("Ouais, j'ai rien compris mais niquel on fait comme vous avez dit"), + ("Non non ça va pas du tout ce que tu me proposes, faut tout refaire"), + ("Réponse de la DSI : non"), + ("Trop dommage qu'Apple ait sorti leur logiciel avant nous, on avait la même idée et tout on aurait tellement pu leur faire de la concurrence"); diff --git a/MyINPulse-back/src/main/resources/schema.sql b/MyINPulse-back/src/main/resources/schema.sql index 4916414..9ad3241 100644 --- a/MyINPulse-back/src/main/resources/schema.sql +++ b/MyINPulse-back/src/main/resources/schema.sql @@ -10,106 +10,120 @@ DROP TABLE IF EXISTS formes CASCADE; CREATE TABLE projets ( -id_projet SERIAL NOT NULL, -nom_projet VARCHAR(255) , -logo BYTEA , -date_creation DATE , -status_projet VARCHAR(255) , -CONSTRAINT pk_projet PRIMARY KEY (id_projet) ); + id_projet SERIAL NOT NULL, + nom_projet VARCHAR(255), + logo BYTEA, + date_creation DATE, + status_projet VARCHAR(255), + CONSTRAINT pk_projet PRIMARY KEY (id_projet) +); CREATE TABLE utilisateurs ( -id_utilisateur SERIAL NOT NULL, -nom_utilisateur VARCHAR(255) , -prenom_utilisateur VARCHAR(255) , -mail_principal VARCHAR(255) , -mail_secondaire VARCHAR(255) , -numero_telephone VARCHAR(15) , -CONSTRAINT pk_utilisateur PRIMARY KEY (id_utilisateur) ); + id_utilisateur SERIAL NOT NULL, + nom_utilisateur VARCHAR(255), + prenom_utilisateur VARCHAR(255), + mail_principal VARCHAR(255), + mail_secondaire VARCHAR(255), + numero_telephone VARCHAR(15), + CONSTRAINT pk_utilisateur PRIMARY KEY (id_utilisateur) +); CREATE TABLE entrepreneurs ( -id_entrepreneur SERIAL REFERENCES utilisateurs (id_utilisateur), -ecole VARCHAR(255) , -filiere VARCHAR(255) , -status_snee BOOLEAN , -CONSTRAINT pk_entrepreneur PRIMARY KEY (id_entrepreneur) ); + id_entrepreneur SERIAL REFERENCES utilisateurs (id_utilisateur), + ecole VARCHAR(255), + filiere VARCHAR(255), + status_snee BOOLEAN, + CONSTRAINT pk_entrepreneur PRIMARY KEY (id_entrepreneur) +); CREATE TABLE administrateurs -( -id_administrateur SERIAL REFERENCES utilisateurs (id_utilisateur), -CONSTRAINT pk_administrateur PRIMARY KEY (id_administrateur) ); +( + id_administrateur SERIAL REFERENCES utilisateurs (id_utilisateur), + CONSTRAINT pk_administrateur PRIMARY KEY (id_administrateur) +); CREATE TABLE sections ( -id_section SERIAL NOT NULL, -titre VARCHAR(255) , -contenu_section TEXT , -date_modification TIMESTAMP , -CONSTRAINT pk_section PRIMARY KEY (id_section) ); + id_section SERIAL NOT NULL, + titre VARCHAR(255), + contenu_section TEXT, + date_modification TIMESTAMP, + CONSTRAINT pk_section PRIMARY KEY (id_section) +); CREATE TABLE rendez_vous ( -id_rdv SERIAL NOT NULL, -date_rdv DATE , -heure_rdv TIME , -duree_rdv TIME , -lieu_rdv VARCHAR(255) , -sujet_rdv TEXT , -CONSTRAINT pk_rdv PRIMARY KEY (id_rdv) ); + id_rdv SERIAL NOT NULL, + date_rdv DATE, + heure_rdv TIME, + duree_rdv TIME, + lieu_rdv VARCHAR(255), + sujet_rdv TEXT, + CONSTRAINT pk_rdv PRIMARY KEY (id_rdv) +); -CREATE TABLE comptes_rendus +CREATE TABLE comptes_rendus ( -id_compte_rendu SERIAL NOT NULL, -contenu_compte_rendu TEXT , -CONSTRAINT pk_compte_rendu PRIMARY KEY (id_compte_rendu) ); + id_compte_rendu SERIAL NOT NULL, + contenu_compte_rendu TEXT, + CONSTRAINT pk_compte_rendu PRIMARY KEY (id_compte_rendu) +); CREATE TABLE concerner ( -id_section SERIAL REFERENCES sections (id_section), -id_rdv SERIAL REFERENCES sections (id_rdv), -CONSTRAINT pk_concerner PRIMARY KEY (id_section, id_rdv) ); + id_section SERIAL REFERENCES sections (id_section), + id_rdv SERIAL REFERENCES sections (id_rdv), + CONSTRAINT pk_concerner PRIMARY KEY (id_section, id_rdv) +); ALTER TABLE projets - ADD CONSTRAINT fk1_projet FOREIGN KEY (id_administrateur) - REFERENCES administrateurs (id_administrateur) - ON DELETE CASCADE; + ADD CONSTRAINT fk1_projet FOREIGN KEY (id_administrateur) + REFERENCES administrateurs (id_administrateur) + ON DELETE CASCADE; ALTER TABLE projets ADD CONSTRAINT fk2_projet FOREIGN KEY (id_entrepreneur_participation) REFERENCES entrepreneurs (id_entrepreneur) ON DELETE CASCADE; -ALTER TABLE entrepreneurs - ADD CONSTRAINT fk1_entrepreneur FOREIGN KEY (id_projet_propose) - REFERENCES projets (id_projet) - ON DELETE CASCADE; +ALTER TABLE entrepreneurs + ADD CONSTRAINT fk1_entrepreneur FOREIGN KEY (id_projet_propose) + REFERENCES projets (id_projet) + ON DELETE CASCADE; -ALTER TABLE sections - ADD CONSTRAINT fk1_section FOREIGN KEY (id_projet) - REFERENCES projets (id_projet) - ON DELETE CASCADE; +ALTER TABLE sections + ADD CONSTRAINT fk1_section FOREIGN KEY (id_projet) + REFERENCES projets (id_projet) + ON DELETE CASCADE; -ALTER TABLE sections - ADD CONSTRAINT fk2_section FOREIGN KEY (id_administrateur) - REFERENCES administrateurs (id_administrateur) - ON DELETE CASCADE; +ALTER TABLE sections + ADD CONSTRAINT fk2_section FOREIGN KEY (id_administrateur) + REFERENCES administrateurs (id_administrateur) + ON DELETE CASCADE; -ALTER TABLE rendez-vous - ADD CONSTRAINT fk1_rdv FOREIGN KEY (id_entrepreneur) - REFERENCES entrepreneurs (id_entrepreneur) - ON DELETE CASCADE; +ALTER TABLE rendez-vous + ADD CONSTRAINT fk1_rdv FOREIGN KEY (id_entrepreneur) + REFERENCES entrepreneurs (id_entrepreneur) + ON +DELETE +CASCADE; -ALTER TABLE rendez-vous - ADD CONSTRAINT fk2_rdv FOREIGN KEY (id_administrateur) - REFERENCES administrateurs (id_administrateur) - ON DELETE CASCADE; +ALTER TABLE rendez-vous + ADD CONSTRAINT fk2_rdv FOREIGN KEY (id_administrateur) + REFERENCES administrateurs (id_administrateur) + ON +DELETE +CASCADE; -ALTER TABLE comptes-rendus - ADD CONSTRAINT fk1_compte_rendu FOREIGN KEY (id_rdv) - REFERENCES rendez_vous (id_rdv) - ON DELETE CASCADE; +ALTER TABLE comptes-rendus + ADD CONSTRAINT fk1_compte_rendu FOREIGN KEY (id_rdv) + REFERENCES rendez_vous (id_rdv) + ON +DELETE +CASCADE; From ca282378ecdc405935ed8ca6cc02e4676469e826 Mon Sep 17 00:00:00 2001 From: Pierre Tellier Date: Wed, 12 Feb 2025 15:34:16 +0100 Subject: [PATCH 18/19] fix: changed the formatting ? --- .../myinpulse/postgres_db/model/RendezVous.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/MyINPulse-back/src/main/java/enseirb/myinpulse/postgres_db/model/RendezVous.java b/MyINPulse-back/src/main/java/enseirb/myinpulse/postgres_db/model/RendezVous.java index b1cc5a2..438a7a5 100644 --- a/MyINPulse-back/src/main/java/enseirb/myinpulse/postgres_db/model/RendezVous.java +++ b/MyINPulse-back/src/main/java/enseirb/myinpulse/postgres_db/model/RendezVous.java @@ -12,6 +12,12 @@ import java.util.List; @Table(name = "rendez_vous") public class RendezVous { + @OneToMany(mappedBy = "rendezVousEntrepreneurs", fetch = FetchType.LAZY, orphanRemoval = true) + private final List ListEntrepreneurs = new ArrayList<>(); + @OneToMany(mappedBy = "rendezVousAdministrateurs", fetch = FetchType.LAZY, orphanRemoval = true) + private final List ListAdministrateurs = new ArrayList<>(); + @OneToMany(mappedBy = "rendezVousComptesRendus", fetch = FetchType.LAZY, orphanRemoval = true) + private final List ListComptesRendus = new ArrayList<>(); @ManyToMany( fetch = FetchType.LAZY, cascade = {CascadeType.ALL}) @@ -30,12 +36,6 @@ public class RendezVous { @Column(length = 255) private String lieu_rdv; private String sujet_rdv; - @OneToMany(mappedBy = "rendezVousEntrepreneurs", fetch = FetchType.LAZY, orphanRemoval = true) - private List ListEntrepreneurs = new ArrayList<>(); - @OneToMany(mappedBy = "rendezVousAdministrateurs", fetch = FetchType.LAZY, orphanRemoval = true) - private List ListAdministrateurs = new ArrayList<>(); - @OneToMany(mappedBy = "rendezVousComptesRendus", fetch = FetchType.LAZY, orphanRemoval = true) - private List ListComptesRendus = new ArrayList<>(); public RendezVous() {} From b4c05f8c594d98acb1da1ccc4ccfbd961fefa0da Mon Sep 17 00:00:00 2001 From: Pierre Tellier Date: Wed, 12 Feb 2025 15:38:55 +0100 Subject: [PATCH 19/19] fix: formatting again --- .../enseirb/myinpulse/postgres_db/model/RendezVous.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/MyINPulse-back/src/main/java/enseirb/myinpulse/postgres_db/model/RendezVous.java b/MyINPulse-back/src/main/java/enseirb/myinpulse/postgres_db/model/RendezVous.java index 438a7a5..7616ff6 100644 --- a/MyINPulse-back/src/main/java/enseirb/myinpulse/postgres_db/model/RendezVous.java +++ b/MyINPulse-back/src/main/java/enseirb/myinpulse/postgres_db/model/RendezVous.java @@ -14,10 +14,13 @@ public class RendezVous { @OneToMany(mappedBy = "rendezVousEntrepreneurs", fetch = FetchType.LAZY, orphanRemoval = true) private final List ListEntrepreneurs = new ArrayList<>(); + @OneToMany(mappedBy = "rendezVousAdministrateurs", fetch = FetchType.LAZY, orphanRemoval = true) private final List ListAdministrateurs = new ArrayList<>(); + @OneToMany(mappedBy = "rendezVousComptesRendus", fetch = FetchType.LAZY, orphanRemoval = true) private final List ListComptesRendus = new ArrayList<>(); + @ManyToMany( fetch = FetchType.LAZY, cascade = {CascadeType.ALL}) @@ -26,15 +29,19 @@ public class RendezVous { joinColumns = @JoinColumn(name = "id_rdv"), inverseJoinColumns = @JoinColumn(name = "id_section")) List ListSections = new ArrayList<>(); + @Id @NotNull @GeneratedValue(strategy = GenerationType.IDENTITY) private Long id_rdv; + private LocalDate date_rdv; private LocalDateTime heure_rdv; private LocalDateTime duree_rdv; + @Column(length = 255) private String lieu_rdv; + private String sujet_rdv; public RendezVous() {}