diff --git a/.github/workflows/sonarcloud.yml b/.github/workflows/sonarcloud.yml index 47b912e50..96ff47c4d 100644 --- a/.github/workflows/sonarcloud.yml +++ b/.github/workflows/sonarcloud.yml @@ -29,11 +29,11 @@ name: "[Analyse] SonarCloud" on: - push: - branches: [ "main" ] - pull_request: - branches: [ "main" ] - types: [ opened, synchronize, reopened ] + # push: + # branches: [ "main" ] + # pull_request: + # branches: [ "main" ] + # types: [ opened, synchronize, reopened ] # schedule: # - cron: "0 3 * * *" # 3am every night workflow_dispatch: diff --git a/Makefile b/Makefile index 97eba8f84..4bb796dfa 100644 --- a/Makefile +++ b/Makefile @@ -2,7 +2,7 @@ ######################### # FRONTEND ######################### -######################### + FRONTEND_DIR := frontend .PHONY: front-install front-start front-build front-test front-coverage front-lint front-visualize-bundle front-sourcemap @@ -34,8 +34,6 @@ front-sourcemap: front-visualize-bundle: cd $(FRONTEND_DIR) && npx vite-bundle-visualizer - -######################### # END FRONTEND ######################### @@ -43,7 +41,6 @@ front-visualize-bundle: ######################### # BACKEND ######################### -######################### BACKEND_DIR := backend BACKEND_CONFIGURATION_FOLDER=$(shell pwd)/infra/configurations/backend/ @@ -70,45 +67,36 @@ back-start-local: back-clean-archi: cd $(BACKEND_DIR)/tools && ./check-clean-architecture.sh - -######################### # END BACKEND ######################### - ######################### -# MAINTENANCE +# DOCKER ######################### -######################### -.PHONY: docker-prune logs-backend -docker-prune: - docker image prune -a -logs-backend: - docker container logs -f rapportnav_backend - - -######################### -# END MAINTENANCE -######################### +INFRA_DIR := infra +.PHONY: docker-prune docker-logs-backend +docker-prune: + docker image prune -a +docker-logs-backend: + docker container logs -f backend -.PHONY: docker-build-app +.PHONY: docker-build-back docker-build-front docker-run-local -docker-build-app: - docker buildx build -f infra/docker/app/Dockerfile . \ - -t rapportnav-app:$(VERSION) \ - -t rapportnav-app:latest \ - --load \ - --build-arg VERSION=$(VERSION) \ - --build-arg ENV_PROFILE=$(ENV_PROFILE) \ - --build-arg GITHUB_SHA=$(GITHUB_SHA) +docker-build-back: + cd $(INFRA_DIR) && docker compose -f docker-compose.local.yml build backend +docker-build-front: + cd $(INFRA_DIR) && docker compose -f docker-compose.local.yml build frontend docker-run-local: - docker-compose -f ./infra/docker-compose.dev.yml up + cd $(INFRA_DIR) && docker compose -f docker-compose.local.yml up -d + +# END DOCKER +######################### diff --git a/README.md b/README.md index b5a351557..95b02c5d9 100644 --- a/README.md +++ b/README.md @@ -43,14 +43,10 @@ Before trying to run the project, make sure you have: ### Running the project -From the root dir, the following commands are available: +The app is fully dockerized for local development. Run the command `make docker-run-local` -- backend - - install dependencies: make back-clean-install - - run local backend: make back-start-dev (http://localhost:80/) -- frontend - - install dependencies: make front-install - - run local frontend: make front-start (http://localhost:5173/) +- frontend is available at http://localhost:5173/ +- backend is available at http://localhost:80/ ## Security and Vulnerabilities analysis @@ -87,3 +83,4 @@ two repos before deploying_: - check the running `release` Action - check the pipeline [here](https://gitlab-sml.din.developpement-durable.gouv.fr/num3-exploitation/deploiement-continu/gitlab-ci/applications/rapportnav-v2/rapportnav-v2/-/pipelines) + diff --git a/backend/.gitignore b/backend/.gitignore index c03be1d15..58a27f9aa 100644 --- a/backend/.gitignore +++ b/backend/.gitignore @@ -3,6 +3,7 @@ HELP.md ### Gradle ### .gradle build/ +target/ !gradle/wrapper/gradle-wrapper.jar !**/src/main/**/build/ !**/src/test/**/build/ diff --git a/backend/build.gradle.kts b/backend/build.gradle.kts index dd68c3947..58771f197 100644 --- a/backend/build.gradle.kts +++ b/backend/build.gradle.kts @@ -43,6 +43,7 @@ dependencyManagement { } dependencies { + developmentOnly("org.springframework.boot:spring-boot-devtools") implementation("org.springframework.boot:spring-boot-starter-data-jpa:$springVersion") implementation("org.springframework.boot:spring-boot-starter-data-rest:$springVersion") implementation("org.springframework.boot:spring-boot-starter-web:$springVersion") @@ -98,4 +99,19 @@ tasks.named("test") { } } +// for hot-reload: +tasks.register("getDependencies") { + from(sourceSets.main.get().runtimeClasspath) + into("runtime/") + + doFirst { + val runtimeDir = File("runtime") + runtimeDir.deleteRecursively() + runtimeDir.mkdir() + } + + doLast { + File("runtime").deleteRecursively() + } +} diff --git a/backend/src/main/kotlin/fr/gouv/dgampa/rapportnav/RapportNavApplication.kt b/backend/src/main/kotlin/fr/gouv/dgampa/rapportnav/RapportNavApplication.kt index 315aa61f8..90473ebd0 100644 --- a/backend/src/main/kotlin/fr/gouv/dgampa/rapportnav/RapportNavApplication.kt +++ b/backend/src/main/kotlin/fr/gouv/dgampa/rapportnav/RapportNavApplication.kt @@ -14,15 +14,15 @@ fun main(args: Array) { val ctx = runApplication(*args) - val isSentryEnabled: String? = ctx.environment.getProperty("sentry.enabled") - val sentryDsn: String? = ctx.environment.getProperty("sentry.dsn") + val isSentryEnabled: String? = ctx.environment.getProperty("rapportnav.sentry.enabled") + val sentryDsn: String? = ctx.environment.getProperty("rapportnav.sentry.dsn") if (isSentryEnabled == "true") { Sentry.init { options -> options.dsn = sentryDsn options.proxy = SentryOptions.Proxy( - ctx.environment.getProperty("sentry.proxy.host"), - ctx.environment.getProperty("sentry.proxy.port") + ctx.environment.getProperty("rapportnav.sentry.proxy.host"), + ctx.environment.getProperty("rapportnav.sentry.proxy.port") ) options.tracesSampleRate = 1.0 } diff --git a/backend/src/main/resources/application.properties b/backend/src/main/resources/application.properties index 91c7e55a2..b949cbc57 100644 --- a/backend/src/main/resources/application.properties +++ b/backend/src/main/resources/application.properties @@ -1,40 +1,54 @@ -server.port=0080 -# Set root logger to DEBUG level -# logging.level.root=DEBUG -server.servlet.request.logging.enabled=true -server.servlet.request.logging.level=INFO -logging.level.org.springframework.web=DEBUG -logging.level.org.springframework.security=DEBUG -spring.data.rest.base-path=/api -security.key=somerandomkeywhichislongenoughtoalignwiththejwtspecification +################ +################ +# Spring spring.mvc.static-path-pattern=/** spring.web.resources.static-locations=file:${STATIC_FILES_PATH} +# JPA spring.jpa.hibernate.ddl-auto=validate spring.jpa.show-sql=true #spring.jpa.properties.hibernate.format_sql=true -# spring.datasource.url=${env.db.url} -spring.datasource.url=jdbc:postgresql://localhost:5432/rapportnavdb?user=postgres&password=postgres +spring.datasource.url=jdbc:postgresql://db:5432/rapportnavdb?user=postgres&password=postgres spring.datasource.driver-class-name=org.postgresql.Driver +# Rest API +spring.data.rest.base-path=/api # database migrations spring.flyway.enabled=true spring.flyway.baseline-on-migrate=true spring.flyway.locations=classpath:/db/migration,classpath:/db/testdata spring.flyway.out-of-order=true +# hot reload: +#spring.devtools.livereload.enabled=${spring.devtools.livereload.enabled} +################ +################ +# Server +server.port=0080 +server.servlet.request.logging.enabled=true +server.servlet.request.logging.level=INFO +################ +################ # GraphQL API graphql.cors-enabled=true graphql.cors.allowed-origins=* graphql.cors.allowed-methods=GET, HEAD, POST spring.graphql.graphiql.enabled=true spring.graphql.graphiql.path=/graphiql -# Sentry log & perf tracking -sentry.enabled=true -sentry.dsn=https://8857258f9f1549968b13e15759bdf2bc@sentry.incubateur.net/121 -sentry.proxy.host=172.27.229.197 -sentry.proxy.port=8090 -#sentry.exception-resolver-order=-2147483647 -sentry.traces-sample-rate=1.0 -sentry.environment=production +################ +################ +# Logging +logging.level.org.springframework.web=DEBUG +logging.level.org.springframework.security=DEBUG +################ +################ +# Security +security.key=somerandomkeywhichislongenoughtoalignwiththejwtspecification +################ +################ +# Sentry +rapportnav.sentry.enabled=${sentry.enabled} +rapportnav.sentry.dsn=${sentry.dsn} +rapportnav.sentry.proxy.host=${host.proxy.host} +rapportnav.sentry.proxy.port=${host.proxy.port} +rapportnav.sentry.traces-sample-rate=${sentry.traces-sample-rate} +rapportnav.sentry.environment=${sentry.environment} sentry.use-git-commit-id-as-release=true -# Set traces_sample_rate to 1.0 to capture 100% -# of transactions for performance monitoring. -# We recommend adjusting this value in production. + diff --git a/backend/target/classes/application.properties b/backend/target/classes/application.properties deleted file mode 100644 index 27080bfe3..000000000 --- a/backend/target/classes/application.properties +++ /dev/null @@ -1,33 +0,0 @@ -# Set root logger to DEBUG level -# logging.level.root=DEBUG -server.servlet.request.logging.enabled=true -server.servlet.request.logging.level=INFO -logging.level.org.springframework.web=DEBUG -logging.level.org.springframework.security=DEBUG - -spring.data.rest.base-path=/api - -security.key=somerandomkeywhichislongenoughtoalignwiththejwtspecification - -spring.mvc.static-path-pattern=/** -spring.web.resources.static-locations=file:${STATIC_FILES_PATH} - -spring.jpa.hibernate.ddl-auto=validate -spring.jpa.show-sql=true -#spring.jpa.properties.hibernate.format_sql=true - -# spring.datasource.url=${env.db.url} -spring.datasource.url=jdbc:postgresql://localhost:5432/rapportnavdb?user=postgres&password=postgres -spring.datasource.driver-class-name=org.postgresql.Driver - -spring.flyway.enabled=true -spring.flyway.baseline-on-migrate=true -spring.flyway.locations=classpath:/db/migration,classpath:/db/testdata -spring.flyway.out-of-order=true - - -graphql.cors-enabled=true -graphql.cors.allowed-origins=* -graphql.cors.allowed-methods=GET, HEAD, POST -spring.graphql.graphiql.enabled=true -spring.graphql.graphiql.path=/graphiql diff --git a/backend/target/classes/db/migration/V0.10__alter_mission_action_control_lat_lon.sql b/backend/target/classes/db/migration/V0.10__alter_mission_action_control_lat_lon.sql deleted file mode 100644 index 0cf00847e..000000000 --- a/backend/target/classes/db/migration/V0.10__alter_mission_action_control_lat_lon.sql +++ /dev/null @@ -1,6 +0,0 @@ -DO $$ -BEGIN - ALTER TABLE mission_action_control - ADD COLUMN latitude DOUBLE PRECISION, - ADD COLUMN longitude DOUBLE PRECISION; -END $$; diff --git a/backend/target/classes/db/migration/V0.11__alter_controls_add_delete_at.sql b/backend/target/classes/db/migration/V0.11__alter_controls_add_delete_at.sql deleted file mode 100644 index 984d98505..000000000 --- a/backend/target/classes/db/migration/V0.11__alter_controls_add_delete_at.sql +++ /dev/null @@ -1,17 +0,0 @@ -DO $$ -BEGIN - ALTER TABLE mission_action_control - ADD COLUMN deleted_at TIMESTAMP; - - ALTER TABLE control_gens_de_mer - ADD COLUMN deleted_at TIMESTAMP; - - ALTER TABLE control_security - ADD COLUMN deleted_at TIMESTAMP; - - ALTER TABLE control_navigation - ADD COLUMN deleted_at TIMESTAMP; - - ALTER TABLE control_administrative - ADD COLUMN deleted_at TIMESTAMP; -END $$; diff --git a/backend/target/classes/db/migration/V0.12__alter_status_add_delete_at.sql b/backend/target/classes/db/migration/V0.12__alter_status_add_delete_at.sql deleted file mode 100644 index c2a29885f..000000000 --- a/backend/target/classes/db/migration/V0.12__alter_status_add_delete_at.sql +++ /dev/null @@ -1,5 +0,0 @@ -DO $$ -BEGIN - ALTER TABLE mission_action_status - ADD COLUMN deleted_at TIMESTAMP; -END $$; diff --git a/backend/target/classes/db/migration/V0.13__delete_crew_and_crew_role.sql b/backend/target/classes/db/migration/V0.13__delete_crew_and_crew_role.sql deleted file mode 100644 index 385d2a588..000000000 --- a/backend/target/classes/db/migration/V0.13__delete_crew_and_crew_role.sql +++ /dev/null @@ -1,8 +0,0 @@ -DO $$ -BEGIN - -- Delete the crew table - DROP TABLE IF EXISTS crew; - - -- Delete the crew_role table - DROP TABLE IF EXISTS crew_role; -END $$; diff --git a/backend/target/classes/db/migration/V0.14__alter_controls_change_format.sql b/backend/target/classes/db/migration/V0.14__alter_controls_change_format.sql deleted file mode 100644 index e2374d2c3..000000000 --- a/backend/target/classes/db/migration/V0.14__alter_controls_change_format.sql +++ /dev/null @@ -1,77 +0,0 @@ -DO $$ -BEGIN - -- Modify control_gens_de_mer table - ALTER TABLE control_gens_de_mer - ADD COLUMN staff_outnumbered_text VARCHAR(16); - - ALTER TABLE control_gens_de_mer - ADD COLUMN up_to_date_medical_check_text VARCHAR(16); - - ALTER TABLE control_gens_de_mer - ADD COLUMN knowledge_of_french_law_and_language_text VARCHAR(16); -END $$; - -DO $$ -BEGIN - -- Drop columns in control_gens_de_mer - ALTER TABLE control_gens_de_mer - DROP COLUMN staff_outnumbered; - - ALTER TABLE control_gens_de_mer - DROP COLUMN up_to_date_medical_check; - - ALTER TABLE control_gens_de_mer - DROP COLUMN knowledge_of_french_law_and_language; -END $$; - -DO $$ -BEGIN - -- Rename columns in control_gens_de_mer - ALTER TABLE control_gens_de_mer - RENAME COLUMN staff_outnumbered_text TO staff_outnumbered; - - ALTER TABLE control_gens_de_mer - RENAME COLUMN up_to_date_medical_check_text TO up_to_date_medical_check; - - ALTER TABLE control_gens_de_mer - RENAME COLUMN knowledge_of_french_law_and_language_text TO knowledge_of_french_law_and_language; -END $$; - -DO $$ -BEGIN - -- Modify control_administrative table - ALTER TABLE control_administrative - ADD COLUMN compliant_operating_permit_text VARCHAR(16); - - ALTER TABLE control_administrative - ADD COLUMN up_to_date_navigation_permit_text VARCHAR(16); - - ALTER TABLE control_administrative - ADD COLUMN compliant_security_documents_text VARCHAR(16); -END $$; - -DO $$ -BEGIN - -- Drop columns in control_administrative - ALTER TABLE control_administrative - DROP COLUMN compliant_operating_permit; - - ALTER TABLE control_administrative - DROP COLUMN up_to_date_navigation_permit; - - ALTER TABLE control_administrative - DROP COLUMN compliant_security_documents; -END $$; - -DO $$ -BEGIN - -- Rename columns in control_administrative - ALTER TABLE control_administrative - RENAME COLUMN compliant_operating_permit_text TO compliant_operating_permit; - - ALTER TABLE control_administrative - RENAME COLUMN up_to_date_navigation_permit_text TO up_to_date_navigation_permit; - - ALTER TABLE control_administrative - RENAME COLUMN compliant_security_documents_text TO compliant_security_documents; -END $$; diff --git a/backend/target/classes/db/migration/V0.15__alter_action_controls_remove_not_null.sql b/backend/target/classes/db/migration/V0.15__alter_action_controls_remove_not_null.sql deleted file mode 100644 index d68cf1fe5..000000000 --- a/backend/target/classes/db/migration/V0.15__alter_action_controls_remove_not_null.sql +++ /dev/null @@ -1,19 +0,0 @@ -DO $$ -BEGIN - -- For the vessel_identifier column - ALTER TABLE mission_action_control - ALTER COLUMN vessel_identifier DROP NOT NULL; - - -- For the vessel_type column - ALTER TABLE mission_action_control - ALTER COLUMN vessel_type DROP NOT NULL; - - -- For the vessel_size column - ALTER TABLE mission_action_control - ALTER COLUMN vessel_size DROP NOT NULL; - - -- For the identity_controlled_person column - ALTER TABLE mission_action_control - ALTER COLUMN identity_controlled_person DROP NOT NULL; - -END $$; diff --git a/backend/target/classes/db/migration/V0.16__drop_fk_on_controls_to_action_control.sql b/backend/target/classes/db/migration/V0.16__drop_fk_on_controls_to_action_control.sql deleted file mode 100644 index 91c484339..000000000 --- a/backend/target/classes/db/migration/V0.16__drop_fk_on_controls_to_action_control.sql +++ /dev/null @@ -1,14 +0,0 @@ -DO $$ -BEGIN - ALTER TABLE control_gens_de_mer - DROP CONSTRAINT fk_control_gens_de_mer_action_id; - - ALTER TABLE control_security - DROP CONSTRAINT fk_control_security_action_id; - - ALTER TABLE control_navigation - DROP CONSTRAINT fk_control_navigation_action_id; - - ALTER TABLE control_administrative - DROP CONSTRAINT fk_control_administrative_action_id; -END $$; diff --git a/backend/target/classes/db/migration/V0.17__alter_controls.sql b/backend/target/classes/db/migration/V0.17__alter_controls.sql deleted file mode 100644 index 83cf62d41..000000000 --- a/backend/target/classes/db/migration/V0.17__alter_controls.sql +++ /dev/null @@ -1,69 +0,0 @@ -DO $$ -BEGIN - - -- 1. Drop the 'confirmed' column - ALTER TABLE control_administrative - DROP COLUMN confirmed; - - -- 2. Add the 'unit_should_confirm' boolean column - ALTER TABLE control_administrative - ADD COLUMN unit_should_confirm BOOLEAN; - - -- 3. Add the 'unit_has_confirmed' boolean column - ALTER TABLE control_administrative - ADD COLUMN unit_has_confirmed BOOLEAN; - - -- 4. Add the 'amount_of_controls' integer column - ALTER TABLE control_administrative - ADD COLUMN amount_of_controls INT DEFAULT 1 NOT NULL; - - ------------------------------------------------------------------- - -- 1. Drop the 'confirmed' column - ALTER TABLE control_navigation - DROP COLUMN confirmed; - - -- 2. Add the 'unit_should_confirm' boolean column - ALTER TABLE control_navigation - ADD COLUMN unit_should_confirm BOOLEAN; - - -- 3. Add the 'unit_has_confirmed' boolean column - ALTER TABLE control_navigation - ADD COLUMN unit_has_confirmed BOOLEAN; - - -- 4. Add the 'amount_of_controls' integer column - ALTER TABLE control_navigation - ADD COLUMN amount_of_controls INT DEFAULT 1 NOT NULL; - ------------------------------------------------------------------- - -- 1. Drop the 'confirmed' column - ALTER TABLE control_security - DROP COLUMN confirmed; - - -- 2. Add the 'unit_should_confirm' boolean column - ALTER TABLE control_security - ADD COLUMN unit_should_confirm BOOLEAN; - - -- 3. Add the 'unit_has_confirmed' boolean column - ALTER TABLE control_security - ADD COLUMN unit_has_confirmed BOOLEAN; - - -- 4. Add the 'amount_of_controls' integer column - ALTER TABLE control_security - ADD COLUMN amount_of_controls INT DEFAULT 1 NOT NULL; - ------------------------------------------------------------------- - -- 1. Drop the 'confirmed' column - ALTER TABLE control_gens_de_mer - DROP COLUMN confirmed; - - -- 2. Add the 'unit_should_confirm' boolean column - ALTER TABLE control_gens_de_mer - ADD COLUMN unit_should_confirm BOOLEAN; - - -- 3. Add the 'unit_has_confirmed' boolean column - ALTER TABLE control_gens_de_mer - ADD COLUMN unit_has_confirmed BOOLEAN; - - -- 4. Add the 'amount_of_controls' integer column - ALTER TABLE control_gens_de_mer - ADD COLUMN amount_of_controls INT DEFAULT 1 NOT NULL; - -END $$; diff --git a/backend/target/classes/db/migration/V0.1__create_crew_role_table.sql b/backend/target/classes/db/migration/V0.1__create_crew_role_table.sql deleted file mode 100644 index 8890f4cc9..000000000 --- a/backend/target/classes/db/migration/V0.1__create_crew_role_table.sql +++ /dev/null @@ -1,5 +0,0 @@ -CREATE TABLE public.crew_role ( - role VARCHAR(64) NOT NULL, - is_archived BOOLEAN NOT NULL -); - diff --git a/backend/target/classes/db/migration/V0.2__insert_crew_role.sql b/backend/target/classes/db/migration/V0.2__insert_crew_role.sql deleted file mode 100644 index ddcdb40b0..000000000 --- a/backend/target/classes/db/migration/V0.2__insert_crew_role.sql +++ /dev/null @@ -1,5 +0,0 @@ -INSERT INTO public.crew_role (role, is_archived) VALUES -('Commandant', false), -('Agent de pont', false), -('Non précisé', false), -('Chef cuisinier', false); \ No newline at end of file diff --git a/backend/target/classes/db/migration/V0.3__create_crew_table.sql b/backend/target/classes/db/migration/V0.3__create_crew_table.sql deleted file mode 100644 index 148f7e323..000000000 --- a/backend/target/classes/db/migration/V0.3__create_crew_table.sql +++ /dev/null @@ -1,6 +0,0 @@ -CREATE TABLE public.crew ( - id SERIAL PRIMARY KEY, - first_name VARCHAR(64) NOT NULL, - last_name VARCHAR(64) NOT NULL, - is_archived BOOLEAN NOT NULL -); diff --git a/backend/target/classes/db/migration/V0.4__insert_crew.sql b/backend/target/classes/db/migration/V0.4__insert_crew.sql deleted file mode 100644 index d55334661..000000000 --- a/backend/target/classes/db/migration/V0.4__insert_crew.sql +++ /dev/null @@ -1,11 +0,0 @@ -INSERT INTO public.crew (first_name, last_name, is_archived) VALUES -('Antoine', 'Dupont', false), -('Julie', 'Martin', false), -('Lucas', 'Dubois', false), -('Emma', 'Bernard', false), -('Hugo', 'Thomas', false), -('Chloé', 'Robert', false), -('Louis', 'Richard', false), -('Léa', 'Petit', false), -('Adam', 'Durand', false), -('Camille', 'Leroy', false); diff --git a/backend/target/classes/db/migration/V0.5__create_user_table.sql b/backend/target/classes/db/migration/V0.5__create_user_table.sql deleted file mode 100644 index da9ee2ad6..000000000 --- a/backend/target/classes/db/migration/V0.5__create_user_table.sql +++ /dev/null @@ -1,6 +0,0 @@ -CREATE TABLE "user" ( - id SERIAL PRIMARY KEY, - name VARCHAR NOT NULL, - email VARCHAR UNIQUE NOT NULL, - password VARCHAR NOT NULL -); diff --git a/backend/target/classes/db/migration/V0.6__add_metabase_schema.sql b/backend/target/classes/db/migration/V0.6__add_metabase_schema.sql deleted file mode 100644 index dabd9b4d0..000000000 --- a/backend/target/classes/db/migration/V0.6__add_metabase_schema.sql +++ /dev/null @@ -1,6 +0,0 @@ -DO $$ -BEGIN - IF NOT EXISTS (SELECT 1 FROM information_schema.schemata WHERE schema_name = 'metabase') THEN - CREATE SCHEMA metabase; - END IF; -END $$; diff --git a/backend/target/classes/db/migration/V0.7__add_mission_action_control_schema.sql b/backend/target/classes/db/migration/V0.7__add_mission_action_control_schema.sql deleted file mode 100644 index 5549ddf09..000000000 --- a/backend/target/classes/db/migration/V0.7__add_mission_action_control_schema.sql +++ /dev/null @@ -1,17 +0,0 @@ -DO $$ -BEGIN - IF NOT EXISTS (SELECT 1 FROM information_schema.tables WHERE table_name = 'mission_action_control') THEN - CREATE TABLE mission_action_control ( - id UUID PRIMARY KEY, - mission_id INT NOT NULL, - start_datetime_utc TIMESTAMP NOT NULL, - end_datetime_utc TIMESTAMP, - control_method VARCHAR(16) NOT NULL, - vessel_identifier VARCHAR(64) NOT NULL, - vessel_type VARCHAR(32) NOT NULL, - vessel_size VARCHAR(32) NOT NULL, - identity_controlled_person VARCHAR(128) NOT NULL, - observations TEXT - ); - END IF; -END $$; diff --git a/backend/target/classes/db/migration/V0.8__add_control_schemas.sql b/backend/target/classes/db/migration/V0.8__add_control_schemas.sql deleted file mode 100644 index c38e03273..000000000 --- a/backend/target/classes/db/migration/V0.8__add_control_schemas.sql +++ /dev/null @@ -1,53 +0,0 @@ -DO $$ -BEGIN - IF NOT EXISTS (SELECT 1 FROM information_schema.tables WHERE table_name = 'control_gens_de_mer') THEN - CREATE TABLE control_gens_de_mer ( - id UUID PRIMARY KEY, - mission_id INT NOT NULL, - action_control_id UUID NOT NULL, - confirmed BOOLEAN, - staff_outnumbered BOOLEAN, - up_to_date_medical_check BOOLEAN, - knowledge_of_french_law_and_language BOOLEAN, - observations TEXT, - CONSTRAINT fk_control_gens_de_mer_action_id FOREIGN KEY (action_control_id) REFERENCES mission_action_control(id) - ); - END IF; - - IF NOT EXISTS (SELECT 1 FROM information_schema.tables WHERE table_name = 'control_security') THEN - CREATE TABLE control_security ( - id UUID PRIMARY KEY, - mission_id INT NOT NULL, - action_control_id UUID NOT NULL, - confirmed BOOLEAN, - observations TEXT, - CONSTRAINT fk_control_security_action_id FOREIGN KEY (action_control_id) REFERENCES mission_action_control(id) - ); - END IF; - - IF NOT EXISTS (SELECT 1 FROM information_schema.tables WHERE table_name = 'control_navigation') THEN - CREATE TABLE control_navigation ( - id UUID PRIMARY KEY, - mission_id INT NOT NULL, - action_control_id UUID NOT NULL, - confirmed BOOLEAN, - observations TEXT, - CONSTRAINT fk_control_navigation_action_id FOREIGN KEY (action_control_id) REFERENCES mission_action_control(id) - ); - END IF; - - IF NOT EXISTS (SELECT 1 FROM information_schema.tables WHERE table_name = 'control_administrative') THEN - CREATE TABLE control_administrative ( - id UUID PRIMARY KEY, - mission_id INT NOT NULL, - action_control_id UUID NOT NULL, - confirmed BOOLEAN, - compliant_operating_permit BOOLEAN, - up_to_date_navigation_permit BOOLEAN, - compliant_security_documents BOOLEAN, - observations TEXT, - CONSTRAINT fk_control_administrative_action_id FOREIGN KEY (action_control_id) REFERENCES mission_action_control(id) - ); - END IF; - -END $$; diff --git a/backend/target/classes/db/migration/V0.9__add_action_status_schema.sql b/backend/target/classes/db/migration/V0.9__add_action_status_schema.sql deleted file mode 100644 index 81e3a8616..000000000 --- a/backend/target/classes/db/migration/V0.9__add_action_status_schema.sql +++ /dev/null @@ -1,18 +0,0 @@ -DO $$ -BEGIN - IF NOT EXISTS ( - SELECT 1 - FROM information_schema.tables - WHERE table_name = 'mission_action_status' - ) THEN - CREATE TABLE mission_action_status ( - id UUID PRIMARY KEY, - mission_id INTEGER NOT NULL, - start_datetime_utc TIMESTAMP NOT NULL, - is_start BOOLEAN NOT NULL, - status VARCHAR(64) NOT NULL, - reason VARCHAR(64), - observations TEXT - ); - END IF; -END $$; diff --git a/backend/target/classes/db/migration/V1.2023.10.30.15.30__test_dummy.sql b/backend/target/classes/db/migration/V1.2023.10.30.15.30__test_dummy.sql deleted file mode 100644 index 335c73a1b..000000000 --- a/backend/target/classes/db/migration/V1.2023.10.30.15.30__test_dummy.sql +++ /dev/null @@ -1,6 +0,0 @@ -CREATE TABLE public.dummy ( - id SERIAL PRIMARY KEY, - first_name VARCHAR(64) NOT NULL, - last_name VARCHAR(64) NOT NULL, - is_archived BOOLEAN NOT NULL -); diff --git a/backend/target/classes/db/migration/V1.2023.10.30.16.30__remove_dummy.sql b/backend/target/classes/db/migration/V1.2023.10.30.16.30__remove_dummy.sql deleted file mode 100644 index 314d155a5..000000000 --- a/backend/target/classes/db/migration/V1.2023.10.30.16.30__remove_dummy.sql +++ /dev/null @@ -1 +0,0 @@ -DROP TABLE IF EXISTS dummy; diff --git a/backend/target/classes/db/migration/V1.2023.10.30.18.30__alter_controls_ref_key_format.sql b/backend/target/classes/db/migration/V1.2023.10.30.18.30__alter_controls_ref_key_format.sql deleted file mode 100644 index 0258e563d..000000000 --- a/backend/target/classes/db/migration/V1.2023.10.30.18.30__alter_controls_ref_key_format.sql +++ /dev/null @@ -1,83 +0,0 @@ -DO $$ -BEGIN - -- Change the data type of action_control_id from UUID to VARCHAR(36) - - -- First, create a new temporary column with the desired data type - ALTER TABLE control_security - ADD COLUMN action_control_id_temp VARCHAR(36); - - -- Update the temporary column with data from the original UUID column - UPDATE control_security - SET action_control_id_temp = action_control_id::VARCHAR; - - -- Drop the original UUID column - ALTER TABLE control_security - DROP COLUMN action_control_id; - - -- Rename the temporary column to action_control_id - ALTER TABLE control_security - RENAME COLUMN action_control_id_temp TO action_control_id; -END $$; - -DO $$ -BEGIN - -- Change the data type of action_control_id from UUID to VARCHAR(36) - - -- First, create a new temporary column with the desired data type - ALTER TABLE control_administrative - ADD COLUMN action_control_id_temp VARCHAR(36); - - -- Update the temporary column with data from the original UUID column - UPDATE control_administrative - SET action_control_id_temp = action_control_id::VARCHAR; - - -- Drop the original UUID column - ALTER TABLE control_administrative - DROP COLUMN action_control_id; - - -- Rename the temporary column to action_control_id - ALTER TABLE control_administrative - RENAME COLUMN action_control_id_temp TO action_control_id; -END $$; - -DO $$ -BEGIN - -- Change the data type of action_control_id from UUID to VARCHAR(36) - - -- First, create a new temporary column with the desired data type - ALTER TABLE control_navigation - ADD COLUMN action_control_id_temp VARCHAR(36); - - -- Update the temporary column with data from the original UUID column - UPDATE control_navigation - SET action_control_id_temp = action_control_id::VARCHAR; - - -- Drop the original UUID column - ALTER TABLE control_navigation - DROP COLUMN action_control_id; - - -- Rename the temporary column to action_control_id - ALTER TABLE control_navigation - RENAME COLUMN action_control_id_temp TO action_control_id; -END $$; - -DO $$ -BEGIN - -- Change the data type of action_control_id from UUID to VARCHAR(36) - - -- First, create a new temporary column with the desired data type - ALTER TABLE control_gens_de_mer - ADD COLUMN action_control_id_temp VARCHAR(36); - - -- Update the temporary column with data from the original UUID column - UPDATE control_gens_de_mer - SET action_control_id_temp = action_control_id::VARCHAR; - - -- Drop the original UUID column - ALTER TABLE control_gens_de_mer - DROP COLUMN action_control_id; - - -- Rename the temporary column to action_control_id - ALTER TABLE control_gens_de_mer - RENAME COLUMN action_control_id_temp TO action_control_id; -END $$; diff --git a/backend/target/classes/db/migration/V1.2023.11.01.18.30__create_infraction_tables.sql b/backend/target/classes/db/migration/V1.2023.11.01.18.30__create_infraction_tables.sql deleted file mode 100644 index fea232432..000000000 --- a/backend/target/classes/db/migration/V1.2023.11.01.18.30__create_infraction_tables.sql +++ /dev/null @@ -1,28 +0,0 @@ -DO $$ -BEGIN - IF NOT EXISTS (SELECT 1 FROM information_schema.tables WHERE table_name = 'infraction') THEN - CREATE TABLE infraction ( - id UUID PRIMARY KEY NOT NULL, - mission_id INT NOT NULL, - control_id UUID NOT NULL, - control_type VARCHAR NOT NULL, - formal_notice BOOLEAN, - observations VARCHAR - ); - END IF; -END $$; - -DO $$ -BEGIN - IF NOT EXISTS (SELECT 1 FROM information_schema.tables WHERE table_name = 'infraction_natinf') THEN - CREATE TABLE infraction_natinf ( - infraction_id UUID NOT NULL, - natinf_code INT NOT NULL, - - PRIMARY KEY (infraction_id, natinf_code), - - -- Define the foreign key constraint for the many-to-one relationship with infraction - CONSTRAINT fk_infractionnatinf_infraction FOREIGN KEY (infraction_id) REFERENCES infraction (id) - ); - END IF; -END $$; diff --git a/backend/target/classes/db/migration/V1.2023.11.06.18.30__alter_infraction_add_deletedat.sql b/backend/target/classes/db/migration/V1.2023.11.06.18.30__alter_infraction_add_deletedat.sql deleted file mode 100644 index cdf1450c7..000000000 --- a/backend/target/classes/db/migration/V1.2023.11.06.18.30__alter_infraction_add_deletedat.sql +++ /dev/null @@ -1,5 +0,0 @@ -DO $$ -BEGIN - ALTER TABLE infraction - ADD COLUMN deleted_at TIMESTAMP; -END $$; diff --git a/backend/target/classes/db/migration/V1.2023.11.06.20.30__alter_remove_all_deletedat.sql b/backend/target/classes/db/migration/V1.2023.11.06.20.30__alter_remove_all_deletedat.sql deleted file mode 100644 index c65fb9580..000000000 --- a/backend/target/classes/db/migration/V1.2023.11.06.20.30__alter_remove_all_deletedat.sql +++ /dev/null @@ -1,20 +0,0 @@ -DO $$ -BEGIN - ALTER TABLE infraction - DROP COLUMN deleted_at; - - ALTER TABLE control_administrative - DROP COLUMN deleted_at; - ALTER TABLE control_security - DROP COLUMN deleted_at; - ALTER TABLE control_navigation - DROP COLUMN deleted_at; - ALTER TABLE control_gens_de_mer - DROP COLUMN deleted_at; - - ALTER TABLE mission_action_control - DROP COLUMN deleted_at; - - ALTER TABLE mission_action_status - DROP COLUMN deleted_at; -END $$; diff --git a/backend/target/classes/db/migration/V1.2023.11.07.19.30__alter_infractions_add_actionid.sql b/backend/target/classes/db/migration/V1.2023.11.07.19.30__alter_infractions_add_actionid.sql deleted file mode 100644 index 856686da8..000000000 --- a/backend/target/classes/db/migration/V1.2023.11.07.19.30__alter_infractions_add_actionid.sql +++ /dev/null @@ -1,5 +0,0 @@ -DO $$ -BEGIN - ALTER TABLE infraction - ADD COLUMN action_id VARCHAR(36); -END $$; diff --git a/backend/target/classes/db/migration/V1.2023.11.07.20.30__create_env_infractions.sql b/backend/target/classes/db/migration/V1.2023.11.07.20.30__create_env_infractions.sql deleted file mode 100644 index 697cf31ee..000000000 --- a/backend/target/classes/db/migration/V1.2023.11.07.20.30__create_env_infractions.sql +++ /dev/null @@ -1,19 +0,0 @@ -DO $$ -BEGIN - IF NOT EXISTS ( - SELECT 1 - FROM information_schema.tables - WHERE table_name = 'infraction_env_target' - ) THEN - CREATE TABLE infraction_env_target ( - id UUID PRIMARY KEY, - mission_id INTEGER NOT NULL, - action_id VARCHAR(36) NOT NULL, - infraction_id UUID NOT NULL, - vessel_identifier VARCHAR(64) NOT NULL, - identity_controlled_person VARCHAR(128) NOT NULL, - vessel_type VARCHAR(32) NOT NULL, - vessel_size VARCHAR(32) NOT NULL - ); - END IF; -END $$; diff --git a/backend/target/classes/db/migration/V1.2023.11.08.17.30__alter_infraction_field_formalnotice.sql b/backend/target/classes/db/migration/V1.2023.11.08.17.30__alter_infraction_field_formalnotice.sql deleted file mode 100644 index 51cb584bc..000000000 --- a/backend/target/classes/db/migration/V1.2023.11.08.17.30__alter_infraction_field_formalnotice.sql +++ /dev/null @@ -1,5 +0,0 @@ -DO $$ -BEGIN - ALTER TABLE infraction DROP COLUMN formal_notice; - ALTER TABLE infraction ADD COLUMN formal_notice varchar(8); -END $$; diff --git a/backend/target/classes/db/migration/V1.2023.11.08.20.54__create_crew_tables.sql b/backend/target/classes/db/migration/V1.2023.11.08.20.54__create_crew_tables.sql deleted file mode 100644 index 086578717..000000000 --- a/backend/target/classes/db/migration/V1.2023.11.08.20.54__create_crew_tables.sql +++ /dev/null @@ -1,35 +0,0 @@ -CREATE TABLE agent ( - id SERIAL PRIMARY KEY, - first_name VARCHAR(255) NOT NULL, - last_name VARCHAR(255) NOT NULL, - deleted_at TIMESTAMP -); - -CREATE TABLE agent_role ( - id SERIAL PRIMARY KEY, - title VARCHAR(255) NOT NULL -); - - -CREATE TABLE service ( - id SERIAL PRIMARY KEY, - name VARCHAR(255) NOT NULL -); - -CREATE TABLE agent_service ( - agent_id INT, - service_id INT, - FOREIGN KEY (agent_id) REFERENCES agent(id), - FOREIGN KEY (service_id) REFERENCES service(id), - PRIMARY KEY (agent_id, service_id) -); - -CREATE TABLE agent_crew ( - id SERIAL PRIMARY KEY, - agent_id INT, - comment VARCHAR(255) DEFAULT NULL, - agent_role_id INT NOT NULL, - mission_id INT DEFAULT NULL, - FOREIGN KEY (agent_id) REFERENCES agent(id), - FOREIGN KEY (agent_role_id) REFERENCES agent_role(id) -); diff --git a/backend/target/classes/db/migration/V1.2023.11.15.11.09.40__alter_table_service_add_service_linked.sql b/backend/target/classes/db/migration/V1.2023.11.15.11.09.40__alter_table_service_add_service_linked.sql deleted file mode 100644 index e94df47f3..000000000 --- a/backend/target/classes/db/migration/V1.2023.11.15.11.09.40__alter_table_service_add_service_linked.sql +++ /dev/null @@ -1,5 +0,0 @@ -ALTER TABLE service -ADD COLUMN service_linked_id INT DEFAULT NULL, -ADD CONSTRAINT fk_service_service_linked -FOREIGN KEY (service_linked_id) REFERENCES service (id) -ON DELETE SET NULL; diff --git a/backend/target/classes/db/migration/V1.2023.11.15.19.30__create_mission_general_info_table.sql b/backend/target/classes/db/migration/V1.2023.11.15.19.30__create_mission_general_info_table.sql deleted file mode 100644 index db1bdec53..000000000 --- a/backend/target/classes/db/migration/V1.2023.11.15.19.30__create_mission_general_info_table.sql +++ /dev/null @@ -1,12 +0,0 @@ -DO $$ -BEGIN - IF NOT EXISTS (SELECT 1 FROM information_schema.tables WHERE table_name = 'mission_general_info') THEN - CREATE TABLE mission_general_info ( - id INT PRIMARY KEY NOT NULL, - mission_id INT NOT NULL, - distance_in_nautical_miles FLOAT, - consumed_go_in_liters FLOAT, - consumed_fuel_in_liters FLOAT - ); - END IF; -END $$; diff --git a/backend/target/classes/db/migration/V1.2023.11.27__drop_agent_crew_constraint.sql b/backend/target/classes/db/migration/V1.2023.11.27__drop_agent_crew_constraint.sql deleted file mode 100644 index 49051f6ed..000000000 --- a/backend/target/classes/db/migration/V1.2023.11.27__drop_agent_crew_constraint.sql +++ /dev/null @@ -1,2 +0,0 @@ -ALTER TABLE agent_crew -DROP CONSTRAINT agent_crew_agent_id_fkey; diff --git a/backend/target/classes/db/migration/V1.2023.11.28.14.30__update_user_link_to_agent.sql b/backend/target/classes/db/migration/V1.2023.11.28.14.30__update_user_link_to_agent.sql deleted file mode 100644 index 575922721..000000000 --- a/backend/target/classes/db/migration/V1.2023.11.28.14.30__update_user_link_to_agent.sql +++ /dev/null @@ -1,11 +0,0 @@ -DO $$ -BEGIN - -- Create a new column with a foreign key constraint allowing NULL - ALTER TABLE "user" - ADD COLUMN agent_id INTEGER REFERENCES "agent"(id); - - -- Add a foreign key constraint explicitly allowing NULL - ALTER TABLE "user" - ADD CONSTRAINT fk_user_agent_id - FOREIGN KEY (agent_id) REFERENCES "agent"(id) ON DELETE SET NULL; -END $$; diff --git a/backend/target/classes/db/migration/V1.2023.11.28.20.54__alter_crew_tables.sql b/backend/target/classes/db/migration/V1.2023.11.28.20.54__alter_crew_tables.sql deleted file mode 100644 index e6c53e6e6..000000000 --- a/backend/target/classes/db/migration/V1.2023.11.28.20.54__alter_crew_tables.sql +++ /dev/null @@ -1,12 +0,0 @@ - -DROP TABLE agent_crew; - -CREATE TABLE mission_crew ( - id SERIAL PRIMARY KEY, - agent_id INT, - comment VARCHAR(255) DEFAULT NULL, - agent_role_id INT NOT NULL, - mission_id INT DEFAULT NULL, - FOREIGN KEY (agent_id) REFERENCES agent(id), - FOREIGN KEY (agent_role_id) REFERENCES agent_role(id) -); diff --git a/backend/target/classes/db/migration/V1.2023.11.29.10.54__alter_user_tables.sql b/backend/target/classes/db/migration/V1.2023.11.29.10.54__alter_user_tables.sql deleted file mode 100644 index 5a1d7315b..000000000 --- a/backend/target/classes/db/migration/V1.2023.11.29.10.54__alter_user_tables.sql +++ /dev/null @@ -1,18 +0,0 @@ -DO $$ -BEGIN - ALTER TABLE "user" - ADD COLUMN first_name VARCHAR(64), - ADD COLUMN last_name VARCHAR(64); - - UPDATE "user" - SET - first_name = name, - last_name = name; - - ALTER TABLE "user" - ALTER COLUMN first_name SET NOT NULL, - ALTER COLUMN last_name SET NOT NULL; - - ALTER TABLE "user" - DROP COLUMN name; -END $$; diff --git a/backend/target/classes/db/migration/V1.2023.12.04.10.54__add_agent_roles.sql b/backend/target/classes/db/migration/V1.2023.12.04.10.54__add_agent_roles.sql deleted file mode 100644 index 828d55fe1..000000000 --- a/backend/target/classes/db/migration/V1.2023.12.04.10.54__add_agent_roles.sql +++ /dev/null @@ -1,14 +0,0 @@ -DO $$ -BEGIN - INSERT INTO agent_role (title) VALUES - ('Commandant'), - ('Second capitaine'), - ('Chef mécanicien'), - ('Second mécanicien'), - ('Mécanicien électricien'), - ('Mécanicien'), - ('Chef de quart'), - ('Maître d’équipage'), - ('Agent pont'), - ('Cuisinier'); -END $$; \ No newline at end of file diff --git a/backend/target/classes/db/migration/V1.2023.12.04.11.34__add_services.sql b/backend/target/classes/db/migration/V1.2023.12.04.11.34__add_services.sql deleted file mode 100644 index 2a02f423f..000000000 --- a/backend/target/classes/db/migration/V1.2023.12.04.11.34__add_services.sql +++ /dev/null @@ -1,13 +0,0 @@ -DO $$ -BEGIN - INSERT INTO service (id, name, service_linked_id) VALUES - (1, 'pam_jeanne_barret_A', 2), - (2, 'pam_jeanne_barret_B', 1), - (3, 'pam_themis_A', 4), - (4, 'pam_themis_B', 3), - (5, 'pam_iris_A', 6), - (6, 'pam_iris_B', 5), - (7, 'pam_gyptis_A', 8), - (8, 'pam_gyptis_B', 7); - -END $$; \ No newline at end of file diff --git a/backend/target/classes/db/migration/V1.2023.12.04.11.44__add_agents.sql b/backend/target/classes/db/migration/V1.2023.12.04.11.44__add_agents.sql deleted file mode 100644 index 8896e730b..000000000 --- a/backend/target/classes/db/migration/V1.2023.12.04.11.44__add_agents.sql +++ /dev/null @@ -1,85 +0,0 @@ -DO $$ -BEGIN - INSERT INTO agent (first_name, last_name) VALUES - -- jeanne barret B: - ('Christian', 'Sauvage'), - ('François', 'Dambron'), - ('Frédéric', 'Grégoire'), - ('Nicolas', 'Delattre'), - ('Jean François', 'Albert'), - ('Guillaume', 'Gatoux'), - ('Arnaud', 'Celton'), - ('Francis', 'Beyaert'), - ('Gaylord', 'Suret'), - ('Thierry', 'Lesaulnier'), - ('Laurent', 'Duval'), - ('Philippe', 'Bon'), - ('Adeline', 'Lagadec'), - ('Pascal', 'Morel'), - ('Yann', 'Mollat'), - -- iris A: - ('Xavier', 'Lacourrege'), - ('Thierry', 'Crochard'), - ('Marc', 'Ottini'), - ('Gilles', 'Menuge'), - ('Jean-David', 'Duhaudt'), - ('Stephane', 'Bistour'), - ('Herve', 'Simon'), - ('Fabien', 'Roman'), - ('Stéphane', 'Lelièvre'), - ('Yves', 'Maniette'), - ('Gaétan', 'Merrien'), - ('Frédéric', 'Beyaert'), - ('Franck', 'Touron'), - ('Frédéric', 'Dechaine'), - ('Francois', 'Le Bon'), - -- themis A: - ('Ariane', 'Regaud'), - ('Philippe', 'Gahinet'), - ('Didier', 'Cozic'), - ('Régis', 'Soubise'), - ('Philippe', 'Davies'), - ('Franck', 'Grouiec'), - ('Stéphane', 'Hellio'), - ('Pascal', 'Rousselet'), - ('Laurent', 'Forgeard'), - ('Oswald', 'Isore'), - ('Yvan', 'Pavie'), - ('Thierry', 'Yhuel'), - ('Stéphane', 'Horel'), - ('Pascal', 'Barinka'), - ('Nicolas', 'Daden'), - ('Cyril', 'Le Scoarnec'), - -- themis B: - ('Frédéric', 'Schneider'), - ('Pascal', 'Isore'), - ('Philippe', 'Fournier'), - ('Régis', 'Tertu'), - ('Raymond', 'Cacitti'), - ('Philippe', 'Darsu'), - ('Michel', 'Marchand'), - ('Cyril', 'Lelandois'), - ('Jean Marc', 'Bourbigot'), - ('David', 'Collomp'), - ('Jérome', 'Fievet'), - ('Brian', 'O’Rorke'), - ('Ludovic', 'Daoulas'), - ('Loup', 'Genty'), - ('JL', 'Chapovaloff'), - -- gyptis A: - ('Ludovic', 'Bouteillon'), - ('Serge', 'Croville'), - ('Sylvain', 'Rebeyrotte'), - ('Thomas', 'Le Gall'), - ('Lilian', 'Roue'), - ('Laurent', 'Paronneau'), - ('Nicolas', 'Peyre'), - ('José', 'Maillot'), - ('Michel', 'Ceres'), - ('David', 'Demilly'), - ('Anne', 'Zamaron'), - ('Cyrille', 'Carval'), - ('Guillaume', 'Mardelle'), - ('Pierre', 'Buriez'); - -END $$; \ No newline at end of file diff --git a/backend/target/classes/db/migration/V1.2023.12.04.11.55__add_agent_service_link.sql b/backend/target/classes/db/migration/V1.2023.12.04.11.55__add_agent_service_link.sql deleted file mode 100644 index de046c95c..000000000 --- a/backend/target/classes/db/migration/V1.2023.12.04.11.55__add_agent_service_link.sql +++ /dev/null @@ -1,90 +0,0 @@ -DO $$ -BEGIN - -- Insert into 'agent_service' table -INSERT INTO agent_service (service_id, agent_id) VALUES - -- pam_jeanne_barret_B - (2, 1), -- Christian Sauvage - (2, 2), -- François Dambron - (2, 3), -- Frédéric Grégoire - (2, 4), -- Nicolas Delattre - (2, 5), -- Jean François Albert - (2, 6), -- Guillaume Gatoux - (2, 7), -- Arnaud Celton - (2, 8), -- Francis Beyaert - (2, 9), -- Gaylord Suret - (2, 10), -- Thierry Lesaulnier - (2, 11), -- Laurent Duval - (2, 12), -- Philippe Bon - (2, 13), -- Adeline Lagadec - (2, 14), -- Pascal Morel - (2, 15), -- Yann Mollat - - -- pam_iris_A - (5, 16), -- Xavier Lacourrege - (5, 17), -- Thierry Crochard - (5, 18), -- Marc Ottini - (5, 19), -- Gilles Menuge - (5, 20), -- Jean-David Duhaudt - (5, 21), -- Stephane Bistour - (5, 22), -- Herve Simon - (5, 23), -- Fabien Roman - (5, 24), -- Stéphane Lelièvre - (5, 25), -- Yves Maniette - (5, 26), -- Gaétan Merrien - (5, 27), -- Frédéric Beyaert - (5, 28), -- Franck Touron - (5, 29), -- Frédéric Dechaine - (5, 30), -- Francois Le Bon - - -- pam_themis_A - (3, 31), -- Ariane Regaud - (3, 32), -- Philippe Gahinet - (3, 33), -- Didier Cozic - (3, 34), -- Régis Soubise - (3, 35), -- Philippe Davies - (3, 36), -- Franck Grouiec - (3, 37), -- Stéphane Hellio - (3, 38), -- Pascal Rousselet - (3, 39), -- Laurent Forgeard - (3, 40), -- Oswald Isore - (3, 41), -- Yvan Pavie - (3, 42), -- Thierry Yhuel - (3, 43), -- Stéphane Horel - (3, 44), -- Pascal Barinka - (3, 45), -- Nicolas Daden - (3, 46), -- Cyril Le Scoarnec - - -- pam_themis_B - (4, 47), -- Frédéric Schneider - (4, 48), -- Pascal Isore - (4, 49), -- Philippe Fournier - (4, 50), -- Régis Tertu - (4, 51), -- Raymond Cacitti - (4, 52), -- Philippe Darsu - (4, 53), -- Michel Marchand - (4, 54), -- Cyril Lelandois - (4, 55), -- Jean Marc Bourbigot - (4, 56), -- David Collomp - (4, 57), -- Jérome Fievet - (4, 58), -- Brian O’Rorke - (4, 59), -- Ludovic Daoulas - (4, 60), -- Loup Genty - (4, 61), -- JL Chapovaloff - - -- pam_gyptis_A - (7, 62), -- Ludovic Bouteillon - (7, 63), -- Serge Croville - (7, 64), -- Sylvain Rebeyrotte - (7, 65), -- Thomas Le Gall - (7, 66), -- Lilian Roue - (7, 67), -- Laurent Paronneau - (7, 68), -- Nicolas Peyre - (7, 69), -- José Maillot - (7, 70), -- Michel Ceres - (7, 71), -- David Demilly - (7, 72), -- Anne Zamaron - (7, 73), -- Cyrille Carval - (7, 74), -- Guillaume Mardelle - (7, 75); -- Pierre Buriez - -END $$; \ No newline at end of file diff --git a/backend/target/classes/graphql/action.graphqls b/backend/target/classes/graphql/action.graphqls deleted file mode 100644 index 99ef3c898..000000000 --- a/backend/target/classes/graphql/action.graphqls +++ /dev/null @@ -1,243 +0,0 @@ -extend type Mutation { - status(id: String!): Action - addOrUpdateStatus(statusAction: ActionStatusInput!): NavActionStatus! - deleteStatus(id: String!): Boolean! - addOrUpdateControl(controlAction: ActionControlInput!): NavActionControl! - deleteControl(id: String!): Boolean! -} - -type Action { - id: String - startDateTimeUtc: String! - endDateTimeUtc: String - source: MissionSource! - status: ActionStatusType! - type: ActionType - data: ActionData -} - -input ActionStatusInput { - id: String - missionId: Int! - startDateTimeUtc: String - status: ActionStatusType! - reason: ActionStatusReason - isStart: Boolean! - observations: String -} - -input ActionControlInput { - id: String - missionId: Int! - startDateTimeUtc: String - endDateTimeUtc: String - controlMethod: ControlMethod! - latitude: Float - longitude: Float - vesselType: VesselType! - vesselIdentifier: String - vesselSize: VesselSize - identityControlledPerson: String - observations: String -} - -enum MissionSource { - MONITORENV - MONITORFISH - POSEIDON_CACEM - POSEIDON_CNSP - RAPPORTNAV -} - -union ActionData = - FishActionData - | EnvActionData - | NavActionControl - | NavActionStatus - -type NavActionStatus { - id: String! - startDateTimeUtc: String! - status: ActionStatusType! - reason: ActionStatusReason - isStart: Boolean! - observations: String -} - -enum ActionStatusType { - NAVIGATING - ANCHORED - DOCKED - UNAVAILABLE - UNKNOWN -} -enum ActionStatusReason { - MAINTENANCE - WEATHER - REPRESENTATION - ADMINISTRATION - HARBOUR_CONTROL - OTHER -} - -type NavActionControl { - id: String! - startDateTimeUtc: String! - endDateTimeUtc: String - controlMethod: ControlMethod - latitude: Float - longitude: Float - vesselType: VesselType - vesselIdentifier: String - vesselSize: VesselSize - identityControlledPerson: String - observations: String - controlAdministrative: ControlAdministrative - controlGensDeMer: ControlGensDeMer - controlNavigation: ControlNavigation - controlSecurity: ControlSecurity -} - -enum ControlMethod { - SEA - AIR - LAND -} - -enum VesselType { - FISHING - SAILING - MOTOR - COMMERCIAL - SAILING_LEISURE -} - -enum VesselSize { - LESS_THAN_12m - FROM_12_TO_24m - FROM_24_TO_46m - MORE_THAN_46m -} - -enum ActionType { - CONTROL - SURVEILLANCE - CONTACT - NOTE - STATUS - OTHER -} - -type EnvActionData { - id: String! - actionStartDateTimeUtc: String! - actionEndDateTimeUtc: String! - geom: String - facade: String - department: String - themes: [ThemeEntity] - observations: String - infractions: [InfractionByTarget] - actionNumberOfControls: Int - actionTargetType: ActionTargetTypeEnum - vehicleType: VehicleTypeEnum - availableControlTypes: [ControlType] - controlsToComplete: [ControlType] - controlAdministrative: ControlAdministrative - controlGensDeMer: ControlGensDeMer - controlNavigation: ControlNavigation - controlSecurity: ControlSecurity -} - -type FishActionData { - id: String! - actionDatetimeUtc: String! - vesselId: Int - vesselName: String - latitude: Float - longitude: Float - facade: String - actionType: FishActionType - controlsToComplete: [ControlType] - controlAdministrative: ControlAdministrative - controlGensDeMer: ControlGensDeMer - controlNavigation: ControlNavigation - controlSecurity: ControlSecurity - emitsVms: ControlCheck - emitsAis: ControlCheck - licencesMatchActivity: ControlCheck - logbookMatchesActivity: ControlCheck - licencesAndLogbookObservations: String - gearOnboard: [GearControl] - speciesOnboard: [SpeciesControl] - speciesObservations: String - seizureAndDiversion: Boolean - seizureAndDiversionComments: String - hasSomeGearsSeized: Boolean - hasSomeSpeciesSeized: Boolean - otherComments: String - vesselTargeted: ControlCheck - unitWithoutOmegaGauge: Boolean - controlQualityComments: String - feedbackSheetRequired: Boolean - userTrigram: String - faoAreas: [String] - segments: [FleetSegment] -} - -type FleetSegment { - segment: String - segmentName: String -} - -type GearControl { - comments: String - controlledMesh: Float - declaredMesh: Float - gearCode: String - gearName: String - gearWasControlled: Boolean - hasUncontrolledMesh: Boolean -} - -type SpeciesControl { - speciesCode: String - nbFish: Float - declaredWeight: Float - controlledWeight: Float - underSized: Boolean -} - - -enum ControlCheck { - YES - NO - NOT_APPLICABLE -} - -enum FishActionType { - SEA_CONTROL - LAND_CONTROL - AIR_CONTROL - AIR_SURVEILLANCE - OBSERVATION -} - -type ThemeEntity { - theme: String - subThemes: [String] - protectedSpecies: [String] -} - -enum ActionTargetTypeEnum { - VEHICLE - COMPANY - INDIVIDUAL -} - -enum VehicleTypeEnum { - VESSEL - OTHER_SEA - VEHICLE_LAND - VEHICLE_AIR -} diff --git a/backend/target/classes/graphql/controls.graphqls b/backend/target/classes/graphql/controls.graphqls deleted file mode 100644 index 195f0c048..000000000 --- a/backend/target/classes/graphql/controls.graphqls +++ /dev/null @@ -1,118 +0,0 @@ -extend type Mutation { - addOrUpdateControlNavigation( - control: ControlNavigationInput! - ): ControlNavigation! - addOrUpdateControlSecurity(control: ControlSecurityInput!): ControlSecurity! - addOrUpdateControlAdministrative( - control: ControlAdministrativeInput! - ): ControlAdministrative! - addOrUpdateControlGensDeMer( - control: ControlGensDeMerInput! - ): ControlGensDeMer! - deleteControlAdministrative(actionId: String!): Boolean! - deleteControlSecurity(actionId: String!): Boolean! - deleteControlNavigation(actionId: String!): Boolean! - deleteControlGensDeMer(actionId: String!): Boolean! -} - -enum ControlType { - ADMINISTRATIVE - GENS_DE_MER - NAVIGATION - SECURITY -} - -enum ControlResult { - YES - NO - NOT_CONTROLLED - NOT_CONCERNED -} - -type ControlNavigation { - id: String! - amountOfControls: Int! - unitShouldConfirm: Boolean - unitHasConfirmed: Boolean - observations: String - infractions: [Infraction] -} - -type ControlSecurity { - id: String! - amountOfControls: Int! - unitShouldConfirm: Boolean - unitHasConfirmed: Boolean - observations: String - infractions: [Infraction] -} - -type ControlAdministrative { - id: String! - amountOfControls: Int! - unitShouldConfirm: Boolean - unitHasConfirmed: Boolean - compliantOperatingPermit: ControlResult - upToDateNavigationPermit: ControlResult - compliantSecurityDocuments: ControlResult - observations: String - infractions: [Infraction] -} - -type ControlGensDeMer { - id: String! - amountOfControls: Int! - unitShouldConfirm: Boolean - unitHasConfirmed: Boolean - staffOutnumbered: ControlResult - upToDateMedicalCheck: ControlResult - knowledgeOfFrenchLawAndLanguage: ControlResult - observations: String - infractions: [Infraction] -} - -input ControlNavigationInput { - id: String - missionId: String! - actionControlId: String! - amountOfControls: Int! - unitShouldConfirm: Boolean - unitHasConfirmed: Boolean - observations: String -} - -input ControlSecurityInput { - id: String - missionId: String! - actionControlId: String! - amountOfControls: Int! - unitShouldConfirm: Boolean - unitHasConfirmed: Boolean - observations: String -} - -input ControlAdministrativeInput { - id: String - missionId: String! - actionControlId: String! - amountOfControls: Int! - unitShouldConfirm: Boolean - unitHasConfirmed: Boolean - compliantOperatingPermit: ControlResult - upToDateNavigationPermit: ControlResult - compliantSecurityDocuments: ControlResult - observations: String -} - -input ControlGensDeMerInput { - id: String - missionId: String! - actionControlId: String! - amountOfControls: Int! - unitShouldConfirm: Boolean - unitHasConfirmed: Boolean - staffOutnumbered: ControlResult - upToDateMedicalCheck: ControlResult - knowledgeOfFrenchLawAndLanguage: ControlResult - observations: String -} diff --git a/backend/target/classes/graphql/crew.graphqls b/backend/target/classes/graphql/crew.graphqls deleted file mode 100644 index 0d2135f91..000000000 --- a/backend/target/classes/graphql/crew.graphqls +++ /dev/null @@ -1,55 +0,0 @@ -extend type Query { - agents: [Agent] - agentsByServiceId(serviceId: ID!): [Agent] - agentsByUserService: [Agent] - missionCrewByMissionId(missionId: ID!): [MissionCrew] - agentRoles: [AgentRole] -} - -extend type Mutation { - deleteMissionCrew(id: ID!): Boolean - addOrUpdateMissionCrew(crew: MissionCrewInput!): MissionCrew! -} - -type Agent { - id: ID! - firstName: String! - lastName: String! - services: [Service] -} - -type Service { - id: ID! - name: String! -} - -type AgentRole { - id: ID! - title: String! -} - -type MissionCrew { - id: ID! - agent: Agent - comment: String - role: AgentRole -} - -input MissionCrewInput { - id: ID - agent: AgentInput - missionId: Int! - comment: String - role: AgentRoleInput -} - -input AgentInput { - id: ID - firstName: String! - lastName: String! -} - -input AgentRoleInput { - id: ID - title: String! -} diff --git a/backend/target/classes/graphql/infraction.graphqls b/backend/target/classes/graphql/infraction.graphqls deleted file mode 100644 index 9ba56f125..000000000 --- a/backend/target/classes/graphql/infraction.graphqls +++ /dev/null @@ -1,72 +0,0 @@ -extend type Mutation { - addOrUpdateInfraction(infraction: InfractionInput!): Infraction! - addOrUpdateInfractionForEnvTarget( - infraction: InfractionWithNewTargetInput! - ): Infraction! - deleteInfraction(id: String!): Boolean! -} - -type Infraction { - id: String! - controlType: String - formalNotice: String - natinfs: [Natinf] - observations: String - target: InfractionTarget -} - -type InfractionTarget { - id: String! - vesselIdentifier: String - identityControlledPerson: String - vesselType: VesselType - vesselSize: VesselSize - companyName: String - relevantCourt: String - infractionType: String - formalNotice: String - toProcess: Boolean -} - -# for Env controls, we group by vesselIdentifier -type InfractionByTarget { - vesselIdentifier: String - vesselType: VesselType - infractions: [Infraction] -} - -type Natinf { - infraction: String! - natinfCode: Int! -} - -input InfractionInput { - id: String - missionId: String! - actionId: String! - controlId: String - controlType: String! - formalNotice: String - natinfs: [NatinfInput] - observations: String -} - -input InfractionWithNewTargetInput { - id: String - missionId: String! - actionId: String! - controlId: String - controlType: String! - formalNotice: String - natinfs: [NatinfInput] - observations: String - vesselIdentifier: String! - identityControlledPerson: String! - vesselType: VesselType! - vesselSize: VesselSize! -} - -input NatinfInput { - infraction: String! - natinfCode: Int! -} diff --git a/backend/target/classes/graphql/mission.graphqls b/backend/target/classes/graphql/mission.graphqls deleted file mode 100644 index 700e3c012..000000000 --- a/backend/target/classes/graphql/mission.graphqls +++ /dev/null @@ -1,41 +0,0 @@ -type Query { - missions(userId: ID): [Mission]! - mission(missionId: ID): Mission! - missionGeneralInfo(missionId: ID): MissionGeneralInfo -} - -type Mutation { - updateMission(mission: MissionInput!): Mission! - updateMissionGeneralInfo(info: MissionGeneralInfoInput!): MissionGeneralInfo! -} - -input MissionInput { - id: ID! - startDateTimeUtc: String! - endDateTimeUtc: String! -} - -type Mission { - id: ID! - isClosed: Boolean! - missionSource: String! - startDateTimeUtc: String! - endDateTimeUtc: String - actions: [Action] - generalInfo: MissionGeneralInfo -} - -type MissionGeneralInfo { - id: ID! - distanceInNauticalMiles: Float - consumedGOInLiters: Float - consumedFuelInLiters: Float -} - -input MissionGeneralInfoInput { - id: String - missionId: String! - distanceInNauticalMiles: Float - consumedGOInLiters: Float - consumedFuelInLiters: Float -} diff --git a/backend/target/classes/graphql/user.graphqls b/backend/target/classes/graphql/user.graphqls deleted file mode 100644 index f0606baa3..000000000 --- a/backend/target/classes/graphql/user.graphqls +++ /dev/null @@ -1,6 +0,0 @@ -type User { - id: ID - name: String! - email: String! - token: String -} diff --git a/docker-compose.yml b/docker-compose.yml index 9d58534d5..e69de29bb 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,71 +0,0 @@ -version: "3" -services: - app: - build: - context: . - dockerfile: infra/docker/app/Dockerfile - target: build-all - ports: - # - ${BACKEND_HTTP_PORT}:8880 - - 8880:8880 - - 80:80 - - 8000:8000 - volumes: - - ./frontend:/tmp/frontend - depends_on: - - db - - metabase - # networks: - # - backend-network - - db: - image: postgres:15.6-alpine - ports: - - "5432:5432" - environment: - POSTGRES_DB: rapportnavdb - POSTGRES_USER: postgres - POSTGRES_PASSWORD: postgres - volumes: - - db_data:/var/lib/postgresql/data - healthcheck: - test: [ "CMD-SHELL", "pg_isready -U postgres" ] - interval: 1s - timeout: 1s - retries: 30 - # networks: - # - backend-network - - metabase: - image: metabase/metabase:latest - ports: - - 3000:3000 - volumes: - - metabase_data:/metabase-data - environment: - # - MB_DB_CONNECTION_URI="db:5432/rapportnavdb?user=postgres&password=postgres" - - MB_DB_CONNECTION_URI=postgres://db:5432/rapportnavdb?currentSchema=metabase - - MB_DB_FILE=/metabase-data/metabase.db - - MB_DB_TYPE=postgres - # - MB_DB_DBNAME=rapportnavdb - # - MB_DB_PORT=5432 - - MB_DB_USER=postgres - - MB_DB_PASS=postgres - # - MB_DB_HOST=db - restart: always - depends_on: - - db - # networks: - # - backend-network - -# networks: -# backend-network: -# external: false -# name: backend-network -# default: -# driver: bridge - -volumes: - db_data: - name: db - metabase_data: diff --git a/docker-compose.yml.j2 b/docker-compose.yml.j2 index 2197d0ffd..83cb6d101 100644 --- a/docker-compose.yml.j2 +++ b/docker-compose.yml.j2 @@ -44,8 +44,33 @@ services: interval: 1s timeout: 1s retries: 30 -# networks: -# backend_network: + + unleash_proxy: + image: unleashorg/unleash-proxy:v1.1.1 + ports: + - "3000:3000" + environment: + # Proxy clients must use one of these keys to connect to the + # Proxy. To add more keys, separate them with a comma (`key1,key2`). + # UNLEASH_PROXY_CLIENT_KEYS: "randomkey" + UNLEASH_PROXY_SECRETS: "randomkey" + UNLEASH_APP_NAME: "local" + # This points the Proxy to the Unleash server API + UNLEASH_URL: "https://gitlab.com/api/v4/feature_flags/unleash/55951570" + UNLEASH_INSTANCE_ID: "glffct-ceHLxPcFMqyXsyGPXSkx" + # This is the API token that the Proxy uses to communicate with + # the Unleash server. + UNLEASH_API_TOKEN: "glpat-6f7PUWe9PwRoa53LUmsZ" + ENABLE_ALL_ENDPOINT: true + LOG_LEVEL: "debug" + # depends_on: + # - web + healthcheck: + test: wget --no-verbose --tries=1 --spider http://localhost:3000/proxy/health || exit 1 + interval: 1s + timeout: 1m + retries: 5 + volumes: db: name: rapportnavdb diff --git a/frontend/.env.d.ts b/frontend/.env.d.ts new file mode 100644 index 000000000..b52276748 --- /dev/null +++ b/frontend/.env.d.ts @@ -0,0 +1,10 @@ +// https://vitejs.dev/guide/env-and-mode#intellisense-for-typescript +/// + +interface ImportMetaEnv { + readonly FRONTEND_SENTRY_DSN: string +} + +interface ImportMeta { + readonly env: ImportMetaEnv +} diff --git a/frontend/.env.example b/frontend/.env.example new file mode 100644 index 000000000..be9e9cdbf --- /dev/null +++ b/frontend/.env.example @@ -0,0 +1,5 @@ + +################################################################################ +# Sentry + +FRONTEND_SENTRY_DSN=https://something@sentry.incubateur.net/121 diff --git a/frontend/.env.local.defaults b/frontend/.env.local.defaults new file mode 100644 index 000000000..4e2331c97 --- /dev/null +++ b/frontend/.env.local.defaults @@ -0,0 +1,4 @@ +################################################################################ +# Sentry + +FRONTEND_SENTRY_DSN=https://8857258f9f1549968b13e15759bdf2bc@sentry.incubateur.net/121 diff --git a/frontend/.env.production.defaults b/frontend/.env.production.defaults new file mode 100644 index 000000000..4e2331c97 --- /dev/null +++ b/frontend/.env.production.defaults @@ -0,0 +1,4 @@ +################################################################################ +# Sentry + +FRONTEND_SENTRY_DSN=https://8857258f9f1549968b13e15759bdf2bc@sentry.incubateur.net/121 diff --git a/frontend/.gitignore b/frontend/.gitignore index c5892d753..e389ce6f3 100644 --- a/frontend/.gitignore +++ b/frontend/.gitignore @@ -1,11 +1,24 @@ # See https://help.github.com/articles/ignoring-files/ for more about ignoring files. +# env .env +.env.local +.env.development +.env.development.local +.env.staging +.env.staging.local +.env.production +.env.production.local +.env.test +.env.test.local # dependencies /node_modules /.pnp .pnp.js +npm-debug.log* +yarn-debug.log* +yarn-error.log* # testing /coverage @@ -16,11 +29,3 @@ # misc .DS_Store -.env.local -.env.development.local -.env.test.local -.env.production.local - -npm-debug.log* -yarn-debug.log* -yarn-error.log* diff --git a/frontend/index.html b/frontend/index.html index 8aa9f95ef..4559e5d98 100644 --- a/frontend/index.html +++ b/frontend/index.html @@ -9,7 +9,16 @@ +
+ + + + + + diff --git a/frontend/package-lock.json b/frontend/package-lock.json index 7d261f9f6..333a335ca 100644 --- a/frontend/package-lock.json +++ b/frontend/package-lock.json @@ -12,6 +12,7 @@ "@mtes-mct/monitor-ui": "^13.7.2", "@sentry/integrations": "^7.101.1", "@sentry/react": "^7.100.1", + "@unleash/proxy-client-react": "^4.2.2", "apollo3-cache-persist": "^0.14.1", "date-fns": "^2.30.0", "email-validator": "^2.0.4", @@ -25,10 +26,14 @@ "rsuite": "^5.53.2", "styled-components": "^5.3.11", "type-fest": "^4.10.2", + "unleash-proxy-client": "^3.3.1", "uuid": "^9.0.1", "web-vitals": "^2.1.4" }, "devDependencies": { + "@import-meta-env/cli": "^0.6.8", + "@import-meta-env/prepare": "0.1.13", + "@import-meta-env/unplugin": "^0.5.1", "@testing-library/jest-dom": "^5.16.5", "@testing-library/react": "^14.0.0", "@testing-library/user-event": "^14.4.3", @@ -2267,6 +2272,287 @@ "dev": true, "license": "BSD-3-Clause" }, + "node_modules/@import-meta-env/cli": { + "version": "0.6.8", + "resolved": "https://registry.npmjs.org/@import-meta-env/cli/-/cli-0.6.8.tgz", + "integrity": "sha512-Lunsmlj02yVtI5drlhNwIUFAQ0wsIUYIrz0Nm5jbvmYvyEUsxC8Qotnf3gXTfvM9Yuutvuc2+dx4uXpa3DajTg==", + "dev": true, + "dependencies": { + "commander": "11.1.0", + "glob": "10.3.10", + "picocolors": "1.0.0", + "serialize-javascript": "6.0.1" + }, + "bin": { + "import-meta-env": "bin/import-meta-env.js" + }, + "engines": { + "node": ">= 14" + }, + "peerDependencies": { + "@import-meta-env/babel": "^0.4.3", + "@import-meta-env/swc": "^0.4.5", + "@import-meta-env/unplugin": "^0.4.8 || ^0.5.0", + "dotenv": "^11.0.0 || ^12.0.4 || ^13.0.1 || ^14.3.2 || ^15.0.1 || ^16.0.0" + }, + "peerDependenciesMeta": { + "@import-meta-env/babel": { + "optional": true + }, + "@import-meta-env/swc": { + "optional": true + }, + "@import-meta-env/unplugin": { + "optional": true + } + } + }, + "node_modules/@import-meta-env/cli/node_modules/brace-expansion": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", + "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", + "dev": true, + "dependencies": { + "balanced-match": "^1.0.0" + } + }, + "node_modules/@import-meta-env/cli/node_modules/commander": { + "version": "11.1.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-11.1.0.tgz", + "integrity": "sha512-yPVavfyCcRhmorC7rWlkHn15b4wDVgVmBA7kV4QVBsF7kv/9TKJAbAXVTxvTnwP8HHKjRCJDClKbciiYS7p0DQ==", + "dev": true, + "engines": { + "node": ">=16" + } + }, + "node_modules/@import-meta-env/cli/node_modules/glob": { + "version": "10.3.10", + "resolved": "https://registry.npmjs.org/glob/-/glob-10.3.10.tgz", + "integrity": "sha512-fa46+tv1Ak0UPK1TOy/pZrIybNNt4HCv7SDzwyfiOZkvZLEbjsZkJBPtDHVshZjbecAoAGSC20MjLDG/qr679g==", + "dev": true, + "dependencies": { + "foreground-child": "^3.1.0", + "jackspeak": "^2.3.5", + "minimatch": "^9.0.1", + "minipass": "^5.0.0 || ^6.0.2 || ^7.0.0", + "path-scurry": "^1.10.1" + }, + "bin": { + "glob": "dist/esm/bin.mjs" + }, + "engines": { + "node": ">=16 || 14 >=14.17" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/@import-meta-env/cli/node_modules/minimatch": { + "version": "9.0.3", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.3.tgz", + "integrity": "sha512-RHiac9mvaRw0x3AYRgDC1CxAP7HTcNrrECeA8YYJeWnpo+2Q5CegtZjaotWTWxDG3UeGA1coE05iH1mPjT/2mg==", + "dev": true, + "dependencies": { + "brace-expansion": "^2.0.1" + }, + "engines": { + "node": ">=16 || 14 >=14.17" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/@import-meta-env/prepare": { + "version": "0.1.13", + "resolved": "https://registry.npmjs.org/@import-meta-env/prepare/-/prepare-0.1.13.tgz", + "integrity": "sha512-N/vu1JHcq4NX63/4d2sDWQaZFENtmoVDJNZwMib1MHiZPrkmuyoYj8sVBa/4wgc8f+lFXnliil4DBbI4w2aHzQ==", + "dev": true, + "dependencies": { + "commander": "11.1.0", + "glob": "10.3.10", + "picocolors": "1.0.0", + "serialize-javascript": "6.0.1" + }, + "bin": { + "import-meta-env-prepare": "bin/import-meta-env-prepare.js" + }, + "engines": { + "node": ">= 14" + }, + "peerDependencies": { + "dotenv": "^11.0.0 || ^12.0.4 || ^13.0.1 || ^14.3.2 || ^15.0.1 || ^16.0.0" + } + }, + "node_modules/@import-meta-env/prepare/node_modules/brace-expansion": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", + "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", + "dev": true, + "dependencies": { + "balanced-match": "^1.0.0" + } + }, + "node_modules/@import-meta-env/prepare/node_modules/commander": { + "version": "11.1.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-11.1.0.tgz", + "integrity": "sha512-yPVavfyCcRhmorC7rWlkHn15b4wDVgVmBA7kV4QVBsF7kv/9TKJAbAXVTxvTnwP8HHKjRCJDClKbciiYS7p0DQ==", + "dev": true, + "engines": { + "node": ">=16" + } + }, + "node_modules/@import-meta-env/prepare/node_modules/glob": { + "version": "10.3.10", + "resolved": "https://registry.npmjs.org/glob/-/glob-10.3.10.tgz", + "integrity": "sha512-fa46+tv1Ak0UPK1TOy/pZrIybNNt4HCv7SDzwyfiOZkvZLEbjsZkJBPtDHVshZjbecAoAGSC20MjLDG/qr679g==", + "dev": true, + "dependencies": { + "foreground-child": "^3.1.0", + "jackspeak": "^2.3.5", + "minimatch": "^9.0.1", + "minipass": "^5.0.0 || ^6.0.2 || ^7.0.0", + "path-scurry": "^1.10.1" + }, + "bin": { + "glob": "dist/esm/bin.mjs" + }, + "engines": { + "node": ">=16 || 14 >=14.17" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/@import-meta-env/prepare/node_modules/minimatch": { + "version": "9.0.3", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.3.tgz", + "integrity": "sha512-RHiac9mvaRw0x3AYRgDC1CxAP7HTcNrrECeA8YYJeWnpo+2Q5CegtZjaotWTWxDG3UeGA1coE05iH1mPjT/2mg==", + "dev": true, + "dependencies": { + "brace-expansion": "^2.0.1" + }, + "engines": { + "node": ">=16 || 14 >=14.17" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/@import-meta-env/unplugin": { + "version": "0.5.1", + "resolved": "https://registry.npmjs.org/@import-meta-env/unplugin/-/unplugin-0.5.1.tgz", + "integrity": "sha512-2pn+eYha02TY+iJ8WAlGr9SnOx0o+OvddO6lzU9hBxkogWlU9Q1dI/9thacnjL9alOA3R2qGZPd79kaiYtw81A==", + "dev": true, + "hasInstallScript": true, + "dependencies": { + "magic-string": "^0.30.0", + "object-hash": "^3.0.0", + "picocolors": "^1.0.0", + "unplugin": "^1.5.0" + }, + "engines": { + "node": ">= 14" + }, + "peerDependencies": { + "@import-meta-env/cli": "^0.5.1 || ^0.6.0", + "dotenv": "^11.0.0 || ^12.0.4 || ^13.0.1 || ^14.3.2 || ^15.0.1 || ^16.0.0" + }, + "peerDependenciesMeta": { + "@import-meta-env/cli": { + "optional": true + } + } + }, + "node_modules/@isaacs/cliui": { + "version": "8.0.2", + "resolved": "https://registry.npmjs.org/@isaacs/cliui/-/cliui-8.0.2.tgz", + "integrity": "sha512-O8jcjabXaleOG9DQ0+ARXWZBTfnP4WNAqzuiJK7ll44AmxGKv/J2M4TPjxjY3znBCfvBXFzucm1twdyFybFqEA==", + "dev": true, + "dependencies": { + "string-width": "^5.1.2", + "string-width-cjs": "npm:string-width@^4.2.0", + "strip-ansi": "^7.0.1", + "strip-ansi-cjs": "npm:strip-ansi@^6.0.1", + "wrap-ansi": "^8.1.0", + "wrap-ansi-cjs": "npm:wrap-ansi@^7.0.0" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/@isaacs/cliui/node_modules/ansi-regex": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.0.1.tgz", + "integrity": "sha512-n5M855fKb2SsfMIiFFoVrABHJC8QtHwVx+mHWP3QcEqBHYienj5dHSgjbxtC0WEZXYt4wcD6zrQElDPhFuZgfA==", + "dev": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/ansi-regex?sponsor=1" + } + }, + "node_modules/@isaacs/cliui/node_modules/ansi-styles": { + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-6.2.1.tgz", + "integrity": "sha512-bN798gFfQX+viw3R7yrGWRqnrN2oRkEkUjjl4JNn4E8GxxbjtG3FbrEIIY3l8/hrwUwIeCZvi4QuOTP4MErVug==", + "dev": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/@isaacs/cliui/node_modules/string-width": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-5.1.2.tgz", + "integrity": "sha512-HnLOCR3vjcY8beoNLtcjZ5/nxn2afmME6lhrDrebokqMap+XbeW8n9TXpPDOqdGK5qcI3oT0GKTW6wC7EMiVqA==", + "dev": true, + "dependencies": { + "eastasianwidth": "^0.2.0", + "emoji-regex": "^9.2.2", + "strip-ansi": "^7.0.1" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/@isaacs/cliui/node_modules/strip-ansi": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.1.0.tgz", + "integrity": "sha512-iq6eVVI64nQQTRYq2KtEg2d2uU7LElhTJwsH4YzIHZshxlgZms/wIc4VoDQTlG/IvVIrBKG06CrZnp0qv7hkcQ==", + "dev": true, + "dependencies": { + "ansi-regex": "^6.0.1" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/strip-ansi?sponsor=1" + } + }, + "node_modules/@isaacs/cliui/node_modules/wrap-ansi": { + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-8.1.0.tgz", + "integrity": "sha512-si7QWI6zUMq56bESFvagtmzMdGOtoxfR+Sez11Mobfc7tm+VkUckk9bW2UeffTGVUbOksxmSw0AA2gs8g71NCQ==", + "dev": true, + "dependencies": { + "ansi-styles": "^6.1.0", + "string-width": "^5.0.1", + "strip-ansi": "^7.0.1" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/wrap-ansi?sponsor=1" + } + }, "node_modules/@istanbuljs/load-nyc-config": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/@istanbuljs/load-nyc-config/-/load-nyc-config-1.1.0.tgz", @@ -3289,6 +3575,16 @@ "dev": true, "license": "MIT" }, + "node_modules/@pkgjs/parseargs": { + "version": "0.11.0", + "resolved": "https://registry.npmjs.org/@pkgjs/parseargs/-/parseargs-0.11.0.tgz", + "integrity": "sha512-+1VkjdD0QBLPodGrJUeqarH8VAIvQODIbwh9XpP5Syisf7YoQgsJKPNFoqqLQlu+VQ/tVSshMR6loPMn8U+dPg==", + "dev": true, + "optional": true, + "engines": { + "node": ">=14" + } + }, "node_modules/@remix-run/router": { "version": "1.15.1", "resolved": "https://registry.npmjs.org/@remix-run/router/-/router-1.15.1.tgz", @@ -4562,6 +4858,17 @@ "dev": true, "license": "ISC" }, + "node_modules/@unleash/proxy-client-react": { + "version": "4.2.2", + "resolved": "https://registry.npmjs.org/@unleash/proxy-client-react/-/proxy-client-react-4.2.2.tgz", + "integrity": "sha512-KRg1dAQfxLSBe8O2i6GIGDM+7HUdUu/ntREy+JeYbmJ2b6ApFtLX/wt+3T/CjrTYjwRlZKZYJDx5E4fRDOQqpQ==", + "engines": { + "node": ">=16.0.0" + }, + "peerDependencies": { + "unleash-proxy-client": "^3.2.0" + } + }, "node_modules/@vitejs/plugin-react": { "version": "4.2.1", "dev": true, @@ -5792,15 +6099,10 @@ } }, "node_modules/chokidar": { - "version": "3.5.3", + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.6.0.tgz", + "integrity": "sha512-7VT13fmjotKpGipCW9JEQAusEPE+Ei8nl6/g4FBAmIm0GOOLMua9NDDo/DWp0ZAxCr3cPq5ZpBqmPAQgDda2Pw==", "dev": true, - "funding": [ - { - "type": "individual", - "url": "https://paulmillr.com/funding/" - } - ], - "license": "MIT", "dependencies": { "anymatch": "~3.1.2", "braces": "~3.0.2", @@ -5813,6 +6115,9 @@ "engines": { "node": ">= 8.10.0" }, + "funding": { + "url": "https://paulmillr.com/funding/" + }, "optionalDependencies": { "fsevents": "~2.3.2" } @@ -6790,6 +7095,25 @@ "tslib": "^2.0.3" } }, + "node_modules/dotenv": { + "version": "16.4.5", + "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.4.5.tgz", + "integrity": "sha512-ZmdL2rui+eB2YwhsWzjInR8LldtZHGDoQ1ugH85ppHKwpUHL7j7rN0Ti9NCnGiQbhaZ11FpR+7ao1dNsmduNUg==", + "dev": true, + "peer": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://dotenvx.com" + } + }, + "node_modules/eastasianwidth": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/eastasianwidth/-/eastasianwidth-0.2.0.tgz", + "integrity": "sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA==", + "dev": true + }, "node_modules/ecc-jsbn": { "version": "0.1.2", "resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz", @@ -8063,6 +8387,34 @@ "is-callable": "^1.1.3" } }, + "node_modules/foreground-child": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/foreground-child/-/foreground-child-3.1.1.tgz", + "integrity": "sha512-TMKDUnIte6bfb5nWv7V/caI169OHgvwjb7V4WkeUvbQQdjr5rWKqHFiKWb/fcOwB+CzBT+qbWjvj+DVwRskpIg==", + "dev": true, + "dependencies": { + "cross-spawn": "^7.0.0", + "signal-exit": "^4.0.1" + }, + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/foreground-child/node_modules/signal-exit": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-4.1.0.tgz", + "integrity": "sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw==", + "dev": true, + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, "node_modules/forever-agent": { "version": "0.6.1", "resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz", @@ -9331,6 +9683,24 @@ "set-function-name": "^2.0.1" } }, + "node_modules/jackspeak": { + "version": "2.3.6", + "resolved": "https://registry.npmjs.org/jackspeak/-/jackspeak-2.3.6.tgz", + "integrity": "sha512-N3yCS/NegsOBokc8GAdM8UcmfsKiSS8cipheD/nivzr700H+nsMOxJjQnvwOcRYVuFkdH0wGUvW2WbXGmrZGbQ==", + "dev": true, + "dependencies": { + "@isaacs/cliui": "^8.0.2" + }, + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + }, + "optionalDependencies": { + "@pkgjs/parseargs": "^0.11.0" + } + }, "node_modules/jest": { "version": "29.7.0", "resolved": "https://registry.npmjs.org/jest/-/jest-29.7.0.tgz", @@ -12270,6 +12640,15 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/minipass": { + "version": "7.0.4", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-7.0.4.tgz", + "integrity": "sha512-jYofLM5Dam9279rdkWzqHozUo4ybjdZmCsDHePy5V/PbBcVMiSZR97gmAy45aqi8CK1lG2ECd356FU86avfwUQ==", + "dev": true, + "engines": { + "node": ">=16 || 14 >=14.17" + } + }, "node_modules/mlly": { "version": "1.5.0", "dev": true, @@ -12490,6 +12869,15 @@ "node": ">=0.10.0" } }, + "node_modules/object-hash": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/object-hash/-/object-hash-3.0.0.tgz", + "integrity": "sha512-RSn9F68PjH9HqtltsSnqYC1XXoWe9Bju5+213R98cNGttag9q9yAOTzdbsqvIa7aNm5WffBZFpWYr2aWrklWAw==", + "dev": true, + "engines": { + "node": ">= 6" + } + }, "node_modules/object-inspect": { "version": "1.13.1", "license": "MIT", @@ -12885,6 +13273,31 @@ "dev": true, "license": "MIT" }, + "node_modules/path-scurry": { + "version": "1.10.1", + "resolved": "https://registry.npmjs.org/path-scurry/-/path-scurry-1.10.1.tgz", + "integrity": "sha512-MkhCqzzBEpPvxxQ71Md0b1Kk51W01lrYvlMzSUaIzNsODdd7mqhiimSZlr+VegAz5Z6Vzt9Xg2ttE//XBhH3EQ==", + "dev": true, + "dependencies": { + "lru-cache": "^9.1.1 || ^10.0.0", + "minipass": "^5.0.0 || ^6.0.2 || ^7.0.0" + }, + "engines": { + "node": ">=16 || 14 >=14.17" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/path-scurry/node_modules/lru-cache": { + "version": "10.2.0", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-10.2.0.tgz", + "integrity": "sha512-2bIM8x+VAf6JT4bKAljS1qUWgMsqZRPGJS6FSahIMPVvctcNhyVp7AJu7quxOW9jwkryBReKZY5tY5JYv2n/7Q==", + "dev": true, + "engines": { + "node": "14 || >=16.14" + } + }, "node_modules/path-to-regexp": { "version": "6.2.1", "dev": true, @@ -13229,6 +13642,15 @@ ], "license": "MIT" }, + "node_modules/randombytes": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz", + "integrity": "sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ==", + "dev": true, + "dependencies": { + "safe-buffer": "^5.1.0" + } + }, "node_modules/react": { "version": "18.2.0", "license": "MIT", @@ -13793,6 +14215,15 @@ "semver": "bin/semver.js" } }, + "node_modules/serialize-javascript": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-6.0.1.tgz", + "integrity": "sha512-owoXEFjWRllis8/M1Q+Cw5k8ZH40e3zhp/ovX+Xr/vi1qj6QesbyXXViFbpNvWvPNAD62SutwEXavefrLJWj7w==", + "dev": true, + "dependencies": { + "randombytes": "^2.1.0" + } + }, "node_modules/set-function-length": { "version": "1.2.0", "license": "MIT", @@ -14118,6 +14549,27 @@ "node": ">=8" } }, + "node_modules/string-width-cjs": { + "name": "string-width", + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "dev": true, + "dependencies": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/string-width-cjs/node_modules/emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", + "dev": true + }, "node_modules/string-width/node_modules/emoji-regex": { "version": "8.0.0", "license": "MIT" @@ -14193,6 +14645,19 @@ "node": ">=8" } }, + "node_modules/strip-ansi-cjs": { + "name": "strip-ansi", + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "dev": true, + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/strip-bom": { "version": "3.0.0", "dev": true, @@ -14342,6 +14807,11 @@ "version": "2.3.8", "license": "MIT" }, + "node_modules/tiny-emitter": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/tiny-emitter/-/tiny-emitter-2.1.0.tgz", + "integrity": "sha512-NB6Dk1A9xgQPMoGqC5CVXn123gWyte215ONT5Pp5a0yt4nlEoO1ZWeCwpncaekPHXO60i47ihFnZPiRPjRMq4Q==" + }, "node_modules/tiny-warning": { "version": "1.0.3", "license": "MIT" @@ -14689,6 +15159,30 @@ "node": ">= 4.0.0" } }, + "node_modules/unleash-proxy-client": { + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/unleash-proxy-client/-/unleash-proxy-client-3.3.1.tgz", + "integrity": "sha512-tekoTRWBK+B0uG9o/5CJ+LAKNZv+OdLPFVXFESQU2JHnyjtedLyTAmdWhPIxC/eCKiBBay1/2BEWOUCJaL1vzQ==", + "dependencies": { + "tiny-emitter": "^2.1.0", + "uuid": "^9.0.1" + } + }, + "node_modules/unplugin": { + "version": "1.9.0", + "resolved": "https://registry.npmjs.org/unplugin/-/unplugin-1.9.0.tgz", + "integrity": "sha512-14PslvMY3gNbXnQtNIRB566Q057L5Fe7f5LDEamxVi0QQVxoz5hrveBwwZLcKyHtZ09ysmipxRRj5Lv+BGz2Iw==", + "dev": true, + "dependencies": { + "acorn": "^8.11.3", + "chokidar": "^3.6.0", + "webpack-sources": "^3.2.3", + "webpack-virtual-modules": "^0.6.1" + }, + "engines": { + "node": ">=14.0.0" + } + }, "node_modules/untildify": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/untildify/-/untildify-4.0.0.tgz", @@ -15322,6 +15816,21 @@ "node": ">=12" } }, + "node_modules/webpack-sources": { + "version": "3.2.3", + "resolved": "https://registry.npmjs.org/webpack-sources/-/webpack-sources-3.2.3.tgz", + "integrity": "sha512-/DyMEOrDgLKKIG0fmvtz+4dUX/3Ghozwgm6iPp8KRhvn+eQf9+Q7GWxVNMk3+uCPWfdXYC4ExGBckIXdFEfH1w==", + "dev": true, + "engines": { + "node": ">=10.13.0" + } + }, + "node_modules/webpack-virtual-modules": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/webpack-virtual-modules/-/webpack-virtual-modules-0.6.1.tgz", + "integrity": "sha512-poXpCylU7ExuvZK8z+On3kX+S8o/2dQ/SVYueKA0D4WEMXROXgY8Ez50/bQEUmvoSMMrWcrJqCHuhAbsiwg7Dg==", + "dev": true + }, "node_modules/whatwg-encoding": { "version": "2.0.0", "dev": true, @@ -15465,6 +15974,57 @@ "node": ">=8" } }, + "node_modules/wrap-ansi-cjs": { + "name": "wrap-ansi", + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", + "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", + "dev": true, + "dependencies": { + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/wrap-ansi?sponsor=1" + } + }, + "node_modules/wrap-ansi-cjs/node_modules/ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/wrap-ansi-cjs/node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/wrap-ansi-cjs/node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, "node_modules/wrap-ansi/node_modules/ansi-styles": { "version": "4.3.0", "license": "MIT", diff --git a/frontend/package.json b/frontend/package.json index f4d73c5bd..799bad559 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -7,8 +7,9 @@ "node": ">=20.0.0" }, "scripts": { - "dev": "vite", - "build": "vite build", + "env-prepare": "import-meta-env-prepare -x ./.env.local.defaults", + "dev": "npm run env-prepare && vite", + "build": "npm run env-prepare && vite build && import-meta-env -x .env.example -p dist/index.html", "build:with-sourcemaps": "vite build --sourcemap", "tsc": "tsc", "lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 10000", @@ -22,6 +23,7 @@ "@mtes-mct/monitor-ui": "^13.7.2", "@sentry/integrations": "^7.101.1", "@sentry/react": "^7.100.1", + "@unleash/proxy-client-react": "^4.2.2", "apollo3-cache-persist": "^0.14.1", "date-fns": "^2.30.0", "email-validator": "^2.0.4", @@ -35,10 +37,14 @@ "rsuite": "^5.53.2", "styled-components": "^5.3.11", "type-fest": "^4.10.2", + "unleash-proxy-client": "^3.3.1", "uuid": "^9.0.1", "web-vitals": "^2.1.4" }, "devDependencies": { + "@import-meta-env/cli": "^0.6.8", + "@import-meta-env/prepare": "0.1.13", + "@import-meta-env/unplugin": "^0.5.1", "@testing-library/jest-dom": "^5.16.5", "@testing-library/react": "^14.0.0", "@testing-library/user-event": "^14.4.3", diff --git a/frontend/src/apollo-client.ts b/frontend/src/apollo-client.ts index 09bdf00e3..e46db3ea3 100644 --- a/frontend/src/apollo-client.ts +++ b/frontend/src/apollo-client.ts @@ -7,8 +7,7 @@ import { ErrorResponse, onError } from "@apollo/client/link/error"; const authToken = new AuthToken() -if (true) { - // if (__DEV__) { +if (import.meta.env.DEV) { // Adds messages only in a dev environment loadDevMessages() loadErrorMessages() @@ -32,7 +31,7 @@ const authLink = setContext((_, {headers}) => { } }) -const errorLink = onError(({graphQLErrors, networkError, operation, forward}: ErrorResponse) => { +const errorLink = onError(({operation, forward}: ErrorResponse) => { const {response} = operation.getContext() if ([401, 403].indexOf(response.status) !== -1) { diff --git a/frontend/src/app.tsx b/frontend/src/app.tsx index 4be53fdc9..8bbf7b796 100644 --- a/frontend/src/app.tsx +++ b/frontend/src/app.tsx @@ -8,46 +8,59 @@ import RouterProvider from './router/router-provider' import * as Sentry from "@sentry/react"; import ErrorPage from "./error-page.tsx"; import { Notifier } from "@mtes-mct/monitor-ui"; +import { FlagProvider } from '@unleash/proxy-client-react'; +import { IConfig } from "unleash-proxy-client"; + + +const config: IConfig = { + url: 'http://localhost:3000/proxy', // Your front-end API URL or the Unleash proxy's URL (https:///proxy) + clientKey: 'randomkey', // A client-side API token OR one of your proxy's designated client keys (previously known as proxy secrets) + refreshInterval: 60, // How often (in seconds) the client should poll the proxy for updates + appName: 'rapportnav2-flags', // The name of your application. It's only used for identifying your application + environment: 'local', +}; const App: FC = () => { - const [loading, setLoading] = useState(true) - const [client, setClient] = useState>(apolloClient) - - useEffect(() => { - async function init() { - const cache = apolloCache - let newPersistor = new CachePersistor({ - cache, - storage: new LocalStorageWrapper(window.localStorage), - debug: true - // trigger: 'write' - }) - - await newPersistor.restore() - // setPersistor(newPersistor); - setClient(apolloClient) - - setLoading(false) // Set loading to false after cache is restored + const [loading, setLoading] = useState(true) + const [client, setClient] = useState>(apolloClient) + + useEffect(() => { + async function init() { + const cache = apolloCache + let newPersistor = new CachePersistor({ + cache, + storage: new LocalStorageWrapper(window.localStorage), + debug: true + // trigger: 'write' + }) + + await newPersistor.restore() + // setPersistor(newPersistor); + setClient(apolloClient) + + setLoading(false) // Set loading to false after cache is restored + } + + init().catch(console.error) + }, []) + + if (loading) { + // Render a loading indicator or anything you like + return
Chargement...
} - init().catch(console.error) - }, []) - - if (loading) { - // Render a loading indicator or anything you like - return
Chargement...
- } - - return ( - - - - - - - - - ) + return ( + + + + + + + + + + + ) } export default Sentry.withProfiler(App); diff --git a/frontend/src/index.tsx b/frontend/src/index.tsx index c75aa813e..38430a3a3 100644 --- a/frontend/src/index.tsx +++ b/frontend/src/index.tsx @@ -2,45 +2,21 @@ import React from 'react' import ReactDOM from 'react-dom/client' // import reportWebVitals from './report-web-vitals' import App from './app' -import * as Sentry from '@sentry/react' -import { createRoutesFromChildren, matchRoutes, useLocation, useNavigationType } from 'react-router-dom' -import { HttpClient, CaptureConsole, Debug } from "@sentry/integrations"; +import initSentry from "./sentry.ts"; import 'react-toastify/dist/ReactToastify.css' import 'rsuite/dist/rsuite.min.css' import './assets/css/index.css' import '@mtes-mct/monitor-ui/assets/stylesheets/rsuite-override.css' -Sentry.init({ - dsn: 'https://8857258f9f1549968b13e15759bdf2bc@sentry.incubateur.net/121', - integrations: [ - new Sentry.BrowserTracing({ - // See docs for support of different versions of variation of react router - // https://docs.sentry.io/platforms/javascript/guides/react/configuration/integrations/react-router/ - routingInstrumentation: Sentry.reactRouterV6Instrumentation( - React.useEffect, - useLocation, - useNavigationType, - createRoutesFromChildren, - matchRoutes - ) - }), - new Sentry.Replay(), - new HttpClient(), - new Debug(), - new CaptureConsole(), - ], - replaysOnErrorSampleRate: 1.0, - replaysSessionSampleRate: 0.1, - tracesSampleRate: 1.0 -}) +// setup sentry before starting +initSentry() const root = ReactDOM.createRoot(document.getElementById('root') as HTMLElement) - root.render( - - - + + + ) // If you want to start measuring performance in your app, pass a function diff --git a/frontend/src/pam/mission/mission-page.test.tsx b/frontend/src/pam/mission/mission-page.test.tsx index a96162ede..6efd4b03f 100644 --- a/frontend/src/pam/mission/mission-page.test.tsx +++ b/frontend/src/pam/mission/mission-page.test.tsx @@ -6,6 +6,15 @@ import useMissionExcerpt from "./general-info/use-mission-excerpt"; import { GraphQLError } from "graphql/error"; import { useNavigate } from "react-router-dom"; +vi.mock("@unleash/proxy-client-react", async (importOriginal) => { + const actual = await importOriginal() + return { + ...actual, + useFlag: vi.fn(), + default: vi.fn() + } +}) + // Mock the useApolloClient hook const mockApolloClient = { resetStore: vi.fn(), diff --git a/frontend/src/pam/mission/page-header.tsx b/frontend/src/pam/mission/page-header.tsx index ad8b5a10e..a507622e4 100644 --- a/frontend/src/pam/mission/page-header.tsx +++ b/frontend/src/pam/mission/page-header.tsx @@ -6,6 +6,7 @@ import Text from '../../ui/text' import { MissionSourceEnum } from "../../types/env-mission-types.ts"; import MissionOpenByTag from "../missions/mission-open-by-tag.tsx"; import GearIcon from '@rsuite/icons/Gear'; +import { useFlag } from "@unleash/proxy-client-react"; const StyledHeader = styled.div` @@ -31,6 +32,9 @@ const MissionPageHeader: React.FC = ({ onClickExport, exportLoading }) => { + + const exportRapportEnabled = useFlag('export_rapport'); + return ( @@ -64,14 +68,14 @@ const MissionPageHeader: React.FC = ({ } accent={Accent.PRIMARY} size={Size.NORMAL} - // color={THEME.color.gainsboro} onClick={onClickExport} role={'dl-mission-export'} - style={{display: "none"}} + style={{display: !!exportRapportEnabled ? "visible" : "none"}} > Exporter le rapport de la mission + { - const actual = await importOriginal() - return { - ...actual, - default: vi.fn() - } + const actual = await importOriginal() + return { + ...actual, + default: vi.fn() + } }) const mission = { - id: '123', - agent: { - id: 'abc', - firstName: 'firstName', - lastName: 'lastName', - services: [] - }, - comment: undefined, - role: undefined + id: '123', + agent: { + id: 'abc', + firstName: 'firstName', + lastName: 'lastName', + services: [] + }, + comment: undefined, + role: undefined } const mockedQueryResult = (crew?: Mission[], loading: boolean = false, error: any = undefined) => ({ - data: crew, - loading, - error, + data: crew, + loading, + error, }) describe('Missions', () => { - describe('Testing rendering', () => { - test('should render loading', () => { - ;(useMissions as any).mockReturnValue(mockedQueryResult(undefined, true)) - render(); - expect(screen.getByText('Missions en cours de chargement')).toBeInTheDocument(); - }); - - test('should render error', () => { - ;(useMissions as any).mockReturnValue(mockedQueryResult(undefined, false, new GraphQLError("Error!"))) - render(); - expect(screen.getByText('Erreur: Error!')).toBeInTheDocument(); - }); - - test('should render content', () => { - ;(useMissions as any).mockReturnValue(mockedQueryResult([mission])) - render(); - expect(screen.getByText('Mes rapports de mission')).toBeInTheDocument(); - }); + describe('Testing rendering', () => { + test('should render loading', () => { + ;(useMissions as any).mockReturnValue(mockedQueryResult(undefined, true)) + render(); + expect(screen.getByText('Missions en cours de chargement')).toBeInTheDocument(); + }); + + test('should render error', () => { + ;(useMissions as any).mockReturnValue(mockedQueryResult(undefined, false, new GraphQLError("Error!"))) + render(); + expect(screen.getByText('Erreur: Error!')).toBeInTheDocument(); + }); + + test('should render content', () => { + ;(useMissions as any).mockReturnValue(mockedQueryResult([mission])) + render(); + expect(screen.getByText('Mes rapports de mission')).toBeInTheDocument(); }); + }); }); diff --git a/frontend/src/pam/missions/missions.tsx b/frontend/src/pam/missions/missions.tsx index a203ae98e..3393b0a1e 100644 --- a/frontend/src/pam/missions/missions.tsx +++ b/frontend/src/pam/missions/missions.tsx @@ -9,85 +9,85 @@ import { GET_MISSION_BY_ID } from "../mission/use-mission-by-id.tsx"; const Missions: React.FC = () => { - const {loading, data: missions, error, client} = useMissions() + const {loading, data: missions, error, client} = useMissions() - const prefetchMission = async (missionId: string) => { - await client.query({ - query: GET_MISSION_BY_ID, - variables: {missionId} - }) - } + const prefetchMission = async (missionId: string) => { + await client.query({ + query: GET_MISSION_BY_ID, + variables: {missionId} + }) + } - if (loading) { - return ( - Missions en cours de chargement}/> - ) - } + if (loading) { + return ( + Missions en cours de chargement}/> + ) + } - if (error) { - return ( - - - - - Une erreur s'est produite lors du chargement de vos missions. Si le problème - persiste, - veuillez contacter l'équipe RapportNav. - - - Erreur: {error?.message} - - - - - ) - } + if (error) { + return ( + + + + + Une erreur s'est produite lors du chargement de vos missions. Si le problème + persiste, + veuillez contacter l'équipe RapportNav. + + + Erreur: {error?.message} + + + + + ) + } - if (missions) { - return ( - - - - -

