From beb79c16e7e42b74f9a99357693e890509d44496 Mon Sep 17 00:00:00 2001 From: "Yassine R." Date: Tue, 24 Sep 2024 16:42:55 +0200 Subject: [PATCH] fix(backend): clean npai --- .talismanrc | 2 +- .../db/dumps/domifa_test.postgres.custom.gz | Bin 101392 -> 101420 bytes .../1727093929792-manual-migration.ts | 1 - .../1727186783887-manual-migration.ts | 35 ++++++++++++++++++ .../1603812391580-pr-env-create-database.ts | 20 +++++++++- packages/frontend/src/assets/files/news.json | 20 ++++++++++ .../usager-login/usager-login.component.html | 2 +- .../usager-login/usager-login.component.ts | 2 +- 8 files changed, 77 insertions(+), 5 deletions(-) create mode 100644 packages/backend/src/_migrations/1727186783887-manual-migration.ts diff --git a/.talismanrc b/.talismanrc index 07a31c7271..6aeb20346d 100644 --- a/.talismanrc +++ b/.talismanrc @@ -46,7 +46,7 @@ fileignoreconfig: - filename: packages/backend/src/_migrations/1727093929792-manual-migration.ts checksum: 3c9e8d54f169d01f7c1d237c196c5b71cc392b3d1bf18b8b2e08237b1b60a43c - filename: packages/backend/src/_migrations/_init-db/1603812391580-pr-env-create-database.ts - checksum: 9c4984cbb8b435b626b2b26fd1cba740542aed18aa568bd03af517651de1aacd + checksum: 2d5ee47c1a8176bc93a443ce3a3a01a1bc2d27d8cfc8f79a2c6ad56e8cd97fc3 - filename: packages/backend/src/modules/portail-usagers/controllers/portail-usagers-manager/portail-usagers-manager.controller.ts checksum: 6cb66d899577621ac9f796b2fde88a68263b7422c3f369854d94236c15c0807f - filename: packages/backend/src/stats/services/publicStats.service.ts diff --git a/_scripts/db/dumps/domifa_test.postgres.custom.gz b/_scripts/db/dumps/domifa_test.postgres.custom.gz index b4730d1bc0aab1cbf90a49b94d00255c8044d490..21425a262770e17e1a0d839c5ed41b61123f9808 100644 GIT binary patch delta 4185 zcmY*bcU%p`8*rH&?5 zaj*M`K++m7r9YAA>jjsD_^WCJ$-wRXx?;@2QbMOH6BG@v(I=f$5t@f9`kzd3h^P8_!g=EyR1#_BV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zhLA6e+T;Y>Ko2BRfnv3Q`5$M`l&hzC%4g2|D+7Cgr>D?2-Y&vochEKtOiPt z5x`l`3UW@pm$KUfcxhfUr5^Wq<7Gt6JJX9Cg8oivTTd=rvIV0I%5}`x84$sV=>M4D@DJ zbDT6;9h}@&$cuGavzU;5%;*RV z)Gv6;1W}Nuo)MKukx*-Pa{fY0r6!jV$5o0jYtpL&aTS=aEN0tfMQ!-XRo9=8XExa_N1 zGjO|6A9y$EH zGhKIf9nH6GOpNPiND1GRnNvOB?xl{OGKYlEH<{qQskeB3gxwXVZ0T>m?+w)Vu={ZI)UM@U@16E; zj2AoMkBE4sGbcdi9dLP$3W1e_%}CHY%sv zpmF8x!Jtf_viyonJ7#@dyzB7u!(|aYPYg-0`}N&J%-kQ&Jzcdt?*5Iti+4|YIEa09 ztaIJ>fA6<{L(Q%AgFpVDy?j|oAb8fz|9V~Ht^MWOna-&pS@V7B$`{O;IjgZj-|pLJ zoAl|jl}Fng+L)-))@}EjrVfp3cyh2HrE%Q6s+|4NtM9Fz)80`rFyDTK_z5Y?B zvntPeq#d#E1NZ)NJ9Ymy-Bsflr{wF+YvtzUbO_4Unt9SNS3+ru9L7TkE}L z@pY|dr{%nKK0WZ@jC~%T#m;_NF+#s5BmZG#0(+-3xjFD@(FUKopyc{d^Mi*4fp{j& zJ2KgYi*iVE&3(MyEjFNM$#nu~GA5Lt)a2>FKZgiKBk)dVTr%pE1rOEU6M)mu{{f_-2rd8s diff --git a/packages/backend/src/_migrations/1727093929792-manual-migration.ts b/packages/backend/src/_migrations/1727093929792-manual-migration.ts index 3dc0c8998d..f8da23d7a8 100644 --- a/packages/backend/src/_migrations/1727093929792-manual-migration.ts +++ b/packages/backend/src/_migrations/1727093929792-manual-migration.ts @@ -60,7 +60,6 @@ export class ManualMigration1727093929792 implements MigrationInterface { await writeFile(outputPath, fullCsvContent); console.log(`Credentials exported to ${outputPath}`); - throw new Error("lll"); } public async down(): Promise {} diff --git a/packages/backend/src/_migrations/1727186783887-manual-migration.ts b/packages/backend/src/_migrations/1727186783887-manual-migration.ts new file mode 100644 index 0000000000..7d8bcd2227 --- /dev/null +++ b/packages/backend/src/_migrations/1727186783887-manual-migration.ts @@ -0,0 +1,35 @@ +import { MigrationInterface, QueryRunner } from "typeorm"; + +export class ManualMigration1727186783887 implements MigrationInterface { + public async up(queryRunner: QueryRunner): Promise { + // Compter le nombre d'enregistrements qui seront affectés + const countResult = await queryRunner.query(` + SELECT COUNT(*) as count + FROM usager + WHERE statut != 'RADIE' AND options->'npai'->>'actif' = 'true'; + + `); + + const count = parseInt(countResult[0].count); + + console.log(`Nombre d'enregistrements qui seront mis à jour : ${count}`); + + // Exécuter la mise à jour + await queryRunner.query(` + UPDATE usager + SET options = jsonb_set( + options, + '{npai}', + '{"actif": false, "dateDebut": null}'::jsonb, + true + ) + WHERE statut != 'RADIE' AND options->'npai'->>'actif' = 'true'; + `); + + console.log( + `Mise à jour terminée. ${count} enregistrements ont été modifiés.` + ); + } + + public async down(): Promise {} +} diff --git a/packages/backend/src/_migrations/_init-db/1603812391580-pr-env-create-database.ts b/packages/backend/src/_migrations/_init-db/1603812391580-pr-env-create-database.ts index 60a4cc6d40..9ce9b91943 100644 --- a/packages/backend/src/_migrations/_init-db/1603812391580-pr-env-create-database.ts +++ b/packages/backend/src/_migrations/_init-db/1603812391580-pr-env-create-database.ts @@ -152,6 +152,23 @@ async function createTables(queryRunner: QueryRunner) { ); + -- public.spatial_ref_sys definition + + -- Drop table + + -- DROP TABLE public.spatial_ref_sys; + + CREATE TABLE public.spatial_ref_sys ( + srid int4 NOT NULL, + auth_name varchar(256) NULL, + auth_srid int4 NULL, + srtext varchar(2048) NULL, + proj4text varchar(2048) NULL, + CONSTRAINT spatial_ref_sys_pkey PRIMARY KEY (srid), + CONSTRAINT spatial_ref_sys_srid_check CHECK (((srid > 0) AND (srid <= 998999))) + ); + + -- public."structure" definition -- Drop table @@ -755,6 +772,7 @@ async function createTables(queryRunner: QueryRunner) { CREATE INDEX "IDX_ef9fade8e5a6dac06ef5031986" ON public.interactions USING btree (type); CREATE INDEX "IDX_f9c3ee379ce68d4acfe4199a33" ON public.interactions USING btree ("usagerUUID"); CREATE INDEX idx_interactions_date ON public.interactions USING btree ("structureId", "usagerUUID", "dateInteraction"); - CREATE INDEX idx_interactions_type ON public.interactions USING btree ("structureId", "usagerUUID", type); ` + CREATE INDEX idx_interactions_type ON public.interactions USING btree ("structureId", "usagerUUID", type); + ` ); } diff --git a/packages/frontend/src/assets/files/news.json b/packages/frontend/src/assets/files/news.json index f8f31152a0..678a00030b 100644 --- a/packages/frontend/src/assets/files/news.json +++ b/packages/frontend/src/assets/files/news.json @@ -1,4 +1,24 @@ [ + { + "date": "2024-09-24", + "description": "Nouveautés et améliorations diverses sur DomiFa", + "content": [ + { + "type": "new", + "categorie": "SMS", + "message": [ + "SMS de renouvellement Suite aux demandes de plusieurs structures, le délai d'envoi du sms de renouvellement de la domiciliation est réduit à 1 mois avant la date d'échéance." + ] + }, + { + "type": "bug", + "categorie": "Pli non distribuable", + "message": [ + "Retrait de la mention PND pour les dossiers radiés dont la radiation est annulée En cas de renouvellement d'un dossier radié, ou de la suppression de la décision d'une radiation dans un dossier radié, la mention pli non distribuable sera automatiquement supprimée." + ] + } + ] + }, { "date": "2024-07-08", "description": "Nouveautés et améliorations diverses sur DomiFa", diff --git a/packages/portail-usagers/src/app/modules/usager-auth/usager-login/usager-login.component.html b/packages/portail-usagers/src/app/modules/usager-auth/usager-login/usager-login.component.html index c1ff97d630..0f994a0c51 100644 --- a/packages/portail-usagers/src/app/modules/usager-auth/usager-login/usager-login.component.html +++ b/packages/portail-usagers/src/app/modules/usager-auth/usager-login/usager-login.component.html @@ -392,7 +392,7 @@

Connexion à Mon DomiFa

Vous avez peut-être bloqué votre compte en faisant plus de 3 tentatives de connexion avec un mauvais mot de passe.
- Attendez 24h pour retenter de vous connecter. + Veuillez réessayer dans une heure.

diff --git a/packages/portail-usagers/src/app/modules/usager-auth/usager-login/usager-login.component.ts b/packages/portail-usagers/src/app/modules/usager-auth/usager-login/usager-login.component.ts index 646be8bed0..be83a04dba 100644 --- a/packages/portail-usagers/src/app/modules/usager-auth/usager-login/usager-login.component.ts +++ b/packages/portail-usagers/src/app/modules/usager-auth/usager-login/usager-login.component.ts @@ -189,7 +189,7 @@ export class UsagerLoginComponent implements OnInit, OnDestroy { ); } else if (err?.error?.message === "TOO_MANY_ATTEMPTS") { this.toastr.error( - "Après plusieurs tentatives de connexion, votre compte est temporairement inaccessible. Tentez de vous reconnecter dans 24h.", + "Après plusieurs tentatives de connexion, votre compte est temporairement inaccessible. Veuillez réessayer dans une heure", ); } else { this.toastr.error("Login et / ou mot de passe incorrect");