Missions

-
+ if (missions) { + return ( + + + + +

Missions

+
- -

Mes rapports de mission

-
+ +

Mes rapports de mission

+
- - - - - + + + + + - - {loading ? ( - - - - - - ) : ( - - )} - -
-
-
- ) - } + + {loading ? ( + + + + + + ) : ( + + )} + +
+
+
+ ) + } - return null + return null } export default Missions diff --git a/frontend/src/sentry.ts b/frontend/src/sentry.ts new file mode 100644 index 000000000..e9cbcd72f --- /dev/null +++ b/frontend/src/sentry.ts @@ -0,0 +1,39 @@ +import { useEffect } from "react"; +import { init, reactRouterV6BrowserTracingIntegration, replayIntegration } from "@sentry/react"; +import { createRoutesFromChildren, matchRoutes, useLocation, useNavigationType } from "react-router-dom"; +import { captureConsoleIntegration, debugIntegration, httpClientIntegration } from "@sentry/integrations"; +import packageJson from '../package.json'; + +const version = packageJson.version; + +const initSentry = () => { + const FRONTEND_SENTRY_DSN = import.meta.env.FRONTEND_SENTRY_DSN + const viteMode = import.meta.env.MODE + const isDev = import.meta.env.DEV + const release = version + + init({ + dsn: FRONTEND_SENTRY_DSN, + environment: viteMode, + enabled: !isDev, + release: release, + integrations: [ + reactRouterV6BrowserTracingIntegration({ + useEffect: useEffect, + useLocation, + useNavigationType, + createRoutesFromChildren, + matchRoutes, + }), + replayIntegration(), + httpClientIntegration(), + debugIntegration(), + captureConsoleIntegration(), + ], + replaysOnErrorSampleRate: 1.0, + replaysSessionSampleRate: 0.1, + tracesSampleRate: 1.0 + }) +} + +export default initSentry diff --git a/frontend/vite.config.ts b/frontend/vite.config.ts index 117f4d3c7..cf67844a3 100644 --- a/frontend/vite.config.ts +++ b/frontend/vite.config.ts @@ -1,42 +1,43 @@ import { defineConfig } from 'vite' import react from '@vitejs/plugin-react' import eslint from 'vite-plugin-eslint'; -import dotenv from 'dotenv'; - -// if (process.env.NODE_ENV === 'development') { -// dotenv.config(); -// } +import importMetaEnv from '@import-meta-env/unplugin' // https://vitejs.dev/config/ export default defineConfig({ - define: { - // https://www.apollographql.com/docs/react/development-testing/reducing-bundle-size - "globalThis.__DEV__": JSON.stringify(false), - }, - build: { - rollupOptions: { - output: { - format: 'es', - manualChunks(id) { - // Separate third-party dependencies into a common chunk - if (id.includes('node_modules')) { - return 'vendor'; - } - if (id.includes('src/pam')) { - return 'pam'; - } - }, - }, + define: { + // https://www.apollographql.com/docs/react/development-testing/reducing-bundle-size + "globalThis.__DEV__": JSON.stringify(false), + }, + build: { + rollupOptions: { + output: { + format: 'es', + manualChunks(id) { + // Separate third-party dependencies into a common chunk + if (id.includes('node_modules')) { + return 'vendor'; + } + if (id.includes('src/pam')) { + return 'pam'; + } }, + }, }, - plugins: [ - react(), - eslint(), - ], - server: { - proxy: { - '/api': 'http://localhost:80', - '/graphql': 'http://localhost:80' - } + }, + plugins: [ + react(), + eslint(), + importMetaEnv.vite({ + env: './.env', + example: './.env.example' + }) + ], + server: { + host: true, + proxy: { + '/api': 'http://backend:80', + '/graphql': 'http://backend:80' } + } }) diff --git a/infra/configurations/backend/application-dev.properties b/infra/configurations/backend/application-dev.properties deleted file mode 100644 index 7dcb29097..000000000 --- a/infra/configurations/backend/application-dev.properties +++ /dev/null @@ -1,10 +0,0 @@ -env.db.url=jdbc:postgresql://localhost:5432/rapportnavdb?user=postgres&password=postgres -spring.datasource.url=jdbc:postgresql://localhost:5432/rapportnavdb?user=postgres&password=postgres -host.ip=localhost:80 -spring.graphql.graphiql.enabled=true -spring.graphql.graphiql.path=/graphiql -sentry.enabled=true -sentry.dsn=https://8857258f9f1549968b13e15759bdf2bc@sentry.incubateur.net/121 -#sentry.exception-resolver-order=-2147483647 -sentry.traces-sample-rate=1.0 -sentry.environment=integration diff --git a/infra/configurations/backend/application-local.properties b/infra/configurations/backend/application-local.properties index 900d13560..0ce9580a0 100644 --- a/infra/configurations/backend/application-local.properties +++ b/infra/configurations/backend/application-local.properties @@ -1,8 +1,25 @@ -env.db.url=jdbc:postgresql://localhost:5432/rapportnavdb?user=postgres&password=postgres +################ +################ +# Spring spring.datasource.url=jdbc:postgresql://localhost:5432/rapportnavdb?user=postgres&password=postgres -host.ip=localhost:8880 +################ +################ +# Logging +logging.level.org.springframework.web=DEBUG +logging.level.org.springframework.security=DEBUG +# hot reload: +spring.devtools.livereload.enabled=true +################ +################ +# DSI proxy +host.proxy.host= +host.proxy.port= +################ +################ #Sentry sentry.enabled=false -sentry.dsn= -sentry.traces-sample-rate=1.0 -sentry.environment=localhost +sentry.dsn=https://8857258f9f1549968b13e15759bdf2bc@sentry.incubateur.net/121 +sentry.traces-sample-rate=0.0 +sentry.environment=local + + diff --git a/infra/configurations/backend/application-prod.properties b/infra/configurations/backend/application-prod.properties index 81e1a7018..b7fa627d9 100644 --- a/infra/configurations/backend/application-prod.properties +++ b/infra/configurations/backend/application-prod.properties @@ -1,11 +1,23 @@ -env.db.url=jdbc:postgresql://db:5432/rapportnavdb?user=postgres&password=postgres +################ +################ +# Spring spring.datasource.url=jdbc:postgresql://db:5432/rapportnavdb?user=postgres&password=postgres -host.ip=localhost:8880 +# hot reload +spring.devtools.livereload.enabled=false +################ +################ +# Logging +logging.level.org.springframework.web=DEBUG +logging.level.org.springframework.security=DEBUG +################ +################ +# DSI proxy +host.proxy.host=172.27.229.197 +host.proxy.port=8090 +################ +################ #Sentry sentry.enabled=true sentry.dsn=https://8857258f9f1549968b13e15759bdf2bc@sentry.incubateur.net/121 -sentry.proxy.host=172.27.229.197 -sentry.proxy.port=8090 -#sentry.exception-resolver-order=-2147483647 sentry.traces-sample-rate=1.0 -sentry.environment=production \ No newline at end of file +sentry.environment=production diff --git a/infra/docker-compose.dev.yml b/infra/docker-compose.dev.yml deleted file mode 100644 index 88c045486..000000000 --- a/infra/docker-compose.dev.yml +++ /dev/null @@ -1,63 +0,0 @@ -version: "3" -services: - db: - image: postgres:15.6-alpine - ports: - - "5432:5432" - environment: - POSTGRES_DB: rapportnavdb - POSTGRES_USER: postgres - POSTGRES_PASSWORD: postgres - volumes: - - db_data:/var/lib/postgresql/data - healthcheck: - test: [ "CMD-SHELL", "pg_isready -U postgres" ] - interval: 1s - timeout: 1s - retries: 30 - - backend: - build: - context: .. - dockerfile: ./infra/docker/app/DockerfileDev.old - target: run-backend - ports: - - 80:80 - - 8880:8880 - volumes: - - ./backend:/tmp/backend - depends_on: - - db - - metabase - - frontend: - build: - context: .. - dockerfile: ./infra/docker/app/DockerfileDev.old - target: run-frontend - ports: - - 5173:5173 - # - 3000:3000 - volumes: - - ./frontend:/tmp/frontend - - metabase: - image: metabase/metabase:latest - ports: - - 3000:3000 - volumes: - - metabase_data:/metabase-data - environment: - - MB_DB_CONNECTION_URI=postgres://db:5432/rapportnavdb?currentSchema=metabase - - MB_DB_FILE=/metabase-data/metabase.db - - MB_DB_TYPE=postgres - - MB_DB_USER=postgres - - MB_DB_PASS=postgres - restart: always - depends_on: - - db - -volumes: - db_data: - name: db - metabase_data: diff --git a/infra/docker-compose.local.yml b/infra/docker-compose.local.yml new file mode 100644 index 000000000..a562ded5d --- /dev/null +++ b/infra/docker-compose.local.yml @@ -0,0 +1,88 @@ +version: '3.8' +name: rapportnav2 +services: + backend: + build: + context: .. + dockerfile: ./infra/docker/app/DockerfileLocalBack + ports: + - "80:80" + depends_on: + - db + volumes: + - ../backend:/tmp/backend + - ./infra/configurations/backend:/tmp/backend/configurations + environment: + - VERSION=NO_VERSION + - ENV_PROFILE=local + + frontend: + build: + context: ../frontend + dockerfile: ../infra/docker/app/DockerfileLocalFront + ports: + - "5173:5173" + volumes: + - ../frontend:/tmp/frontend + + db: + image: postgres:15.6-alpine + ports: + - "5432:5432" + environment: + POSTGRES_DB: rapportnavdb + POSTGRES_USER: postgres + POSTGRES_PASSWORD: postgres + volumes: + - db:/var/lib/postgresql/data + + unleash_proxy: + image: unleashorg/unleash-proxy:v1.1.1 + ports: + - "3000:3000" + environment: + # Proxy clients must use one of these keys to connect to the + # Proxy. To add more keys, separate them with a comma (`key1,key2`). + # UNLEASH_PROXY_CLIENT_KEYS: "randomkey" + UNLEASH_PROXY_SECRETS: "randomkey" + UNLEASH_APP_NAME: "local" + # This points the Proxy to the Unleash server API + UNLEASH_URL: "https://gitlab.com/api/v4/feature_flags/unleash/55951570" + UNLEASH_INSTANCE_ID: "glffct-ceHLxPcFMqyXsyGPXSkx" + # This is the API token that the Proxy uses to communicate with + # the Unleash server. + UNLEASH_API_TOKEN: "glpat-6f7PUWe9PwRoa53LUmsZ" + ENABLE_ALL_ENDPOINT: true + LOG_LEVEL: "debug" + # depends_on: + # - web + healthcheck: + test: wget --no-verbose --tries=1 --spider http://localhost:3000/proxy/health || exit 1 + interval: 1s + timeout: 1m + retries: 5 + +# metabase: +# image: metabase/metabase:latest +# ports: +# - "3000:3000" +# volumes: +# - metabase_data:/metabase-data +# environment: +# # - MB_DB_CONNECTION_URI="db:5432/rapportnavdb?user=postgres&password=postgres" +# - MB_DB_CONNECTION_URI=postgres://db:5432/rapportnavdb?currentSchema=metabase +# - MB_DB_FILE=/metabase-data/metabase.db +# - MB_DB_TYPE=postgres +# # - MB_DB_DBNAME=rapportnavdb +# # - MB_DB_PORT=5432 +# - MB_DB_USER=postgres +# - MB_DB_PASS=postgres +# # - MB_DB_HOST=db +# restart: always +# depends_on: +# - db + +volumes: + db: + name: rapportnavdb +# metabase_data: diff --git a/infra/docker-compose.prod.yml b/infra/docker-compose.prod.yml deleted file mode 100644 index 78f251fad..000000000 --- a/infra/docker-compose.prod.yml +++ /dev/null @@ -1,49 +0,0 @@ -services: - app: - image: ghcr.io/mtes-mct/rapportnav2/rapportnav-app:latest - container_name: rapportnav_backend - # user: "rapportnav:${MONITORENV_LOGS_AND_BACKUPS_GID}" - environment: - - ENV_DB_URL=jdbc:postgresql://db:5432/$POSTGRES_DB?user=$POSTGRES_USER&password=$POSTGRES_PASSWORD - - SPRING_PROFILES_ACTIVE=${ENVIRONMENT} - ports: - # - ${BACKEND_HTTP_PORT}:8880 - - 8880:8880 - - 80:80 - - 8000:8000 - volumes: - - "${RAPPORTNAV_LOGS_FOLDER}:/home/rapportnav/logs" - # networks: - # - backend_network - depends_on: - - db - restart: always - logging: - driver: "json-file" - options: - max-size: "1024m" - - db: - image: postgres:15.6-alpine - volumes: - - "${RAPPORTNAV_BACKUPS_FOLDER}:/opt/rapportnav_backups" - - db:/var/lib/postgresql/data - # networks: - # - backend_network - restart: always - ports: - - "5432:5432" - environment: - POSTGRES_DB: rapportnavdb - POSTGRES_USER: postgres - POSTGRES_PASSWORD: postgres - healthcheck: - test: [ "CMD-SHELL", "pg_isready -U postgres" ] - interval: 1s - timeout: 1s - retries: 30 -# networks: -# backend_network: -volumes: - db: - name: rapportnavdb diff --git a/infra/docker-compose.yml b/infra/docker-compose.yml index 2481d967d..e69de29bb 100644 --- a/infra/docker-compose.yml +++ b/infra/docker-compose.yml @@ -1,34 +0,0 @@ -version: "3" -services: - app: - build: - context: . - dockerfile: app/Dockerfile - target: build-all - ports: - - ${BACKEND_HTTP_PORT}:8880 - - 8000:8000 - volumes: - - ./frontend:/tmp/frontend - depends_on: - - db - - db: - image: postgres:15.6-alpine - ports: - - "5432:5432" - environment: - POSTGRES_DB: rapportnavdb - POSTGRES_USER: postgres - POSTGRES_PASSWORD: postgres - volumes: - - db:/var/lib/postgresql/data - healthcheck: - test: [ "CMD-SHELL", "pg_isready -U postgres" ] - interval: 1s - timeout: 1s - retries: 30 - -volumes: - db: - name: rapportnavdb diff --git a/infra/docker/app/Dockerfile b/infra/docker/app/Dockerfile index 6bf0e5ac2..51e56020d 100644 --- a/infra/docker/app/Dockerfile +++ b/infra/docker/app/Dockerfile @@ -1,5 +1,5 @@ -FROM azul/zulu-openjdk-alpine:17.0.7-17.42.19 as build-all +FROM azul/zulu-openjdk-alpine:17.0.7-17.42.19 AS build-all WORKDIR /home/rapportnav @@ -31,6 +31,4 @@ RUN mkdir /home/rapportnav/logs # It must point to the front (React) files ENV STATIC_FILES_PATH=/home/rapportnav/public - -# CMD exec java -jar "/home/rapportnav/rapportnav-${VERSION}.jar" -CMD exec java -Dspring.config.additional-location="/home/rapportnav/configurations/" -Dspring.profiles.active=$ENV_PROFILE -jar "/home/rapportnav/rapportnav-${VERSION}.jar" +CMD exec java -Dspring.config.additional-location="/home/rapportnav/configurations/" -Dspring.profiles.active="$ENV_PROFILE" -jar "/home/rapportnav/rapportnav-${VERSION}.jar" diff --git a/infra/docker/app/DockerfileCI b/infra/docker/app/DockerfileCI index 6d462c40b..602535d98 100644 --- a/infra/docker/app/DockerfileCI +++ b/infra/docker/app/DockerfileCI @@ -1,3 +1,5 @@ +# This file is used in the CI job for Trivy + ##################### # Multi stage build # ##################### @@ -6,23 +8,13 @@ ARG GITHUB_SHA ARG VERSION ######################################## -# Build rapportnav backend with maven # +# Build rapportnav backend with gradle # ######################################## FROM gradle:8.5-jdk17 as build-backend ARG GITHUB_SHA ARG VERSION -#WORKDIR /tmp/backend -#COPY backend/ /tmp/backend -#COPY --from=maven-dependencies /root/.m2 /root/.m2 -#COPY backend/pom.xml /tmp/backend/POM_WITH_ENV_VARS -#RUN sed -e 's/COMMIT_TO_CHANGE/${GITHUB_SHA}/' \ -# -e 's/VERSION_TO_CHANGE/${VERSION}/' \ -# POM_WITH_ENV_VARS > pom.xml -# -#RUN mvn clean package -DskipTests=true - WORKDIR /tmp/ COPY --chown=gradle:gradle backend/ /tmp/ @@ -48,7 +40,7 @@ FROM node:18 AS build-frontend WORKDIR /tmp/frontend COPY --from=npm-dependencies /tmp/frontend/node_modules ./node_modules COPY frontend . -RUN npm run build --verbose +RUN npm run build --verbose --mode production @@ -76,9 +68,7 @@ COPY infra/configurations/backend /home/rapportnav/configurations/ # copy frontend related things RUN mkdir /home/rapportnav/public -# COPY --from=buildSourcemaps /tmp/frontend/build /home/rapportnav/public/ COPY --from=build-frontend /tmp/frontend/dist /home/rapportnav/public/ -# COPY --from=build-frontend /tmp/infra/docker/tmp/env.sh /home/rapportnav/ # Add logs folder to be mounted as volume RUN mkdir /home/rapportnav/logs @@ -87,5 +77,4 @@ RUN mkdir /home/rapportnav/logs # It must point to the front (React) files ENV STATIC_FILES_PATH=/home/rapportnav/public -# CMD exec java -jar "/home/rapportnav/rapportnav-${VERSION}.jar" CMD exec java -Dspring.config.additional-location="/home/rapportnav/configurations/" -Dspring.profiles.active=$ENV_PROFILE -jar "/home/rapportnav/rapportnav-${VERSION}.jar" diff --git a/infra/docker/app/DockerfileDev b/infra/docker/app/DockerfileDev deleted file mode 100644 index da200d699..000000000 --- a/infra/docker/app/DockerfileDev +++ /dev/null @@ -1,86 +0,0 @@ -##################### -# Multi stage build # -##################### - -ARG GITHUB_SHA=NO_COMMIT -ARG VERSION=NO_VERSION - -######################################## -# Build rapportnav backend with maven # -######################################## -FROM maven:3.8.5-openjdk-17-slim as build-backend - -ARG GITHUB_SHA -ARG VERSION - -WORKDIR /tmp/backend -COPY backend/pom.xml pom.xml -RUN mvn dependency:go-offline -B - -COPY backend/ /tmp/backend -COPY backend/pom.xml /tmp/backend/POM_WITH_ENV_VARS -RUN sed -e 's/COMMIT_TO_CHANGE/${GITHUB_SHA}/' \ - -e 's/VERSION_TO_CHANGE/${VERSION}/' \ - POM_WITH_ENV_VARS > pom.xml - -RUN mvn clean package -DskipTests=true - -######################################## -# Run Application # -######################################## -FROM azul/zulu-openjdk-debian:17-latest as run-backend - -WORKDIR /home/rapportnav - -ARG VERSION -ENV VERSION=$VERSION - -ARG ENV_PROFILE -ENV ENV_PROFILE=dev - -ENV SPRING_PROFILES_ACTIVE=$ENV_PROFILE - -# ENV REACT_APP_ENV=$ENV_PROFILE -ENV ENV_DB_URL="" - -# copy backend related things -COPY --from=build-backend /tmp/backend/build/libs/rapportnav-${VERSION}.jar /home/rapportnav -COPY infra/configurations/backend /home/rapportnav/configurations/ - - -# RUN mkdir /home/rapportnav/public -# COPY --from=buildSourcemaps /tmp/frontend/build /home/rapportnav/public/ -# COPY --from=build-frontend /tmp/frontend/dist /home/rapportnav/public/ -# COPY --from=build-frontend /tmp/infra/docker/tmp/env.sh /home/rapportnav/ - -# Add logs folder to be mounted as volume -RUN mkdir /home/rapportnav/logs - -# Set up environement variable that define the root folder use for serving static files -# It must point to the front (React) files -# ENV STATIC_FILES_PATH=/home/rapportnav/public - - -# CMD exec java -jar "/home/rapportnav/rapportnav-${VERSION}.jar" -CMD exec java -Dspring.config.additional-location="/home/rapportnav/configurations/" -Dspring.profiles.active=$ENV_PROFILE -jar "/home/rapportnav/rapportnav-${VERSION}.jar" - - - - -######################################## -# Build frontend # -######################################## -# Stage 1: Build npm dependencies -FROM node:18 AS npm-dependencies -WORKDIR /tmp/frontend -COPY frontend/package.json frontend/package-lock.json ./ -RUN npm install - -# Stage 2: Build the application -FROM node:18 AS run-frontend -WORKDIR /tmp/frontend -COPY --from=npm-dependencies /tmp/frontend/node_modules ./node_modules -COPY frontend . -EXPOSE 5173 -RUN npm run dev --mode dev --host - diff --git a/infra/docker/app/DockerfileLocalBack b/infra/docker/app/DockerfileLocalBack new file mode 100644 index 000000000..3ee876362 --- /dev/null +++ b/infra/docker/app/DockerfileLocalBack @@ -0,0 +1,37 @@ +######################################## +# Dependencies # +######################################## +# Stage 1: Build backend dependencies +FROM openjdk:17-jdk-alpine AS backend-dependencies + +WORKDIR /tmp/backend +# Copy backend Gradle build files +COPY backend/build.gradle.kts backend/settings.gradle.kts backend/gradlew ./ +COPY backend/gradle ./gradle +# Resolve and cache dependencies +RUN ./gradlew --no-daemon dependencies + + +######################################## +# Package and Serve on :80 # +######################################## +FROM backend-dependencies as backend-run + +ARG VERSION +ENV VERSION=$VERSION +ARG ENV_PROFILE +ENV ENV_PROFILE=$ENV_PROFILE + +WORKDIR /tmp/backend + +COPY backend/ . + +# Copy config +COPY infra/configurations/backend ./configurations/ + +# Expose ports +EXPOSE 80 + +# Run the backend application +CMD (./gradlew -t :bootJar) & ./gradlew bootRun -PskipDownload=true --args='--spring.profiles.active=local --spring.config.additional-location=/tmp/backend/configurations/' + diff --git a/infra/docker/app/DockerfileLocalFront b/infra/docker/app/DockerfileLocalFront new file mode 100644 index 000000000..c746ea6bc --- /dev/null +++ b/infra/docker/app/DockerfileLocalFront @@ -0,0 +1,16 @@ + +# Install npm dependencies +FROM node:20 AS frontend-dependencies +WORKDIR /tmp/frontend +COPY package.json package-lock.json ./ +RUN npm install + + +# Run the frontend +FROM node:20 AS frontend-run +WORKDIR /tmp/frontend +COPY . . +COPY --from=frontend-dependencies /tmp/frontend/node_modules ./node_modules +EXPOSE 5173 +CMD npm rebuild esbuild && npm run dev +