diff --git a/_scripts/db/dumps/domifa_test.postgres.custom.gz b/_scripts/db/dumps/domifa_test.postgres.custom.gz index 46662dcc77..18ac948886 100644 Binary files a/_scripts/db/dumps/domifa_test.postgres.custom.gz and b/_scripts/db/dumps/domifa_test.postgres.custom.gz differ diff --git a/_scripts/db/dumps/domifa_test.postgres.restore-data-only.sql b/_scripts/db/dumps/domifa_test.postgres.restore-data-only.sql index d8a1330a31..480d8b0815 100644 --- a/_scripts/db/dumps/domifa_test.postgres.restore-data-only.sql +++ b/_scripts/db/dumps/domifa_test.postgres.restore-data-only.sql @@ -79,20 +79,20 @@ COPY public.expired_token (uuid, "createdAt", "updatedAt", version, "userId", "s -- Data for Name: usager; Type: TABLE DATA; Schema: public; Owner: - -- -COPY public.usager (uuid, "createdAt", "updatedAt", version, ref, "customRef", "structureId", nom, prenom, surnom, sexe, "dateNaissance", "villeNaissance", langue, email, "datePremiereDom", "typeDom", decision, historique, "ayantsDroits", "lastInteraction", "etapeDemande", rdv, options, import, migrated, telephone, "contactByPhone", "numeroDistribution", "pinnedNote", nationalite, statut, nom_prenom_surnom_ref) FROM stdin; -16fe01bb-0c4d-4836-a24a-07d117b47fb9 2021-11-30 15:02:59.193913+01 2022-12-19 11:29:56.621829+01 5 9 9 1 TOMOU Papah homme 2001-11-03 01:00:00+01 Paris \N \N PREMIERE_DOM {"uuid": "c46924e6-fc2a-47d6-955c-8f7cabae70e3", "statut": "INSTRUCTION", "userId": 1, "dateFin": "2021-11-30T14:02:59.189Z", "userName": "Patrick Roméro", "dateDecision": "2021-11-30T14:02:59.189Z"} [{"uuid": "c46924e6-fc2a-47d6-955c-8f7cabae70e3", "motif": null, "statut": "INSTRUCTION", "userId": 1, "dateFin": "2021-11-30T14:02:59.189Z", "userName": "Patrick Roméro", "orientation": null, "dateDecision": "2021-11-30T14:02:59.189Z", "motifDetails": null, "orientationDetails": null}] [] {"colisIn": 0, "enAttente": false, "courrierIn": 0, "recommandeIn": 0, "dateInteraction": "2021-11-30T14:02:59.187Z"} 2 \N {"npai": {"actif": false, "dateDebut": null}, "transfert": {"nom": null, "actif": false, "adresse": null, "dateFin": null, "dateDebut": null}, "procurations": [], "portailUsagerEnabled": false} \N t {"numero": "", "countryCode": "FR"} f \N \N \N INSTRUCTION tomou papah 9 -a034b69a-210a-4a3d-b7a9-8987840ef0c7 2021-11-30 15:03:28.817939+01 2023-05-24 17:51:40.763319+02 6 10 10 1 Dupan Tom homme 1988-02-02 01:00:00+01 Marseille \N \N PREMIERE_DOM {"uuid": "fbe59327-0fef-4d74-ade1-97120407f43c", "statut": "INSTRUCTION", "userId": 1, "dateFin": "2021-11-30T14:03:28.817Z", "userName": "Patrick Roméro", "dateDecision": "2021-11-30T14:03:28.817Z"} [{"uuid": "fbe59327-0fef-4d74-ade1-97120407f43c", "motif": null, "statut": "INSTRUCTION", "userId": 1, "dateFin": "2021-11-30T14:03:28.817Z", "userName": "Patrick Roméro", "orientation": null, "dateDecision": "2021-11-30T14:03:28.817Z", "motifDetails": null, "orientationDetails": null}] [] {"colisIn": 0, "enAttente": false, "courrierIn": 0, "recommandeIn": 0, "dateInteraction": "2021-11-30T14:03:28.816Z"} 2 \N {"npai": {"actif": false, "dateDebut": null}, "transfert": {"nom": null, "actif": false, "adresse": null, "dateFin": null, "dateDebut": null}, "procurations": [], "portailUsagerEnabled": false} \N t {"numero": "", "countryCode": "FR"} f \N {"message": "2eme note", "createdAt": "2023-05-24T15:51:38.893Z", "createdBy": {"userId": 1, "userName": "Patrick Roméro"}, "usagerRef": 10} \N INSTRUCTION dupan tom 10 -427e6af6-706b-40d4-9506-de21190e6f0d 2021-01-27 10:21:49.173276+01 2022-12-19 11:29:56.621829+01 7 4 4 1 Loumiel Lisa Lilou femme 1990-04-18 02:00:00+02 Marseille \N \N 2019-08-09 02:00:00+02 PREMIERE_DOM {"uuid": "0c3f2589-d5d3-4138-a4bc-2a594678461e", "motif": "NON_RESPECT_REGLEMENT", "statut": "RADIE", "userId": 1, "dateFin": "2019-09-12T00:00:00.000Z", "typeDom": "PREMIERE", "userName": "Patrick Roméro", "dateDebut": "2019-08-09T00:00:00.000Z", "orientation": "", "dateDecision": "2019-09-12T00:00:00.000Z", "motifDetails": "", "orientationDetails": ""} [{"uuid": "0c3f2589-d5d3-4138-a4bc-2a594678461e", "motif": "NON_RESPECT_REGLEMENT", "statut": "RADIE", "userId": 1, "dateFin": "2019-09-12T00:00:00.000Z", "typeDom": "PREMIERE_DOM", "userName": "Patrick Roméro", "dateDebut": "2019-08-09T00:00:00.000Z", "orientation": null, "dateDecision": "2019-09-12T00:00:00.000Z", "motifDetails": null, "orientationDetails": null}] [] {"appel": null, "visite": null, "colisIn": 0, "enAttente": false, "courrierIn": 0, "nbCourrier": 0, "courrierOut": null, "recommandeIn": 0, "recommandeOut": null, "dateInteraction": "2021-01-27T09:21:49.240Z"} 5 \N {"npai": {"actif": false, "dateDebut": null}, "transfert": {"nom": null, "actif": false, "adresse": null, "dateFin": null, "dateDebut": null}, "procurations": [], "portailUsagerEnabled": false} \N t {"numero": "0606060606", "countryCode": "FR"} f \N \N \N RADIE loumiel lisa lilou 4 -e074c416-093a-46fc-ae47-77a3bc111d35 2021-01-27 10:21:49.173276+01 2022-12-19 11:29:56.621829+01 6 3 3 1 Dupont Fred fredo homme 1940-08-07 02:00:00+02 Macon \N \N 2019-10-07 20:50:25.552+02 PREMIERE_DOM {"uuid": "30ababd0-8e2f-4917-9662-9c812d604dda", "motif": "SATURATION", "statut": "REFUS", "userId": 1, "dateFin": "2020-08-09T00:00:00.000Z", "typeDom": "PREMIERE", "userName": "Patrick Roméro", "dateDebut": "2019-09-12T00:00:00.000Z", "orientation": "", "dateDecision": "2019-09-12T00:00:00.000Z", "motifDetails": "", "orientationDetails": ""} [{"uuid": "30ababd0-8e2f-4917-9662-9c812d604dda", "motif": "SATURATION", "statut": "REFUS", "userId": 1, "dateFin": "2020-08-09T00:00:00.000Z", "typeDom": "PREMIERE_DOM", "userName": "Patrick Roméro", "dateDebut": "2019-09-12T00:00:00.000Z", "orientation": null, "dateDecision": "2019-09-12T00:00:00.000Z", "motifDetails": null, "orientationDetails": null}] [] {"appel": null, "visite": null, "colisIn": 0, "enAttente": false, "courrierIn": 0, "nbCourrier": 0, "courrierOut": null, "recommandeIn": 0, "recommandeOut": null, "dateInteraction": "2021-01-27T09:21:49.237Z"} 5 \N {"npai": {"actif": false, "dateDebut": null}, "transfert": {"nom": null, "actif": false, "adresse": null, "dateFin": null, "dateDebut": null}, "procurations": [], "portailUsagerEnabled": false} \N t {"numero": "", "countryCode": "FR"} f \N \N \N REFUS dupont fred fredo 3 -97b7e840-0e93-4bf4-ba7d-0a406aa898f2 2019-11-22 11:33:43+01 2022-12-19 11:29:56.621829+01 536 2 63 1 Karamoko Maurice \N homme 1998-08-07 02:00:00+02 Bouaké, Côte d'Ivoire \N domicilie2@yopmail.com 2018-01-11 01:00:00+01 RENOUVELLEMENT {"uuid": "178ad317-0bd1-41e7-ad87-fd371f166310", "motif": null, "statut": "VALIDE", "userId": 1, "dateFin": "2020-02-12T00:00:00.000Z", "typeDom": "RENOUVELLEMENT", "userName": "Patrick Roméro", "dateDebut": "2019-02-12T00:00:00.000Z", "orientation": "", "dateDecision": "2019-02-12T00:00:00.000Z", "motifDetails": "", "orientationDetails": ""} [{"uuid": "178ad317-0bd1-41e7-ad87-fd371f166310", "motif": null, "statut": "VALIDE", "userId": 1, "dateFin": "2020-02-12T00:00:00.000Z", "typeDom": "RENOUVELLEMENT", "userName": "Patrick Roméro", "dateDebut": "2019-02-12T00:00:00.000Z", "orientation": null, "dateDecision": "2019-02-12T00:00:00.000Z", "motifDetails": null, "orientationDetails": null}] [{"nom": "Karamoko", "lien": "CONJOINT", "prenom": "Mauricette", "dateNaissance": "1978-12-20T00:00:00.000Z"}] {"colisIn": 3, "enAttente": true, "courrierIn": 0, "recommandeIn": 0, "dateInteraction": "2020-12-01T10:00:24.980Z"} 3 \N {"npai": {"actif": false}, "transfert": {"nom": null, "actif": false, "adresse": null, "dateFin": null, "dateDebut": null}, "procurations": [{"nom": "Milani", "prenom": "Marcel", "dateFin": "2022-06-05T00:00:00.000Z", "dateDebut": "2021-10-01T00:00:00.000Z", "dateNaissance": "1983-03-17T00:00:00.000Z"}], "portailUsagerEnabled": true} \N t {"numero": "0606060606", "countryCode": "FR"} f \N \N \N VALIDE karamoko maurice 2 -274427da-7482-4edb-86aa-4afaf48243d5 2021-11-30 15:04:46.21552+01 2022-12-19 11:29:56.621829+01 9 11 11 1 Saura Sophie homme 1999-08-20 02:00:00+02 Lyon \N \N PREMIERE_DOM {"statut": "ATTENTE_DECISION", "userId": 1, "typeDom": "PREMIERE_DOM", "userName": "Patrick Roméro", "dateDebut": "2021-11-30T14:04:56.881Z", "dateDecision": "2021-11-30T14:04:56.881Z"} [{"uuid": "73cb88b5-c4bf-42ee-b6db-2f6f32d4fbc3", "motif": null, "statut": "INSTRUCTION", "userId": 1, "dateFin": "2021-11-30T14:04:46.214Z", "userName": "Patrick Roméro", "orientation": null, "dateDecision": "2021-11-30T14:04:46.214Z", "motifDetails": null, "orientationDetails": null}, {"motif": null, "statut": "ATTENTE_DECISION", "userId": 1, "typeDom": "PREMIERE_DOM", "userName": "Patrick Roméro", "orientation": null, "dateDecision": "2021-11-30T14:04:56.881Z", "motifDetails": null, "orientationDetails": null}] [] {"colisIn": 0, "enAttente": false, "courrierIn": 0, "recommandeIn": 0, "dateInteraction": "2021-11-30T14:04:46.212Z"} 4 {"userId": 1, "dateRdv": "2021-11-30T14:03:48.988Z", "userName": "Patrick Roméro"} {"npai": {"actif": false, "dateDebut": null}, "transfert": {"nom": null, "actif": false, "adresse": null, "dateFin": null, "dateDebut": null}, "procurations": [], "portailUsagerEnabled": false} \N t {"numero": "", "countryCode": "FR"} f \N \N \N ATTENTE_DECISION saura sophie 11 -860ffa4c-88c4-4e1c-ad42-5a05cdf39830 2019-11-22 11:33:43+01 2022-12-19 11:29:56.621829+01 9 1 63 1 Ramirez Marta \N femme 1978-08-07 02:00:00+02 Sao Paulo, Brésil \N domicilie1@yopmail.com 2018-03-01 01:00:00+01 PREMIERE_DOM {"uuid": "52ba789e-eb21-4d84-9176-abe1e0d3c778", "motif": null, "statut": "VALIDE", "userId": 1, "dateFin": "2019-02-27T00:00:00.000Z", "typeDom": "PREMIERE", "userName": "Patrick Roméro", "dateDebut": "2018-03-01T00:00:00.000Z", "orientation": "", "dateDecision": "2018-03-01T00:00:00.000Z", "motifDetails": "", "orientationDetails": ""} [{"uuid": "52ba789e-eb21-4d84-9176-abe1e0d3c778", "motif": null, "statut": "VALIDE", "userId": 1, "dateFin": "2019-02-27T00:00:00.000Z", "typeDom": "PREMIERE_DOM", "userName": "Patrick Roméro", "dateDebut": "2018-03-01T00:00:00.000Z", "orientation": null, "dateDecision": "2018-03-01T00:00:00.000Z", "motifDetails": null, "orientationDetails": null}] [{"nom": "Martinez", "lien": "ENFANT", "prenom": "Luiz", "dateNaissance": "1992-12-20T00:00:00.000Z"}, {"nom": "Martinez", "lien": "ENFANT", "prenom": "Sylvia", "dateNaissance": "2007-10-20T00:00:00.000Z"}] {"colisIn": 4, "enAttente": true, "courrierIn": 1, "recommandeIn": 3, "dateInteraction": "2020-07-29T11:46:34.680Z"} 5 \N {"npai": {"actif": false}, "transfert": {"nom": "LHSS Plaisance", "actif": true, "adresse": "12 rue ridder 75014 Paris", "dateFin": "2020-11-07T00:00:00.000Z", "dateDebut": "2020-06-03T12:20:00.603Z"}, "procurations": [], "portailUsagerEnabled": false} \N t {"numero": "0600000000", "countryCode": "FR"} f \N \N \N VALIDE ramirez marta 1 -5215f197-5f9b-4c2a-8b2e-60a0fcc5fc85 2021-06-28 15:26:31.533838+02 2022-12-19 11:29:56.621829+01 9 8 8 1 Smith John homme 2000-03-15 01:00:00+01 Londres \N \N PREMIERE_DOM {"motif": "LIEN_COMMUNE", "statut": "REFUS", "userId": 1, "dateFin": "2021-06-28T00:00:00.000Z", "typeDom": "PREMIERE_DOM", "userName": "Patrick Roméro", "dateDebut": "2021-06-28T00:00:00.000Z", "orientation": "asso", "dateDecision": "2021-06-28T13:27:25.493Z", "motifDetails": null, "orientationDetails": "CCAS de sa commune"} [{"uuid": "6d781a28-a5dc-4d95-826d-6aa0f78e5864", "motif": null, "statut": "INSTRUCTION", "userId": 1, "dateFin": "2021-06-28T13:26:31.533Z", "userName": "Patrick Roméro", "orientation": null, "dateDecision": "2021-06-28T13:26:31.533Z", "motifDetails": null, "orientationDetails": null}, {"motif": "LIEN_COMMUNE", "statut": "REFUS", "userId": 1, "dateFin": "2021-06-28T00:00:00.000Z", "typeDom": "PREMIERE_DOM", "userName": "Patrick Roméro", "dateDebut": "2021-06-28T00:00:00.000Z", "orientation": "asso", "dateDecision": "2021-06-28T13:27:25.493Z", "motifDetails": null, "orientationDetails": "CCAS de sa commune"}] [] {"colisIn": 0, "enAttente": false, "courrierIn": 0, "recommandeIn": 0, "dateInteraction": "2021-06-28T13:26:31.530Z"} 5 {"userId": 1, "dateRdv": "2021-06-28T13:25:42.151Z", "userName": "Patrick Roméro"} {"npai": {"actif": false, "dateDebut": null}, "transfert": {"nom": null, "actif": false, "adresse": null, "dateFin": null, "dateDebut": null}, "procurations": [], "portailUsagerEnabled": false} \N t {"numero": "", "countryCode": "FR"} f \N \N \N REFUS smith john 8 -3ba5c3f0-8003-4c1c-8bf5-929a12e396f5 2021-11-30 15:05:21.635622+01 2022-12-19 11:29:56.621829+01 10 12 12 1 Rara Dié homme 1975-08-08 01:00:00+01 Nantes \N 2021-11-30 01:00:00+01 PREMIERE_DOM {"motif": "A_SA_DEMANDE", "statut": "RADIE", "userId": 1, "dateFin": "2021-11-30T00:00:00.000Z", "typeDom": "PREMIERE_DOM", "userName": "Patrick Roméro", "dateDebut": "2021-11-30T00:00:00.000Z", "dateDecision": "2021-11-30T14:05:41.678Z", "motifDetails": null} [{"uuid": "e8e8c681-9151-4335-8e1c-4e9140946b02", "motif": null, "statut": "INSTRUCTION", "userId": 1, "dateFin": "2021-11-30T14:05:21.634Z", "userName": "Patrick Roméro", "orientation": null, "dateDecision": "2021-11-30T14:05:21.634Z", "motifDetails": null, "orientationDetails": null}, {"motif": null, "statut": "VALIDE", "userId": 1, "dateFin": "2022-11-29T00:00:00.000Z", "typeDom": "PREMIERE_DOM", "userName": "Patrick Roméro", "customRef": "12", "dateDebut": "2021-11-30T00:00:00.000Z", "orientation": null, "dateDecision": "2021-11-30T14:05:31.936Z", "motifDetails": null, "orientationDetails": null}, {"motif": "A_SA_DEMANDE", "statut": "RADIE", "userId": 1, "dateFin": "2021-11-30T00:00:00.000Z", "typeDom": "PREMIERE_DOM", "userName": "Patrick Roméro", "dateDebut": "2021-11-30T00:00:00.000Z", "orientation": null, "dateDecision": "2021-11-30T14:05:41.678Z", "motifDetails": null, "orientationDetails": null}] [] {"colisIn": 0, "enAttente": false, "courrierIn": 0, "recommandeIn": 0, "dateInteraction": "2021-11-30T14:05:21.631Z"} 5 {"userId": 1, "dateRdv": "2021-11-30T14:04:24.108Z", "userName": "Patrick Roméro"} {"npai": {"actif": false, "dateDebut": null}, "transfert": {"nom": null, "actif": false, "adresse": null, "dateFin": null, "dateDebut": null}, "procurations": [], "portailUsagerEnabled": false} \N t {"numero": "", "countryCode": "FR"} f \N \N \N RADIE rara die 12 -6d93ecf8-c59a-42cc-ac1e-b5bd6f977a01 2022-03-17 17:34:17.752334+01 2022-12-19 11:29:56.621829+01 78 1 1 5 Salvador Henri \N homme 1960-02-12 01:00:00+01 Cayenne \N \N 2022-03-16 20:00:00+01 PREMIERE_DOM {"statut": "VALIDE", "userId": 11, "dateFin": "2023-03-15T22:59:59.999Z", "typeDom": "PREMIERE_DOM", "userName": "Mauricette Pali", "customRef": "1", "dateDebut": "2022-03-16T19:00:00.000Z", "dateDecision": "2022-03-17T11:34:29.960Z"} [{"uuid": "db8c8e7d-0300-48e3-a970-10588d410194", "motif": null, "statut": "INSTRUCTION", "userId": 11, "dateFin": "2022-03-17T11:34:17.714Z", "userName": "Mauricette Pali", "dateDebut": "2022-03-17T11:34:17.714Z", "orientation": null, "dateDecision": "2022-03-17T11:34:17.714Z", "motifDetails": null, "orientationDetails": null}, {"motif": null, "statut": "VALIDE", "userId": 11, "dateFin": "2023-03-15T22:59:59.999Z", "typeDom": "PREMIERE_DOM", "userName": "Mauricette Pali", "customRef": "1", "dateDebut": "2022-03-16T19:00:00.000Z", "orientation": null, "dateDecision": "2022-03-17T11:34:29.960Z", "motifDetails": null, "orientationDetails": null}] [] {"colisIn": 0, "enAttente": false, "courrierIn": 0, "recommandeIn": 0, "dateInteraction": "2020-12-01T05:00:24.980Z"} 5 {"userId": 11, "dateRdv": "2022-03-17T16:33:19.998Z", "userName": "Mauricette Pali"} {"npai": {"actif": false, "dateDebut": null}, "transfert": {"nom": null, "actif": false, "adresse": null, "dateFin": null, "dateDebut": null}, "procurations": [], "portailUsagerEnabled": false} \N t {"numero": "", "countryCode": "FR"} f \N \N \N VALIDE salvador henri 1 -ee7ef219-b101-422c-8ad4-4d5aedf9caad 2020-11-01 18:50:10.047+01 2022-12-19 11:29:56.621829+01 8 6 6 1 NOUVEAU DOSSIER TEST homme 1988-11-02 01:00:00+01 Paris \N fake-mail@yopmail.com 2020-11-01 01:00:00+01 PREMIERE_DOM {"uuid": "bf35d476-35d6-4d3d-93b4-dfd49816904f", "statut": "VALIDE", "userId": 1, "dateFin": "2021-10-31T00:00:00.000Z", "userName": "Patrick Roméro", "dateDebut": "2020-11-01T00:00:00.000Z", "dateDecision": "2020-11-01T17:50:29.003Z", "orientationDetails": null} [{"uuid": "8bd1eae7-7635-4c75-ba64-ad78b1141baf", "motif": null, "statut": "INSTRUCTION", "userId": 1, "dateFin": "2020-11-01T17:50:10.042Z", "typeDom": "PREMIERE_DOM", "userName": "Patrick Roméro", "dateDebut": "2020-11-01T17:50:10.042Z", "orientation": null, "dateDecision": "2020-11-01T17:50:10.042Z", "motifDetails": null, "orientationDetails": null}, {"uuid": "bf35d476-35d6-4d3d-93b4-dfd49816904f", "motif": null, "statut": "VALIDE", "userId": 1, "dateFin": "2021-10-31T00:00:00.000Z", "typeDom": "PREMIERE_DOM", "userName": "Patrick Roméro", "dateDebut": "2020-11-01T00:00:00.000Z", "orientation": null, "dateDecision": "2020-11-01T17:50:29.003Z", "motifDetails": null, "orientationDetails": null}] [{"nom": "TEST 1 ", "lien": "PARENT", "prenom": "TEST 2 ", "dateNaissance": "1991-12-20T00:00:00.000Z"}] {"colisIn": 0, "enAttente": false, "courrierIn": 0, "recommandeIn": 0, "dateInteraction": "2020-11-01T00:00:00.000Z"} 5 {"userId": 1, "dateRdv": "2020-11-01T17:50:12.019Z", "userName": "Roméro Patrick"} {"npai": {"actif": false, "dateDebut": null}, "transfert": {"nom": null, "actif": false, "adresse": null, "dateFin": null, "dateDebut": null}, "procurations": [], "portailUsagerEnabled": false} \N t {"numero": "0600000000", "countryCode": "FR"} f \N \N \N VALIDE nouveau dossier test 6 -4dcdcddc-fad2-4827-aac5-0acf1df7b5bc 2021-01-27 10:21:49.173276+01 2022-12-19 11:29:56.621829+01 7 5 5 1 Derick Inspecteur \N homme 1911-05-24 00:00:00+00 Bergerac \N \N \N PREMIERE_DOM {"uuid": "c6aabd3b-7485-4efd-8c09-5080b91709d9", "statut": "ATTENTE_DECISION", "userId": 2, "dateFin": "2021-01-27T09:21:49.242Z", "userName": "Isabelle Juste", "dateDecision": "2019-10-07T19:28:10.777Z", "orientationDetails": null} [{"uuid": "6f18c8d5-27b7-45c5-882d-e23876a3b1ed", "motif": null, "statut": "INSTRUCTION", "userId": 1, "dateFin": "2020-10-07T18:52:09.797Z", "typeDom": "PREMIERE_DOM", "userName": "Patrick Roméro", "dateDebut": "2019-10-07T18:52:09.797Z", "orientation": null, "dateDecision": "2019-10-07T18:53:06.510Z", "motifDetails": null, "orientationDetails": null}, {"uuid": "c6aabd3b-7485-4efd-8c09-5080b91709d9", "motif": null, "statut": "ATTENTE_DECISION", "userId": 2, "dateFin": "2021-01-27T09:21:49.242Z", "typeDom": "PREMIERE_DOM", "userName": "Isabelle Juste", "dateDebut": "2019-10-07T19:28:10.777Z", "orientation": null, "dateDecision": "2019-10-07T19:28:10.777Z", "motifDetails": null, "orientationDetails": null}] [{"nom": "Inspecteur", "lien": "ENFANT", "prenom": "Gadget", "dateNaissance": "1990-10-12T00:00:00.000Z"}] {"appel": null, "visite": null, "colisIn": 0, "enAttente": false, "courrierIn": 0, "nbCourrier": 0, "courrierOut": null, "recommandeIn": 0, "recommandeOut": null, "dateInteraction": "2021-01-27T09:21:49.242Z"} 0 {"userId": 2, "dateRdv": "2019-10-07T19:30:02.675Z", "userName": "Juste Isabelle"} {"npai": {"actif": false, "dateDebut": null}, "transfert": {"nom": null, "actif": false, "adresse": null, "dateFin": null, "dateDebut": null}, "procurations": [], "portailUsagerEnabled": false} \N t {"numero": "", "countryCode": "FR"} f \N \N \N ATTENTE_DECISION derick inspecteur 5 -b2c26e55-ab37-457d-b307-6fe161050a9b 2021-06-28 15:24:22.924091+02 2023-12-18 17:54:10.680396+01 37 7 7 1 Dupont Pauline Paula homme 1996-01-02 01:00:00+01 Paris fr 2021-06-28 02:00:00+02 PREMIERE_DOM {"statut": "VALIDE", "userId": 1, "dateFin": "2022-06-28T00:00:00.000Z", "typeDom": "PREMIERE_DOM", "userName": "Patrick Roméro", "dateDebut": "2021-06-28T00:00:00.000Z", "dateDecision": "2021-06-28T13:25:20.685Z"} [{"uuid": "db7ff8b2-66e3-47ee-9346-e080945b418e", "motif": null, "statut": "INSTRUCTION", "userId": 1, "dateFin": "2021-06-28T13:24:22.920Z", "userName": "Patrick Roméro", "orientation": null, "dateDecision": "2021-06-28T13:24:22.920Z", "motifDetails": null, "orientationDetails": null}, {"motif": null, "statut": "VALIDE", "userId": 1, "dateFin": "2022-06-28T00:00:00.000Z", "typeDom": "PREMIERE_DOM", "userName": "Patrick Roméro", "dateDebut": "2021-06-28T00:00:00.000Z", "orientation": null, "dateDecision": "2021-06-28T13:25:20.685Z", "motifDetails": null, "orientationDetails": null}] [{"nom": "Dupont", "lien": "ENFANT", "prenom": "Paulin", "dateNaissance": "2015-08-15T00:00:00.000Z"}, {"nom": "Dupont", "lien": "ENFANT", "prenom": "Sophie", "dateNaissance": "2018-12-03T00:00:00.000Z"}] {"colisIn": 1, "enAttente": true, "courrierIn": 2, "recommandeIn": 0, "dateInteraction": "2021-06-28T13:25:36.004Z"} 5 {"userId": 1, "dateRdv": "2021-06-28T13:23:27.041Z", "userName": "Patrick Roméro"} {"npai": {"actif": false}, "transfert": {"actif": false}, "procurations": [], "portailUsagerEnabled": true} \N t {"numero": "", "countryCode": "FR"} f \N \N \N VALIDE dupont pauline paula 7 +COPY public.usager (uuid, "createdAt", "updatedAt", version, ref, "customRef", "structureId", nom, prenom, surnom, sexe, "dateNaissance", "villeNaissance", langue, email, "datePremiereDom", "typeDom", decision, historique, "ayantsDroits", "lastInteraction", "etapeDemande", rdv, options, import, migrated, telephone, "contactByPhone", "numeroDistribution", "pinnedNote", nationalite, statut, nom_prenom_surnom_ref, "referrerId") FROM stdin; +16fe01bb-0c4d-4836-a24a-07d117b47fb9 2021-11-30 15:02:59.193913+01 2022-12-19 11:29:56.621829+01 5 9 9 1 TOMOU Papah homme 2001-11-03 01:00:00+01 Paris \N \N PREMIERE_DOM {"uuid": "c46924e6-fc2a-47d6-955c-8f7cabae70e3", "statut": "INSTRUCTION", "userId": 1, "dateFin": "2021-11-30T14:02:59.189Z", "userName": "Patrick Roméro", "dateDecision": "2021-11-30T14:02:59.189Z"} [{"uuid": "c46924e6-fc2a-47d6-955c-8f7cabae70e3", "motif": null, "statut": "INSTRUCTION", "userId": 1, "dateFin": "2021-11-30T14:02:59.189Z", "userName": "Patrick Roméro", "orientation": null, "dateDecision": "2021-11-30T14:02:59.189Z", "motifDetails": null, "orientationDetails": null}] [] {"colisIn": 0, "enAttente": false, "courrierIn": 0, "recommandeIn": 0, "dateInteraction": "2021-11-30T14:02:59.187Z"} 2 \N {"npai": {"actif": false, "dateDebut": null}, "transfert": {"nom": null, "actif": false, "adresse": null, "dateFin": null, "dateDebut": null}, "procurations": [], "portailUsagerEnabled": false} \N t {"numero": "", "countryCode": "FR"} f \N \N \N INSTRUCTION tomou papah 9 \N +a034b69a-210a-4a3d-b7a9-8987840ef0c7 2021-11-30 15:03:28.817939+01 2023-05-24 17:51:40.763319+02 6 10 10 1 Dupan Tom homme 1988-02-02 01:00:00+01 Marseille \N \N PREMIERE_DOM {"uuid": "fbe59327-0fef-4d74-ade1-97120407f43c", "statut": "INSTRUCTION", "userId": 1, "dateFin": "2021-11-30T14:03:28.817Z", "userName": "Patrick Roméro", "dateDecision": "2021-11-30T14:03:28.817Z"} [{"uuid": "fbe59327-0fef-4d74-ade1-97120407f43c", "motif": null, "statut": "INSTRUCTION", "userId": 1, "dateFin": "2021-11-30T14:03:28.817Z", "userName": "Patrick Roméro", "orientation": null, "dateDecision": "2021-11-30T14:03:28.817Z", "motifDetails": null, "orientationDetails": null}] [] {"colisIn": 0, "enAttente": false, "courrierIn": 0, "recommandeIn": 0, "dateInteraction": "2021-11-30T14:03:28.816Z"} 2 \N {"npai": {"actif": false, "dateDebut": null}, "transfert": {"nom": null, "actif": false, "adresse": null, "dateFin": null, "dateDebut": null}, "procurations": [], "portailUsagerEnabled": false} \N t {"numero": "", "countryCode": "FR"} f \N {"message": "2eme note", "createdAt": "2023-05-24T15:51:38.893Z", "createdBy": {"userId": 1, "userName": "Patrick Roméro"}, "usagerRef": 10} \N INSTRUCTION dupan tom 10 \N +427e6af6-706b-40d4-9506-de21190e6f0d 2021-01-27 10:21:49.173276+01 2022-12-19 11:29:56.621829+01 7 4 4 1 Loumiel Lisa Lilou femme 1990-04-18 02:00:00+02 Marseille \N \N 2019-08-09 02:00:00+02 PREMIERE_DOM {"uuid": "0c3f2589-d5d3-4138-a4bc-2a594678461e", "motif": "NON_RESPECT_REGLEMENT", "statut": "RADIE", "userId": 1, "dateFin": "2019-09-12T00:00:00.000Z", "typeDom": "PREMIERE", "userName": "Patrick Roméro", "dateDebut": "2019-08-09T00:00:00.000Z", "orientation": "", "dateDecision": "2019-09-12T00:00:00.000Z", "motifDetails": "", "orientationDetails": ""} [{"uuid": "0c3f2589-d5d3-4138-a4bc-2a594678461e", "motif": "NON_RESPECT_REGLEMENT", "statut": "RADIE", "userId": 1, "dateFin": "2019-09-12T00:00:00.000Z", "typeDom": "PREMIERE_DOM", "userName": "Patrick Roméro", "dateDebut": "2019-08-09T00:00:00.000Z", "orientation": null, "dateDecision": "2019-09-12T00:00:00.000Z", "motifDetails": null, "orientationDetails": null}] [] {"appel": null, "visite": null, "colisIn": 0, "enAttente": false, "courrierIn": 0, "nbCourrier": 0, "courrierOut": null, "recommandeIn": 0, "recommandeOut": null, "dateInteraction": "2021-01-27T09:21:49.240Z"} 5 \N {"npai": {"actif": false, "dateDebut": null}, "transfert": {"nom": null, "actif": false, "adresse": null, "dateFin": null, "dateDebut": null}, "procurations": [], "portailUsagerEnabled": false} \N t {"numero": "0606060606", "countryCode": "FR"} f \N \N \N RADIE loumiel lisa lilou 4 \N +e074c416-093a-46fc-ae47-77a3bc111d35 2021-01-27 10:21:49.173276+01 2022-12-19 11:29:56.621829+01 6 3 3 1 Dupont Fred fredo homme 1940-08-07 02:00:00+02 Macon \N \N 2019-10-07 20:50:25.552+02 PREMIERE_DOM {"uuid": "30ababd0-8e2f-4917-9662-9c812d604dda", "motif": "SATURATION", "statut": "REFUS", "userId": 1, "dateFin": "2020-08-09T00:00:00.000Z", "typeDom": "PREMIERE", "userName": "Patrick Roméro", "dateDebut": "2019-09-12T00:00:00.000Z", "orientation": "", "dateDecision": "2019-09-12T00:00:00.000Z", "motifDetails": "", "orientationDetails": ""} [{"uuid": "30ababd0-8e2f-4917-9662-9c812d604dda", "motif": "SATURATION", "statut": "REFUS", "userId": 1, "dateFin": "2020-08-09T00:00:00.000Z", "typeDom": "PREMIERE_DOM", "userName": "Patrick Roméro", "dateDebut": "2019-09-12T00:00:00.000Z", "orientation": null, "dateDecision": "2019-09-12T00:00:00.000Z", "motifDetails": null, "orientationDetails": null}] [] {"appel": null, "visite": null, "colisIn": 0, "enAttente": false, "courrierIn": 0, "nbCourrier": 0, "courrierOut": null, "recommandeIn": 0, "recommandeOut": null, "dateInteraction": "2021-01-27T09:21:49.237Z"} 5 \N {"npai": {"actif": false, "dateDebut": null}, "transfert": {"nom": null, "actif": false, "adresse": null, "dateFin": null, "dateDebut": null}, "procurations": [], "portailUsagerEnabled": false} \N t {"numero": "", "countryCode": "FR"} f \N \N \N REFUS dupont fred fredo 3 \N +97b7e840-0e93-4bf4-ba7d-0a406aa898f2 2019-11-22 11:33:43+01 2022-12-19 11:29:56.621829+01 536 2 63 1 Karamoko Maurice \N homme 1998-08-07 02:00:00+02 Bouaké, Côte d'Ivoire \N domicilie2@yopmail.com 2018-01-11 01:00:00+01 RENOUVELLEMENT {"uuid": "178ad317-0bd1-41e7-ad87-fd371f166310", "motif": null, "statut": "VALIDE", "userId": 1, "dateFin": "2020-02-12T00:00:00.000Z", "typeDom": "RENOUVELLEMENT", "userName": "Patrick Roméro", "dateDebut": "2019-02-12T00:00:00.000Z", "orientation": "", "dateDecision": "2019-02-12T00:00:00.000Z", "motifDetails": "", "orientationDetails": ""} [{"uuid": "178ad317-0bd1-41e7-ad87-fd371f166310", "motif": null, "statut": "VALIDE", "userId": 1, "dateFin": "2020-02-12T00:00:00.000Z", "typeDom": "RENOUVELLEMENT", "userName": "Patrick Roméro", "dateDebut": "2019-02-12T00:00:00.000Z", "orientation": null, "dateDecision": "2019-02-12T00:00:00.000Z", "motifDetails": null, "orientationDetails": null}] [{"nom": "Karamoko", "lien": "CONJOINT", "prenom": "Mauricette", "dateNaissance": "1978-12-20T00:00:00.000Z"}] {"colisIn": 3, "enAttente": true, "courrierIn": 0, "recommandeIn": 0, "dateInteraction": "2020-12-01T10:00:24.980Z"} 3 \N {"npai": {"actif": false}, "transfert": {"nom": null, "actif": false, "adresse": null, "dateFin": null, "dateDebut": null}, "procurations": [{"nom": "Milani", "prenom": "Marcel", "dateFin": "2022-06-05T00:00:00.000Z", "dateDebut": "2021-10-01T00:00:00.000Z", "dateNaissance": "1983-03-17T00:00:00.000Z"}], "portailUsagerEnabled": true} \N t {"numero": "0606060606", "countryCode": "FR"} f \N \N \N VALIDE karamoko maurice 2 \N +274427da-7482-4edb-86aa-4afaf48243d5 2021-11-30 15:04:46.21552+01 2022-12-19 11:29:56.621829+01 9 11 11 1 Saura Sophie homme 1999-08-20 02:00:00+02 Lyon \N \N PREMIERE_DOM {"statut": "ATTENTE_DECISION", "userId": 1, "typeDom": "PREMIERE_DOM", "userName": "Patrick Roméro", "dateDebut": "2021-11-30T14:04:56.881Z", "dateDecision": "2021-11-30T14:04:56.881Z"} [{"uuid": "73cb88b5-c4bf-42ee-b6db-2f6f32d4fbc3", "motif": null, "statut": "INSTRUCTION", "userId": 1, "dateFin": "2021-11-30T14:04:46.214Z", "userName": "Patrick Roméro", "orientation": null, "dateDecision": "2021-11-30T14:04:46.214Z", "motifDetails": null, "orientationDetails": null}, {"motif": null, "statut": "ATTENTE_DECISION", "userId": 1, "typeDom": "PREMIERE_DOM", "userName": "Patrick Roméro", "orientation": null, "dateDecision": "2021-11-30T14:04:56.881Z", "motifDetails": null, "orientationDetails": null}] [] {"colisIn": 0, "enAttente": false, "courrierIn": 0, "recommandeIn": 0, "dateInteraction": "2021-11-30T14:04:46.212Z"} 4 {"userId": 1, "dateRdv": "2021-11-30T14:03:48.988Z", "userName": "Patrick Roméro"} {"npai": {"actif": false, "dateDebut": null}, "transfert": {"nom": null, "actif": false, "adresse": null, "dateFin": null, "dateDebut": null}, "procurations": [], "portailUsagerEnabled": false} \N t {"numero": "", "countryCode": "FR"} f \N \N \N ATTENTE_DECISION saura sophie 11 \N +860ffa4c-88c4-4e1c-ad42-5a05cdf39830 2019-11-22 11:33:43+01 2022-12-19 11:29:56.621829+01 9 1 63 1 Ramirez Marta \N femme 1978-08-07 02:00:00+02 Sao Paulo, Brésil \N domicilie1@yopmail.com 2018-03-01 01:00:00+01 PREMIERE_DOM {"uuid": "52ba789e-eb21-4d84-9176-abe1e0d3c778", "motif": null, "statut": "VALIDE", "userId": 1, "dateFin": "2019-02-27T00:00:00.000Z", "typeDom": "PREMIERE", "userName": "Patrick Roméro", "dateDebut": "2018-03-01T00:00:00.000Z", "orientation": "", "dateDecision": "2018-03-01T00:00:00.000Z", "motifDetails": "", "orientationDetails": ""} [{"uuid": "52ba789e-eb21-4d84-9176-abe1e0d3c778", "motif": null, "statut": "VALIDE", "userId": 1, "dateFin": "2019-02-27T00:00:00.000Z", "typeDom": "PREMIERE_DOM", "userName": "Patrick Roméro", "dateDebut": "2018-03-01T00:00:00.000Z", "orientation": null, "dateDecision": "2018-03-01T00:00:00.000Z", "motifDetails": null, "orientationDetails": null}] [{"nom": "Martinez", "lien": "ENFANT", "prenom": "Luiz", "dateNaissance": "1992-12-20T00:00:00.000Z"}, {"nom": "Martinez", "lien": "ENFANT", "prenom": "Sylvia", "dateNaissance": "2007-10-20T00:00:00.000Z"}] {"colisIn": 4, "enAttente": true, "courrierIn": 1, "recommandeIn": 3, "dateInteraction": "2020-07-29T11:46:34.680Z"} 5 \N {"npai": {"actif": false}, "transfert": {"nom": "LHSS Plaisance", "actif": true, "adresse": "12 rue ridder 75014 Paris", "dateFin": "2020-11-07T00:00:00.000Z", "dateDebut": "2020-06-03T12:20:00.603Z"}, "procurations": [], "portailUsagerEnabled": false} \N t {"numero": "0600000000", "countryCode": "FR"} f \N \N \N VALIDE ramirez marta 1 \N +5215f197-5f9b-4c2a-8b2e-60a0fcc5fc85 2021-06-28 15:26:31.533838+02 2022-12-19 11:29:56.621829+01 9 8 8 1 Smith John homme 2000-03-15 01:00:00+01 Londres \N \N PREMIERE_DOM {"motif": "LIEN_COMMUNE", "statut": "REFUS", "userId": 1, "dateFin": "2021-06-28T00:00:00.000Z", "typeDom": "PREMIERE_DOM", "userName": "Patrick Roméro", "dateDebut": "2021-06-28T00:00:00.000Z", "orientation": "asso", "dateDecision": "2021-06-28T13:27:25.493Z", "motifDetails": null, "orientationDetails": "CCAS de sa commune"} [{"uuid": "6d781a28-a5dc-4d95-826d-6aa0f78e5864", "motif": null, "statut": "INSTRUCTION", "userId": 1, "dateFin": "2021-06-28T13:26:31.533Z", "userName": "Patrick Roméro", "orientation": null, "dateDecision": "2021-06-28T13:26:31.533Z", "motifDetails": null, "orientationDetails": null}, {"motif": "LIEN_COMMUNE", "statut": "REFUS", "userId": 1, "dateFin": "2021-06-28T00:00:00.000Z", "typeDom": "PREMIERE_DOM", "userName": "Patrick Roméro", "dateDebut": "2021-06-28T00:00:00.000Z", "orientation": "asso", "dateDecision": "2021-06-28T13:27:25.493Z", "motifDetails": null, "orientationDetails": "CCAS de sa commune"}] [] {"colisIn": 0, "enAttente": false, "courrierIn": 0, "recommandeIn": 0, "dateInteraction": "2021-06-28T13:26:31.530Z"} 5 {"userId": 1, "dateRdv": "2021-06-28T13:25:42.151Z", "userName": "Patrick Roméro"} {"npai": {"actif": false, "dateDebut": null}, "transfert": {"nom": null, "actif": false, "adresse": null, "dateFin": null, "dateDebut": null}, "procurations": [], "portailUsagerEnabled": false} \N t {"numero": "", "countryCode": "FR"} f \N \N \N REFUS smith john 8 \N +3ba5c3f0-8003-4c1c-8bf5-929a12e396f5 2021-11-30 15:05:21.635622+01 2022-12-19 11:29:56.621829+01 10 12 12 1 Rara Dié homme 1975-08-08 01:00:00+01 Nantes \N 2021-11-30 01:00:00+01 PREMIERE_DOM {"motif": "A_SA_DEMANDE", "statut": "RADIE", "userId": 1, "dateFin": "2021-11-30T00:00:00.000Z", "typeDom": "PREMIERE_DOM", "userName": "Patrick Roméro", "dateDebut": "2021-11-30T00:00:00.000Z", "dateDecision": "2021-11-30T14:05:41.678Z", "motifDetails": null} [{"uuid": "e8e8c681-9151-4335-8e1c-4e9140946b02", "motif": null, "statut": "INSTRUCTION", "userId": 1, "dateFin": "2021-11-30T14:05:21.634Z", "userName": "Patrick Roméro", "orientation": null, "dateDecision": "2021-11-30T14:05:21.634Z", "motifDetails": null, "orientationDetails": null}, {"motif": null, "statut": "VALIDE", "userId": 1, "dateFin": "2022-11-29T00:00:00.000Z", "typeDom": "PREMIERE_DOM", "userName": "Patrick Roméro", "customRef": "12", "dateDebut": "2021-11-30T00:00:00.000Z", "orientation": null, "dateDecision": "2021-11-30T14:05:31.936Z", "motifDetails": null, "orientationDetails": null}, {"motif": "A_SA_DEMANDE", "statut": "RADIE", "userId": 1, "dateFin": "2021-11-30T00:00:00.000Z", "typeDom": "PREMIERE_DOM", "userName": "Patrick Roméro", "dateDebut": "2021-11-30T00:00:00.000Z", "orientation": null, "dateDecision": "2021-11-30T14:05:41.678Z", "motifDetails": null, "orientationDetails": null}] [] {"colisIn": 0, "enAttente": false, "courrierIn": 0, "recommandeIn": 0, "dateInteraction": "2021-11-30T14:05:21.631Z"} 5 {"userId": 1, "dateRdv": "2021-11-30T14:04:24.108Z", "userName": "Patrick Roméro"} {"npai": {"actif": false, "dateDebut": null}, "transfert": {"nom": null, "actif": false, "adresse": null, "dateFin": null, "dateDebut": null}, "procurations": [], "portailUsagerEnabled": false} \N t {"numero": "", "countryCode": "FR"} f \N \N \N RADIE rara die 12 \N +6d93ecf8-c59a-42cc-ac1e-b5bd6f977a01 2022-03-17 17:34:17.752334+01 2022-12-19 11:29:56.621829+01 78 1 1 5 Salvador Henri \N homme 1960-02-12 01:00:00+01 Cayenne \N \N 2022-03-16 20:00:00+01 PREMIERE_DOM {"statut": "VALIDE", "userId": 11, "dateFin": "2023-03-15T22:59:59.999Z", "typeDom": "PREMIERE_DOM", "userName": "Mauricette Pali", "customRef": "1", "dateDebut": "2022-03-16T19:00:00.000Z", "dateDecision": "2022-03-17T11:34:29.960Z"} [{"uuid": "db8c8e7d-0300-48e3-a970-10588d410194", "motif": null, "statut": "INSTRUCTION", "userId": 11, "dateFin": "2022-03-17T11:34:17.714Z", "userName": "Mauricette Pali", "dateDebut": "2022-03-17T11:34:17.714Z", "orientation": null, "dateDecision": "2022-03-17T11:34:17.714Z", "motifDetails": null, "orientationDetails": null}, {"motif": null, "statut": "VALIDE", "userId": 11, "dateFin": "2023-03-15T22:59:59.999Z", "typeDom": "PREMIERE_DOM", "userName": "Mauricette Pali", "customRef": "1", "dateDebut": "2022-03-16T19:00:00.000Z", "orientation": null, "dateDecision": "2022-03-17T11:34:29.960Z", "motifDetails": null, "orientationDetails": null}] [] {"colisIn": 0, "enAttente": false, "courrierIn": 0, "recommandeIn": 0, "dateInteraction": "2020-12-01T05:00:24.980Z"} 5 {"userId": 11, "dateRdv": "2022-03-17T16:33:19.998Z", "userName": "Mauricette Pali"} {"npai": {"actif": false, "dateDebut": null}, "transfert": {"nom": null, "actif": false, "adresse": null, "dateFin": null, "dateDebut": null}, "procurations": [], "portailUsagerEnabled": false} \N t {"numero": "", "countryCode": "FR"} f \N \N \N VALIDE salvador henri 1 \N +ee7ef219-b101-422c-8ad4-4d5aedf9caad 2020-11-01 18:50:10.047+01 2022-12-19 11:29:56.621829+01 8 6 6 1 NOUVEAU DOSSIER TEST homme 1988-11-02 01:00:00+01 Paris \N fake-mail@yopmail.com 2020-11-01 01:00:00+01 PREMIERE_DOM {"uuid": "bf35d476-35d6-4d3d-93b4-dfd49816904f", "statut": "VALIDE", "userId": 1, "dateFin": "2021-10-31T00:00:00.000Z", "userName": "Patrick Roméro", "dateDebut": "2020-11-01T00:00:00.000Z", "dateDecision": "2020-11-01T17:50:29.003Z", "orientationDetails": null} [{"uuid": "8bd1eae7-7635-4c75-ba64-ad78b1141baf", "motif": null, "statut": "INSTRUCTION", "userId": 1, "dateFin": "2020-11-01T17:50:10.042Z", "typeDom": "PREMIERE_DOM", "userName": "Patrick Roméro", "dateDebut": "2020-11-01T17:50:10.042Z", "orientation": null, "dateDecision": "2020-11-01T17:50:10.042Z", "motifDetails": null, "orientationDetails": null}, {"uuid": "bf35d476-35d6-4d3d-93b4-dfd49816904f", "motif": null, "statut": "VALIDE", "userId": 1, "dateFin": "2021-10-31T00:00:00.000Z", "typeDom": "PREMIERE_DOM", "userName": "Patrick Roméro", "dateDebut": "2020-11-01T00:00:00.000Z", "orientation": null, "dateDecision": "2020-11-01T17:50:29.003Z", "motifDetails": null, "orientationDetails": null}] [{"nom": "TEST 1 ", "lien": "PARENT", "prenom": "TEST 2 ", "dateNaissance": "1991-12-20T00:00:00.000Z"}] {"colisIn": 0, "enAttente": false, "courrierIn": 0, "recommandeIn": 0, "dateInteraction": "2020-11-01T00:00:00.000Z"} 5 {"userId": 1, "dateRdv": "2020-11-01T17:50:12.019Z", "userName": "Roméro Patrick"} {"npai": {"actif": false, "dateDebut": null}, "transfert": {"nom": null, "actif": false, "adresse": null, "dateFin": null, "dateDebut": null}, "procurations": [], "portailUsagerEnabled": false} \N t {"numero": "0600000000", "countryCode": "FR"} f \N \N \N VALIDE nouveau dossier test 6 \N +4dcdcddc-fad2-4827-aac5-0acf1df7b5bc 2021-01-27 10:21:49.173276+01 2022-12-19 11:29:56.621829+01 7 5 5 1 Derick Inspecteur \N homme 1911-05-24 00:00:00+00 Bergerac \N \N \N PREMIERE_DOM {"uuid": "c6aabd3b-7485-4efd-8c09-5080b91709d9", "statut": "ATTENTE_DECISION", "userId": 2, "dateFin": "2021-01-27T09:21:49.242Z", "userName": "Isabelle Juste", "dateDecision": "2019-10-07T19:28:10.777Z", "orientationDetails": null} [{"uuid": "6f18c8d5-27b7-45c5-882d-e23876a3b1ed", "motif": null, "statut": "INSTRUCTION", "userId": 1, "dateFin": "2020-10-07T18:52:09.797Z", "typeDom": "PREMIERE_DOM", "userName": "Patrick Roméro", "dateDebut": "2019-10-07T18:52:09.797Z", "orientation": null, "dateDecision": "2019-10-07T18:53:06.510Z", "motifDetails": null, "orientationDetails": null}, {"uuid": "c6aabd3b-7485-4efd-8c09-5080b91709d9", "motif": null, "statut": "ATTENTE_DECISION", "userId": 2, "dateFin": "2021-01-27T09:21:49.242Z", "typeDom": "PREMIERE_DOM", "userName": "Isabelle Juste", "dateDebut": "2019-10-07T19:28:10.777Z", "orientation": null, "dateDecision": "2019-10-07T19:28:10.777Z", "motifDetails": null, "orientationDetails": null}] [{"nom": "Inspecteur", "lien": "ENFANT", "prenom": "Gadget", "dateNaissance": "1990-10-12T00:00:00.000Z"}] {"appel": null, "visite": null, "colisIn": 0, "enAttente": false, "courrierIn": 0, "nbCourrier": 0, "courrierOut": null, "recommandeIn": 0, "recommandeOut": null, "dateInteraction": "2021-01-27T09:21:49.242Z"} 0 {"userId": 2, "dateRdv": "2019-10-07T19:30:02.675Z", "userName": "Juste Isabelle"} {"npai": {"actif": false, "dateDebut": null}, "transfert": {"nom": null, "actif": false, "adresse": null, "dateFin": null, "dateDebut": null}, "procurations": [], "portailUsagerEnabled": false} \N t {"numero": "", "countryCode": "FR"} f \N \N \N ATTENTE_DECISION derick inspecteur 5 \N +b2c26e55-ab37-457d-b307-6fe161050a9b 2021-06-28 15:24:22.924091+02 2023-12-18 17:54:10.680396+01 37 7 7 1 Dupont Pauline Paula homme 1996-01-02 01:00:00+01 Paris fr 2021-06-28 02:00:00+02 PREMIERE_DOM {"statut": "VALIDE", "userId": 1, "dateFin": "2022-06-28T00:00:00.000Z", "typeDom": "PREMIERE_DOM", "userName": "Patrick Roméro", "dateDebut": "2021-06-28T00:00:00.000Z", "dateDecision": "2021-06-28T13:25:20.685Z"} [{"uuid": "db7ff8b2-66e3-47ee-9346-e080945b418e", "motif": null, "statut": "INSTRUCTION", "userId": 1, "dateFin": "2021-06-28T13:24:22.920Z", "userName": "Patrick Roméro", "orientation": null, "dateDecision": "2021-06-28T13:24:22.920Z", "motifDetails": null, "orientationDetails": null}, {"motif": null, "statut": "VALIDE", "userId": 1, "dateFin": "2022-06-28T00:00:00.000Z", "typeDom": "PREMIERE_DOM", "userName": "Patrick Roméro", "dateDebut": "2021-06-28T00:00:00.000Z", "orientation": null, "dateDecision": "2021-06-28T13:25:20.685Z", "motifDetails": null, "orientationDetails": null}] [{"nom": "Dupont", "lien": "ENFANT", "prenom": "Paulin", "dateNaissance": "2015-08-15T00:00:00.000Z"}, {"nom": "Dupont", "lien": "ENFANT", "prenom": "Sophie", "dateNaissance": "2018-12-03T00:00:00.000Z"}] {"colisIn": 1, "enAttente": true, "courrierIn": 2, "recommandeIn": 0, "dateInteraction": "2021-06-28T13:25:36.004Z"} 5 {"userId": 1, "dateRdv": "2021-06-28T13:23:27.041Z", "userName": "Patrick Roméro"} {"npai": {"actif": false}, "transfert": {"actif": false}, "procurations": [], "portailUsagerEnabled": true} \N t {"numero": "", "countryCode": "FR"} f \N \N \N VALIDE dupont pauline paula 7 \N \. @@ -183,26 +183,6 @@ COPY public.structure_information (uuid, "createdAt", "updatedAt", version, titl -- COPY public.structure_stats_reporting (uuid, "createdAt", "updatedAt", version, "waitingList", workers, volunteers, "humanCosts", "totalCosts", year, "structureId", "completedBy", "confirmationDate", "waitingTime") FROM stdin; -1015fc4f-9174-45a0-a49b-72475b6c5536 2024-05-28 21:03:55.065767+02 2024-05-28 21:03:55.065767+02 1 \N \N \N \N \N 2020 2 \N \N \N -6c8fdfdd-696a-4343-bb2d-13281fb0e134 2024-05-28 21:03:55.065767+02 2024-05-28 21:03:55.065767+02 1 \N \N \N \N \N 2021 2 \N \N \N -86684796-f41f-40ab-8f24-3e8d9bbf294d 2024-05-28 21:03:55.065767+02 2024-05-28 21:03:55.065767+02 1 \N \N \N \N \N 2022 2 \N \N \N -34e879e0-8f36-420f-8fb6-8e237c46d852 2024-05-28 21:03:55.065767+02 2024-05-28 21:03:55.065767+02 1 \N \N \N \N \N 2023 2 \N \N \N -e0f057c9-5410-4306-9b22-7c2fdc0097bf 2024-05-28 21:03:55.089489+02 2024-05-28 21:03:55.089489+02 1 \N \N \N \N \N 2020 4 \N \N \N -8729c6b1-fd10-423e-8234-30bf8d1f0b6c 2024-05-28 21:03:55.089489+02 2024-05-28 21:03:55.089489+02 1 \N \N \N \N \N 2021 4 \N \N \N -91b72976-cfaf-4ca0-90a4-8e38af55bf41 2024-05-28 21:03:55.089489+02 2024-05-28 21:03:55.089489+02 1 \N \N \N \N \N 2022 4 \N \N \N -b9f54526-f4fa-42dc-8455-f4350e19d96b 2024-05-28 21:03:55.089489+02 2024-05-28 21:03:55.089489+02 1 \N \N \N \N \N 2023 4 \N \N \N -1b4da46e-36e4-4982-8916-43ec1ce84485 2024-05-28 21:03:55.092072+02 2024-05-28 21:03:55.092072+02 1 \N \N \N \N \N 2020 3 \N \N \N -5b306d2f-3006-4526-836f-7a4cdc640381 2024-05-28 21:03:55.092072+02 2024-05-28 21:03:55.092072+02 1 \N \N \N \N \N 2021 3 \N \N \N -8daee87d-9fa2-4632-ab5e-9fea015a87f7 2024-05-28 21:03:55.092072+02 2024-05-28 21:03:55.092072+02 1 \N \N \N \N \N 2022 3 \N \N \N -964710fb-6322-4f49-a5b2-b4c20f488f28 2024-05-28 21:03:55.092072+02 2024-05-28 21:03:55.092072+02 1 \N \N \N \N \N 2023 3 \N \N \N -3e1dc458-eb09-441b-9474-b3da12c8bb27 2024-05-28 21:03:55.09392+02 2024-05-28 21:03:55.09392+02 1 \N \N \N \N \N 2020 1 \N \N \N -5d755854-70f0-49b4-8758-f15cb4be520b 2024-05-28 21:03:55.09392+02 2024-05-28 21:03:55.09392+02 1 \N \N \N \N \N 2021 1 \N \N \N -d887dd71-6b09-4eef-bfc8-3a3d28cd9ab4 2024-05-28 21:03:55.09392+02 2024-05-28 21:03:55.09392+02 1 \N \N \N \N \N 2022 1 \N \N \N -58ed32d3-d73f-4a07-a9bf-232c1fb4ad05 2024-05-28 21:03:55.09392+02 2024-05-28 21:03:55.09392+02 1 \N \N \N \N \N 2023 1 \N \N \N -9d5a9911-74ba-486c-9b12-fa044276de2f 2024-05-28 21:03:55.095505+02 2024-05-28 21:03:55.095505+02 1 \N \N \N \N \N 2020 5 \N \N \N -29bc3dff-f665-4876-8bbb-499d47b3f499 2024-05-28 21:03:55.095505+02 2024-05-28 21:03:55.095505+02 1 \N \N \N \N \N 2021 5 \N \N \N -988908a2-e347-4326-a17d-cdad1591b152 2024-05-28 21:03:55.095505+02 2024-05-28 21:03:55.095505+02 1 \N \N \N \N \N 2022 5 \N \N \N -4ad20ed4-df7d-45b0-8e0e-31973d8ebead 2024-05-28 21:03:55.095505+02 2024-05-28 21:03:55.095505+02 1 \N \N \N \N \N 2023 5 \N \N \N \. diff --git a/_scripts/db/dumps/domifa_test.postgres.truncate-restore-data-only.sql b/_scripts/db/dumps/domifa_test.postgres.truncate-restore-data-only.sql index 184218748e..e6a7bf1eca 100644 --- a/_scripts/db/dumps/domifa_test.postgres.truncate-restore-data-only.sql +++ b/_scripts/db/dumps/domifa_test.postgres.truncate-restore-data-only.sql @@ -119,20 +119,20 @@ COPY public.expired_token (uuid, "createdAt", "updatedAt", version, "userId", "s -- Data for Name: usager; Type: TABLE DATA; Schema: public; Owner: - -- -COPY public.usager (uuid, "createdAt", "updatedAt", version, ref, "customRef", "structureId", nom, prenom, surnom, sexe, "dateNaissance", "villeNaissance", langue, email, "datePremiereDom", "typeDom", decision, historique, "ayantsDroits", "lastInteraction", "etapeDemande", rdv, options, import, migrated, telephone, "contactByPhone", "numeroDistribution", "pinnedNote", nationalite, statut, nom_prenom_surnom_ref) FROM stdin; -16fe01bb-0c4d-4836-a24a-07d117b47fb9 2021-11-30 15:02:59.193913+01 2022-12-19 11:29:56.621829+01 5 9 9 1 TOMOU Papah homme 2001-11-03 01:00:00+01 Paris \N \N PREMIERE_DOM {"uuid": "c46924e6-fc2a-47d6-955c-8f7cabae70e3", "statut": "INSTRUCTION", "userId": 1, "dateFin": "2021-11-30T14:02:59.189Z", "userName": "Patrick Roméro", "dateDecision": "2021-11-30T14:02:59.189Z"} [{"uuid": "c46924e6-fc2a-47d6-955c-8f7cabae70e3", "motif": null, "statut": "INSTRUCTION", "userId": 1, "dateFin": "2021-11-30T14:02:59.189Z", "userName": "Patrick Roméro", "orientation": null, "dateDecision": "2021-11-30T14:02:59.189Z", "motifDetails": null, "orientationDetails": null}] [] {"colisIn": 0, "enAttente": false, "courrierIn": 0, "recommandeIn": 0, "dateInteraction": "2021-11-30T14:02:59.187Z"} 2 \N {"npai": {"actif": false, "dateDebut": null}, "transfert": {"nom": null, "actif": false, "adresse": null, "dateFin": null, "dateDebut": null}, "procurations": [], "portailUsagerEnabled": false} \N t {"numero": "", "countryCode": "FR"} f \N \N \N INSTRUCTION tomou papah 9 -a034b69a-210a-4a3d-b7a9-8987840ef0c7 2021-11-30 15:03:28.817939+01 2023-05-24 17:51:40.763319+02 6 10 10 1 Dupan Tom homme 1988-02-02 01:00:00+01 Marseille \N \N PREMIERE_DOM {"uuid": "fbe59327-0fef-4d74-ade1-97120407f43c", "statut": "INSTRUCTION", "userId": 1, "dateFin": "2021-11-30T14:03:28.817Z", "userName": "Patrick Roméro", "dateDecision": "2021-11-30T14:03:28.817Z"} [{"uuid": "fbe59327-0fef-4d74-ade1-97120407f43c", "motif": null, "statut": "INSTRUCTION", "userId": 1, "dateFin": "2021-11-30T14:03:28.817Z", "userName": "Patrick Roméro", "orientation": null, "dateDecision": "2021-11-30T14:03:28.817Z", "motifDetails": null, "orientationDetails": null}] [] {"colisIn": 0, "enAttente": false, "courrierIn": 0, "recommandeIn": 0, "dateInteraction": "2021-11-30T14:03:28.816Z"} 2 \N {"npai": {"actif": false, "dateDebut": null}, "transfert": {"nom": null, "actif": false, "adresse": null, "dateFin": null, "dateDebut": null}, "procurations": [], "portailUsagerEnabled": false} \N t {"numero": "", "countryCode": "FR"} f \N {"message": "2eme note", "createdAt": "2023-05-24T15:51:38.893Z", "createdBy": {"userId": 1, "userName": "Patrick Roméro"}, "usagerRef": 10} \N INSTRUCTION dupan tom 10 -427e6af6-706b-40d4-9506-de21190e6f0d 2021-01-27 10:21:49.173276+01 2022-12-19 11:29:56.621829+01 7 4 4 1 Loumiel Lisa Lilou femme 1990-04-18 02:00:00+02 Marseille \N \N 2019-08-09 02:00:00+02 PREMIERE_DOM {"uuid": "0c3f2589-d5d3-4138-a4bc-2a594678461e", "motif": "NON_RESPECT_REGLEMENT", "statut": "RADIE", "userId": 1, "dateFin": "2019-09-12T00:00:00.000Z", "typeDom": "PREMIERE", "userName": "Patrick Roméro", "dateDebut": "2019-08-09T00:00:00.000Z", "orientation": "", "dateDecision": "2019-09-12T00:00:00.000Z", "motifDetails": "", "orientationDetails": ""} [{"uuid": "0c3f2589-d5d3-4138-a4bc-2a594678461e", "motif": "NON_RESPECT_REGLEMENT", "statut": "RADIE", "userId": 1, "dateFin": "2019-09-12T00:00:00.000Z", "typeDom": "PREMIERE_DOM", "userName": "Patrick Roméro", "dateDebut": "2019-08-09T00:00:00.000Z", "orientation": null, "dateDecision": "2019-09-12T00:00:00.000Z", "motifDetails": null, "orientationDetails": null}] [] {"appel": null, "visite": null, "colisIn": 0, "enAttente": false, "courrierIn": 0, "nbCourrier": 0, "courrierOut": null, "recommandeIn": 0, "recommandeOut": null, "dateInteraction": "2021-01-27T09:21:49.240Z"} 5 \N {"npai": {"actif": false, "dateDebut": null}, "transfert": {"nom": null, "actif": false, "adresse": null, "dateFin": null, "dateDebut": null}, "procurations": [], "portailUsagerEnabled": false} \N t {"numero": "0606060606", "countryCode": "FR"} f \N \N \N RADIE loumiel lisa lilou 4 -e074c416-093a-46fc-ae47-77a3bc111d35 2021-01-27 10:21:49.173276+01 2022-12-19 11:29:56.621829+01 6 3 3 1 Dupont Fred fredo homme 1940-08-07 02:00:00+02 Macon \N \N 2019-10-07 20:50:25.552+02 PREMIERE_DOM {"uuid": "30ababd0-8e2f-4917-9662-9c812d604dda", "motif": "SATURATION", "statut": "REFUS", "userId": 1, "dateFin": "2020-08-09T00:00:00.000Z", "typeDom": "PREMIERE", "userName": "Patrick Roméro", "dateDebut": "2019-09-12T00:00:00.000Z", "orientation": "", "dateDecision": "2019-09-12T00:00:00.000Z", "motifDetails": "", "orientationDetails": ""} [{"uuid": "30ababd0-8e2f-4917-9662-9c812d604dda", "motif": "SATURATION", "statut": "REFUS", "userId": 1, "dateFin": "2020-08-09T00:00:00.000Z", "typeDom": "PREMIERE_DOM", "userName": "Patrick Roméro", "dateDebut": "2019-09-12T00:00:00.000Z", "orientation": null, "dateDecision": "2019-09-12T00:00:00.000Z", "motifDetails": null, "orientationDetails": null}] [] {"appel": null, "visite": null, "colisIn": 0, "enAttente": false, "courrierIn": 0, "nbCourrier": 0, "courrierOut": null, "recommandeIn": 0, "recommandeOut": null, "dateInteraction": "2021-01-27T09:21:49.237Z"} 5 \N {"npai": {"actif": false, "dateDebut": null}, "transfert": {"nom": null, "actif": false, "adresse": null, "dateFin": null, "dateDebut": null}, "procurations": [], "portailUsagerEnabled": false} \N t {"numero": "", "countryCode": "FR"} f \N \N \N REFUS dupont fred fredo 3 -97b7e840-0e93-4bf4-ba7d-0a406aa898f2 2019-11-22 11:33:43+01 2022-12-19 11:29:56.621829+01 536 2 63 1 Karamoko Maurice \N homme 1998-08-07 02:00:00+02 Bouaké, Côte d'Ivoire \N domicilie2@yopmail.com 2018-01-11 01:00:00+01 RENOUVELLEMENT {"uuid": "178ad317-0bd1-41e7-ad87-fd371f166310", "motif": null, "statut": "VALIDE", "userId": 1, "dateFin": "2020-02-12T00:00:00.000Z", "typeDom": "RENOUVELLEMENT", "userName": "Patrick Roméro", "dateDebut": "2019-02-12T00:00:00.000Z", "orientation": "", "dateDecision": "2019-02-12T00:00:00.000Z", "motifDetails": "", "orientationDetails": ""} [{"uuid": "178ad317-0bd1-41e7-ad87-fd371f166310", "motif": null, "statut": "VALIDE", "userId": 1, "dateFin": "2020-02-12T00:00:00.000Z", "typeDom": "RENOUVELLEMENT", "userName": "Patrick Roméro", "dateDebut": "2019-02-12T00:00:00.000Z", "orientation": null, "dateDecision": "2019-02-12T00:00:00.000Z", "motifDetails": null, "orientationDetails": null}] [{"nom": "Karamoko", "lien": "CONJOINT", "prenom": "Mauricette", "dateNaissance": "1978-12-20T00:00:00.000Z"}] {"colisIn": 3, "enAttente": true, "courrierIn": 0, "recommandeIn": 0, "dateInteraction": "2020-12-01T10:00:24.980Z"} 3 \N {"npai": {"actif": false}, "transfert": {"nom": null, "actif": false, "adresse": null, "dateFin": null, "dateDebut": null}, "procurations": [{"nom": "Milani", "prenom": "Marcel", "dateFin": "2022-06-05T00:00:00.000Z", "dateDebut": "2021-10-01T00:00:00.000Z", "dateNaissance": "1983-03-17T00:00:00.000Z"}], "portailUsagerEnabled": true} \N t {"numero": "0606060606", "countryCode": "FR"} f \N \N \N VALIDE karamoko maurice 2 -274427da-7482-4edb-86aa-4afaf48243d5 2021-11-30 15:04:46.21552+01 2022-12-19 11:29:56.621829+01 9 11 11 1 Saura Sophie homme 1999-08-20 02:00:00+02 Lyon \N \N PREMIERE_DOM {"statut": "ATTENTE_DECISION", "userId": 1, "typeDom": "PREMIERE_DOM", "userName": "Patrick Roméro", "dateDebut": "2021-11-30T14:04:56.881Z", "dateDecision": "2021-11-30T14:04:56.881Z"} [{"uuid": "73cb88b5-c4bf-42ee-b6db-2f6f32d4fbc3", "motif": null, "statut": "INSTRUCTION", "userId": 1, "dateFin": "2021-11-30T14:04:46.214Z", "userName": "Patrick Roméro", "orientation": null, "dateDecision": "2021-11-30T14:04:46.214Z", "motifDetails": null, "orientationDetails": null}, {"motif": null, "statut": "ATTENTE_DECISION", "userId": 1, "typeDom": "PREMIERE_DOM", "userName": "Patrick Roméro", "orientation": null, "dateDecision": "2021-11-30T14:04:56.881Z", "motifDetails": null, "orientationDetails": null}] [] {"colisIn": 0, "enAttente": false, "courrierIn": 0, "recommandeIn": 0, "dateInteraction": "2021-11-30T14:04:46.212Z"} 4 {"userId": 1, "dateRdv": "2021-11-30T14:03:48.988Z", "userName": "Patrick Roméro"} {"npai": {"actif": false, "dateDebut": null}, "transfert": {"nom": null, "actif": false, "adresse": null, "dateFin": null, "dateDebut": null}, "procurations": [], "portailUsagerEnabled": false} \N t {"numero": "", "countryCode": "FR"} f \N \N \N ATTENTE_DECISION saura sophie 11 -860ffa4c-88c4-4e1c-ad42-5a05cdf39830 2019-11-22 11:33:43+01 2022-12-19 11:29:56.621829+01 9 1 63 1 Ramirez Marta \N femme 1978-08-07 02:00:00+02 Sao Paulo, Brésil \N domicilie1@yopmail.com 2018-03-01 01:00:00+01 PREMIERE_DOM {"uuid": "52ba789e-eb21-4d84-9176-abe1e0d3c778", "motif": null, "statut": "VALIDE", "userId": 1, "dateFin": "2019-02-27T00:00:00.000Z", "typeDom": "PREMIERE", "userName": "Patrick Roméro", "dateDebut": "2018-03-01T00:00:00.000Z", "orientation": "", "dateDecision": "2018-03-01T00:00:00.000Z", "motifDetails": "", "orientationDetails": ""} [{"uuid": "52ba789e-eb21-4d84-9176-abe1e0d3c778", "motif": null, "statut": "VALIDE", "userId": 1, "dateFin": "2019-02-27T00:00:00.000Z", "typeDom": "PREMIERE_DOM", "userName": "Patrick Roméro", "dateDebut": "2018-03-01T00:00:00.000Z", "orientation": null, "dateDecision": "2018-03-01T00:00:00.000Z", "motifDetails": null, "orientationDetails": null}] [{"nom": "Martinez", "lien": "ENFANT", "prenom": "Luiz", "dateNaissance": "1992-12-20T00:00:00.000Z"}, {"nom": "Martinez", "lien": "ENFANT", "prenom": "Sylvia", "dateNaissance": "2007-10-20T00:00:00.000Z"}] {"colisIn": 4, "enAttente": true, "courrierIn": 1, "recommandeIn": 3, "dateInteraction": "2020-07-29T11:46:34.680Z"} 5 \N {"npai": {"actif": false}, "transfert": {"nom": "LHSS Plaisance", "actif": true, "adresse": "12 rue ridder 75014 Paris", "dateFin": "2020-11-07T00:00:00.000Z", "dateDebut": "2020-06-03T12:20:00.603Z"}, "procurations": [], "portailUsagerEnabled": false} \N t {"numero": "0600000000", "countryCode": "FR"} f \N \N \N VALIDE ramirez marta 1 -5215f197-5f9b-4c2a-8b2e-60a0fcc5fc85 2021-06-28 15:26:31.533838+02 2022-12-19 11:29:56.621829+01 9 8 8 1 Smith John homme 2000-03-15 01:00:00+01 Londres \N \N PREMIERE_DOM {"motif": "LIEN_COMMUNE", "statut": "REFUS", "userId": 1, "dateFin": "2021-06-28T00:00:00.000Z", "typeDom": "PREMIERE_DOM", "userName": "Patrick Roméro", "dateDebut": "2021-06-28T00:00:00.000Z", "orientation": "asso", "dateDecision": "2021-06-28T13:27:25.493Z", "motifDetails": null, "orientationDetails": "CCAS de sa commune"} [{"uuid": "6d781a28-a5dc-4d95-826d-6aa0f78e5864", "motif": null, "statut": "INSTRUCTION", "userId": 1, "dateFin": "2021-06-28T13:26:31.533Z", "userName": "Patrick Roméro", "orientation": null, "dateDecision": "2021-06-28T13:26:31.533Z", "motifDetails": null, "orientationDetails": null}, {"motif": "LIEN_COMMUNE", "statut": "REFUS", "userId": 1, "dateFin": "2021-06-28T00:00:00.000Z", "typeDom": "PREMIERE_DOM", "userName": "Patrick Roméro", "dateDebut": "2021-06-28T00:00:00.000Z", "orientation": "asso", "dateDecision": "2021-06-28T13:27:25.493Z", "motifDetails": null, "orientationDetails": "CCAS de sa commune"}] [] {"colisIn": 0, "enAttente": false, "courrierIn": 0, "recommandeIn": 0, "dateInteraction": "2021-06-28T13:26:31.530Z"} 5 {"userId": 1, "dateRdv": "2021-06-28T13:25:42.151Z", "userName": "Patrick Roméro"} {"npai": {"actif": false, "dateDebut": null}, "transfert": {"nom": null, "actif": false, "adresse": null, "dateFin": null, "dateDebut": null}, "procurations": [], "portailUsagerEnabled": false} \N t {"numero": "", "countryCode": "FR"} f \N \N \N REFUS smith john 8 -3ba5c3f0-8003-4c1c-8bf5-929a12e396f5 2021-11-30 15:05:21.635622+01 2022-12-19 11:29:56.621829+01 10 12 12 1 Rara Dié homme 1975-08-08 01:00:00+01 Nantes \N 2021-11-30 01:00:00+01 PREMIERE_DOM {"motif": "A_SA_DEMANDE", "statut": "RADIE", "userId": 1, "dateFin": "2021-11-30T00:00:00.000Z", "typeDom": "PREMIERE_DOM", "userName": "Patrick Roméro", "dateDebut": "2021-11-30T00:00:00.000Z", "dateDecision": "2021-11-30T14:05:41.678Z", "motifDetails": null} [{"uuid": "e8e8c681-9151-4335-8e1c-4e9140946b02", "motif": null, "statut": "INSTRUCTION", "userId": 1, "dateFin": "2021-11-30T14:05:21.634Z", "userName": "Patrick Roméro", "orientation": null, "dateDecision": "2021-11-30T14:05:21.634Z", "motifDetails": null, "orientationDetails": null}, {"motif": null, "statut": "VALIDE", "userId": 1, "dateFin": "2022-11-29T00:00:00.000Z", "typeDom": "PREMIERE_DOM", "userName": "Patrick Roméro", "customRef": "12", "dateDebut": "2021-11-30T00:00:00.000Z", "orientation": null, "dateDecision": "2021-11-30T14:05:31.936Z", "motifDetails": null, "orientationDetails": null}, {"motif": "A_SA_DEMANDE", "statut": "RADIE", "userId": 1, "dateFin": "2021-11-30T00:00:00.000Z", "typeDom": "PREMIERE_DOM", "userName": "Patrick Roméro", "dateDebut": "2021-11-30T00:00:00.000Z", "orientation": null, "dateDecision": "2021-11-30T14:05:41.678Z", "motifDetails": null, "orientationDetails": null}] [] {"colisIn": 0, "enAttente": false, "courrierIn": 0, "recommandeIn": 0, "dateInteraction": "2021-11-30T14:05:21.631Z"} 5 {"userId": 1, "dateRdv": "2021-11-30T14:04:24.108Z", "userName": "Patrick Roméro"} {"npai": {"actif": false, "dateDebut": null}, "transfert": {"nom": null, "actif": false, "adresse": null, "dateFin": null, "dateDebut": null}, "procurations": [], "portailUsagerEnabled": false} \N t {"numero": "", "countryCode": "FR"} f \N \N \N RADIE rara die 12 -6d93ecf8-c59a-42cc-ac1e-b5bd6f977a01 2022-03-17 17:34:17.752334+01 2022-12-19 11:29:56.621829+01 78 1 1 5 Salvador Henri \N homme 1960-02-12 01:00:00+01 Cayenne \N \N 2022-03-16 20:00:00+01 PREMIERE_DOM {"statut": "VALIDE", "userId": 11, "dateFin": "2023-03-15T22:59:59.999Z", "typeDom": "PREMIERE_DOM", "userName": "Mauricette Pali", "customRef": "1", "dateDebut": "2022-03-16T19:00:00.000Z", "dateDecision": "2022-03-17T11:34:29.960Z"} [{"uuid": "db8c8e7d-0300-48e3-a970-10588d410194", "motif": null, "statut": "INSTRUCTION", "userId": 11, "dateFin": "2022-03-17T11:34:17.714Z", "userName": "Mauricette Pali", "dateDebut": "2022-03-17T11:34:17.714Z", "orientation": null, "dateDecision": "2022-03-17T11:34:17.714Z", "motifDetails": null, "orientationDetails": null}, {"motif": null, "statut": "VALIDE", "userId": 11, "dateFin": "2023-03-15T22:59:59.999Z", "typeDom": "PREMIERE_DOM", "userName": "Mauricette Pali", "customRef": "1", "dateDebut": "2022-03-16T19:00:00.000Z", "orientation": null, "dateDecision": "2022-03-17T11:34:29.960Z", "motifDetails": null, "orientationDetails": null}] [] {"colisIn": 0, "enAttente": false, "courrierIn": 0, "recommandeIn": 0, "dateInteraction": "2020-12-01T05:00:24.980Z"} 5 {"userId": 11, "dateRdv": "2022-03-17T16:33:19.998Z", "userName": "Mauricette Pali"} {"npai": {"actif": false, "dateDebut": null}, "transfert": {"nom": null, "actif": false, "adresse": null, "dateFin": null, "dateDebut": null}, "procurations": [], "portailUsagerEnabled": false} \N t {"numero": "", "countryCode": "FR"} f \N \N \N VALIDE salvador henri 1 -ee7ef219-b101-422c-8ad4-4d5aedf9caad 2020-11-01 18:50:10.047+01 2022-12-19 11:29:56.621829+01 8 6 6 1 NOUVEAU DOSSIER TEST homme 1988-11-02 01:00:00+01 Paris \N fake-mail@yopmail.com 2020-11-01 01:00:00+01 PREMIERE_DOM {"uuid": "bf35d476-35d6-4d3d-93b4-dfd49816904f", "statut": "VALIDE", "userId": 1, "dateFin": "2021-10-31T00:00:00.000Z", "userName": "Patrick Roméro", "dateDebut": "2020-11-01T00:00:00.000Z", "dateDecision": "2020-11-01T17:50:29.003Z", "orientationDetails": null} [{"uuid": "8bd1eae7-7635-4c75-ba64-ad78b1141baf", "motif": null, "statut": "INSTRUCTION", "userId": 1, "dateFin": "2020-11-01T17:50:10.042Z", "typeDom": "PREMIERE_DOM", "userName": "Patrick Roméro", "dateDebut": "2020-11-01T17:50:10.042Z", "orientation": null, "dateDecision": "2020-11-01T17:50:10.042Z", "motifDetails": null, "orientationDetails": null}, {"uuid": "bf35d476-35d6-4d3d-93b4-dfd49816904f", "motif": null, "statut": "VALIDE", "userId": 1, "dateFin": "2021-10-31T00:00:00.000Z", "typeDom": "PREMIERE_DOM", "userName": "Patrick Roméro", "dateDebut": "2020-11-01T00:00:00.000Z", "orientation": null, "dateDecision": "2020-11-01T17:50:29.003Z", "motifDetails": null, "orientationDetails": null}] [{"nom": "TEST 1 ", "lien": "PARENT", "prenom": "TEST 2 ", "dateNaissance": "1991-12-20T00:00:00.000Z"}] {"colisIn": 0, "enAttente": false, "courrierIn": 0, "recommandeIn": 0, "dateInteraction": "2020-11-01T00:00:00.000Z"} 5 {"userId": 1, "dateRdv": "2020-11-01T17:50:12.019Z", "userName": "Roméro Patrick"} {"npai": {"actif": false, "dateDebut": null}, "transfert": {"nom": null, "actif": false, "adresse": null, "dateFin": null, "dateDebut": null}, "procurations": [], "portailUsagerEnabled": false} \N t {"numero": "0600000000", "countryCode": "FR"} f \N \N \N VALIDE nouveau dossier test 6 -4dcdcddc-fad2-4827-aac5-0acf1df7b5bc 2021-01-27 10:21:49.173276+01 2022-12-19 11:29:56.621829+01 7 5 5 1 Derick Inspecteur \N homme 1911-05-24 00:00:00+00 Bergerac \N \N \N PREMIERE_DOM {"uuid": "c6aabd3b-7485-4efd-8c09-5080b91709d9", "statut": "ATTENTE_DECISION", "userId": 2, "dateFin": "2021-01-27T09:21:49.242Z", "userName": "Isabelle Juste", "dateDecision": "2019-10-07T19:28:10.777Z", "orientationDetails": null} [{"uuid": "6f18c8d5-27b7-45c5-882d-e23876a3b1ed", "motif": null, "statut": "INSTRUCTION", "userId": 1, "dateFin": "2020-10-07T18:52:09.797Z", "typeDom": "PREMIERE_DOM", "userName": "Patrick Roméro", "dateDebut": "2019-10-07T18:52:09.797Z", "orientation": null, "dateDecision": "2019-10-07T18:53:06.510Z", "motifDetails": null, "orientationDetails": null}, {"uuid": "c6aabd3b-7485-4efd-8c09-5080b91709d9", "motif": null, "statut": "ATTENTE_DECISION", "userId": 2, "dateFin": "2021-01-27T09:21:49.242Z", "typeDom": "PREMIERE_DOM", "userName": "Isabelle Juste", "dateDebut": "2019-10-07T19:28:10.777Z", "orientation": null, "dateDecision": "2019-10-07T19:28:10.777Z", "motifDetails": null, "orientationDetails": null}] [{"nom": "Inspecteur", "lien": "ENFANT", "prenom": "Gadget", "dateNaissance": "1990-10-12T00:00:00.000Z"}] {"appel": null, "visite": null, "colisIn": 0, "enAttente": false, "courrierIn": 0, "nbCourrier": 0, "courrierOut": null, "recommandeIn": 0, "recommandeOut": null, "dateInteraction": "2021-01-27T09:21:49.242Z"} 0 {"userId": 2, "dateRdv": "2019-10-07T19:30:02.675Z", "userName": "Juste Isabelle"} {"npai": {"actif": false, "dateDebut": null}, "transfert": {"nom": null, "actif": false, "adresse": null, "dateFin": null, "dateDebut": null}, "procurations": [], "portailUsagerEnabled": false} \N t {"numero": "", "countryCode": "FR"} f \N \N \N ATTENTE_DECISION derick inspecteur 5 -b2c26e55-ab37-457d-b307-6fe161050a9b 2021-06-28 15:24:22.924091+02 2023-12-18 17:54:10.680396+01 37 7 7 1 Dupont Pauline Paula homme 1996-01-02 01:00:00+01 Paris fr 2021-06-28 02:00:00+02 PREMIERE_DOM {"statut": "VALIDE", "userId": 1, "dateFin": "2022-06-28T00:00:00.000Z", "typeDom": "PREMIERE_DOM", "userName": "Patrick Roméro", "dateDebut": "2021-06-28T00:00:00.000Z", "dateDecision": "2021-06-28T13:25:20.685Z"} [{"uuid": "db7ff8b2-66e3-47ee-9346-e080945b418e", "motif": null, "statut": "INSTRUCTION", "userId": 1, "dateFin": "2021-06-28T13:24:22.920Z", "userName": "Patrick Roméro", "orientation": null, "dateDecision": "2021-06-28T13:24:22.920Z", "motifDetails": null, "orientationDetails": null}, {"motif": null, "statut": "VALIDE", "userId": 1, "dateFin": "2022-06-28T00:00:00.000Z", "typeDom": "PREMIERE_DOM", "userName": "Patrick Roméro", "dateDebut": "2021-06-28T00:00:00.000Z", "orientation": null, "dateDecision": "2021-06-28T13:25:20.685Z", "motifDetails": null, "orientationDetails": null}] [{"nom": "Dupont", "lien": "ENFANT", "prenom": "Paulin", "dateNaissance": "2015-08-15T00:00:00.000Z"}, {"nom": "Dupont", "lien": "ENFANT", "prenom": "Sophie", "dateNaissance": "2018-12-03T00:00:00.000Z"}] {"colisIn": 1, "enAttente": true, "courrierIn": 2, "recommandeIn": 0, "dateInteraction": "2021-06-28T13:25:36.004Z"} 5 {"userId": 1, "dateRdv": "2021-06-28T13:23:27.041Z", "userName": "Patrick Roméro"} {"npai": {"actif": false}, "transfert": {"actif": false}, "procurations": [], "portailUsagerEnabled": true} \N t {"numero": "", "countryCode": "FR"} f \N \N \N VALIDE dupont pauline paula 7 +COPY public.usager (uuid, "createdAt", "updatedAt", version, ref, "customRef", "structureId", nom, prenom, surnom, sexe, "dateNaissance", "villeNaissance", langue, email, "datePremiereDom", "typeDom", decision, historique, "ayantsDroits", "lastInteraction", "etapeDemande", rdv, options, import, migrated, telephone, "contactByPhone", "numeroDistribution", "pinnedNote", nationalite, statut, nom_prenom_surnom_ref, "referrerId") FROM stdin; +16fe01bb-0c4d-4836-a24a-07d117b47fb9 2021-11-30 15:02:59.193913+01 2022-12-19 11:29:56.621829+01 5 9 9 1 TOMOU Papah homme 2001-11-03 01:00:00+01 Paris \N \N PREMIERE_DOM {"uuid": "c46924e6-fc2a-47d6-955c-8f7cabae70e3", "statut": "INSTRUCTION", "userId": 1, "dateFin": "2021-11-30T14:02:59.189Z", "userName": "Patrick Roméro", "dateDecision": "2021-11-30T14:02:59.189Z"} [{"uuid": "c46924e6-fc2a-47d6-955c-8f7cabae70e3", "motif": null, "statut": "INSTRUCTION", "userId": 1, "dateFin": "2021-11-30T14:02:59.189Z", "userName": "Patrick Roméro", "orientation": null, "dateDecision": "2021-11-30T14:02:59.189Z", "motifDetails": null, "orientationDetails": null}] [] {"colisIn": 0, "enAttente": false, "courrierIn": 0, "recommandeIn": 0, "dateInteraction": "2021-11-30T14:02:59.187Z"} 2 \N {"npai": {"actif": false, "dateDebut": null}, "transfert": {"nom": null, "actif": false, "adresse": null, "dateFin": null, "dateDebut": null}, "procurations": [], "portailUsagerEnabled": false} \N t {"numero": "", "countryCode": "FR"} f \N \N \N INSTRUCTION tomou papah 9 \N +a034b69a-210a-4a3d-b7a9-8987840ef0c7 2021-11-30 15:03:28.817939+01 2023-05-24 17:51:40.763319+02 6 10 10 1 Dupan Tom homme 1988-02-02 01:00:00+01 Marseille \N \N PREMIERE_DOM {"uuid": "fbe59327-0fef-4d74-ade1-97120407f43c", "statut": "INSTRUCTION", "userId": 1, "dateFin": "2021-11-30T14:03:28.817Z", "userName": "Patrick Roméro", "dateDecision": "2021-11-30T14:03:28.817Z"} [{"uuid": "fbe59327-0fef-4d74-ade1-97120407f43c", "motif": null, "statut": "INSTRUCTION", "userId": 1, "dateFin": "2021-11-30T14:03:28.817Z", "userName": "Patrick Roméro", "orientation": null, "dateDecision": "2021-11-30T14:03:28.817Z", "motifDetails": null, "orientationDetails": null}] [] {"colisIn": 0, "enAttente": false, "courrierIn": 0, "recommandeIn": 0, "dateInteraction": "2021-11-30T14:03:28.816Z"} 2 \N {"npai": {"actif": false, "dateDebut": null}, "transfert": {"nom": null, "actif": false, "adresse": null, "dateFin": null, "dateDebut": null}, "procurations": [], "portailUsagerEnabled": false} \N t {"numero": "", "countryCode": "FR"} f \N {"message": "2eme note", "createdAt": "2023-05-24T15:51:38.893Z", "createdBy": {"userId": 1, "userName": "Patrick Roméro"}, "usagerRef": 10} \N INSTRUCTION dupan tom 10 \N +427e6af6-706b-40d4-9506-de21190e6f0d 2021-01-27 10:21:49.173276+01 2022-12-19 11:29:56.621829+01 7 4 4 1 Loumiel Lisa Lilou femme 1990-04-18 02:00:00+02 Marseille \N \N 2019-08-09 02:00:00+02 PREMIERE_DOM {"uuid": "0c3f2589-d5d3-4138-a4bc-2a594678461e", "motif": "NON_RESPECT_REGLEMENT", "statut": "RADIE", "userId": 1, "dateFin": "2019-09-12T00:00:00.000Z", "typeDom": "PREMIERE", "userName": "Patrick Roméro", "dateDebut": "2019-08-09T00:00:00.000Z", "orientation": "", "dateDecision": "2019-09-12T00:00:00.000Z", "motifDetails": "", "orientationDetails": ""} [{"uuid": "0c3f2589-d5d3-4138-a4bc-2a594678461e", "motif": "NON_RESPECT_REGLEMENT", "statut": "RADIE", "userId": 1, "dateFin": "2019-09-12T00:00:00.000Z", "typeDom": "PREMIERE_DOM", "userName": "Patrick Roméro", "dateDebut": "2019-08-09T00:00:00.000Z", "orientation": null, "dateDecision": "2019-09-12T00:00:00.000Z", "motifDetails": null, "orientationDetails": null}] [] {"appel": null, "visite": null, "colisIn": 0, "enAttente": false, "courrierIn": 0, "nbCourrier": 0, "courrierOut": null, "recommandeIn": 0, "recommandeOut": null, "dateInteraction": "2021-01-27T09:21:49.240Z"} 5 \N {"npai": {"actif": false, "dateDebut": null}, "transfert": {"nom": null, "actif": false, "adresse": null, "dateFin": null, "dateDebut": null}, "procurations": [], "portailUsagerEnabled": false} \N t {"numero": "0606060606", "countryCode": "FR"} f \N \N \N RADIE loumiel lisa lilou 4 \N +e074c416-093a-46fc-ae47-77a3bc111d35 2021-01-27 10:21:49.173276+01 2022-12-19 11:29:56.621829+01 6 3 3 1 Dupont Fred fredo homme 1940-08-07 02:00:00+02 Macon \N \N 2019-10-07 20:50:25.552+02 PREMIERE_DOM {"uuid": "30ababd0-8e2f-4917-9662-9c812d604dda", "motif": "SATURATION", "statut": "REFUS", "userId": 1, "dateFin": "2020-08-09T00:00:00.000Z", "typeDom": "PREMIERE", "userName": "Patrick Roméro", "dateDebut": "2019-09-12T00:00:00.000Z", "orientation": "", "dateDecision": "2019-09-12T00:00:00.000Z", "motifDetails": "", "orientationDetails": ""} [{"uuid": "30ababd0-8e2f-4917-9662-9c812d604dda", "motif": "SATURATION", "statut": "REFUS", "userId": 1, "dateFin": "2020-08-09T00:00:00.000Z", "typeDom": "PREMIERE_DOM", "userName": "Patrick Roméro", "dateDebut": "2019-09-12T00:00:00.000Z", "orientation": null, "dateDecision": "2019-09-12T00:00:00.000Z", "motifDetails": null, "orientationDetails": null}] [] {"appel": null, "visite": null, "colisIn": 0, "enAttente": false, "courrierIn": 0, "nbCourrier": 0, "courrierOut": null, "recommandeIn": 0, "recommandeOut": null, "dateInteraction": "2021-01-27T09:21:49.237Z"} 5 \N {"npai": {"actif": false, "dateDebut": null}, "transfert": {"nom": null, "actif": false, "adresse": null, "dateFin": null, "dateDebut": null}, "procurations": [], "portailUsagerEnabled": false} \N t {"numero": "", "countryCode": "FR"} f \N \N \N REFUS dupont fred fredo 3 \N +97b7e840-0e93-4bf4-ba7d-0a406aa898f2 2019-11-22 11:33:43+01 2022-12-19 11:29:56.621829+01 536 2 63 1 Karamoko Maurice \N homme 1998-08-07 02:00:00+02 Bouaké, Côte d'Ivoire \N domicilie2@yopmail.com 2018-01-11 01:00:00+01 RENOUVELLEMENT {"uuid": "178ad317-0bd1-41e7-ad87-fd371f166310", "motif": null, "statut": "VALIDE", "userId": 1, "dateFin": "2020-02-12T00:00:00.000Z", "typeDom": "RENOUVELLEMENT", "userName": "Patrick Roméro", "dateDebut": "2019-02-12T00:00:00.000Z", "orientation": "", "dateDecision": "2019-02-12T00:00:00.000Z", "motifDetails": "", "orientationDetails": ""} [{"uuid": "178ad317-0bd1-41e7-ad87-fd371f166310", "motif": null, "statut": "VALIDE", "userId": 1, "dateFin": "2020-02-12T00:00:00.000Z", "typeDom": "RENOUVELLEMENT", "userName": "Patrick Roméro", "dateDebut": "2019-02-12T00:00:00.000Z", "orientation": null, "dateDecision": "2019-02-12T00:00:00.000Z", "motifDetails": null, "orientationDetails": null}] [{"nom": "Karamoko", "lien": "CONJOINT", "prenom": "Mauricette", "dateNaissance": "1978-12-20T00:00:00.000Z"}] {"colisIn": 3, "enAttente": true, "courrierIn": 0, "recommandeIn": 0, "dateInteraction": "2020-12-01T10:00:24.980Z"} 3 \N {"npai": {"actif": false}, "transfert": {"nom": null, "actif": false, "adresse": null, "dateFin": null, "dateDebut": null}, "procurations": [{"nom": "Milani", "prenom": "Marcel", "dateFin": "2022-06-05T00:00:00.000Z", "dateDebut": "2021-10-01T00:00:00.000Z", "dateNaissance": "1983-03-17T00:00:00.000Z"}], "portailUsagerEnabled": true} \N t {"numero": "0606060606", "countryCode": "FR"} f \N \N \N VALIDE karamoko maurice 2 \N +274427da-7482-4edb-86aa-4afaf48243d5 2021-11-30 15:04:46.21552+01 2022-12-19 11:29:56.621829+01 9 11 11 1 Saura Sophie homme 1999-08-20 02:00:00+02 Lyon \N \N PREMIERE_DOM {"statut": "ATTENTE_DECISION", "userId": 1, "typeDom": "PREMIERE_DOM", "userName": "Patrick Roméro", "dateDebut": "2021-11-30T14:04:56.881Z", "dateDecision": "2021-11-30T14:04:56.881Z"} [{"uuid": "73cb88b5-c4bf-42ee-b6db-2f6f32d4fbc3", "motif": null, "statut": "INSTRUCTION", "userId": 1, "dateFin": "2021-11-30T14:04:46.214Z", "userName": "Patrick Roméro", "orientation": null, "dateDecision": "2021-11-30T14:04:46.214Z", "motifDetails": null, "orientationDetails": null}, {"motif": null, "statut": "ATTENTE_DECISION", "userId": 1, "typeDom": "PREMIERE_DOM", "userName": "Patrick Roméro", "orientation": null, "dateDecision": "2021-11-30T14:04:56.881Z", "motifDetails": null, "orientationDetails": null}] [] {"colisIn": 0, "enAttente": false, "courrierIn": 0, "recommandeIn": 0, "dateInteraction": "2021-11-30T14:04:46.212Z"} 4 {"userId": 1, "dateRdv": "2021-11-30T14:03:48.988Z", "userName": "Patrick Roméro"} {"npai": {"actif": false, "dateDebut": null}, "transfert": {"nom": null, "actif": false, "adresse": null, "dateFin": null, "dateDebut": null}, "procurations": [], "portailUsagerEnabled": false} \N t {"numero": "", "countryCode": "FR"} f \N \N \N ATTENTE_DECISION saura sophie 11 \N +860ffa4c-88c4-4e1c-ad42-5a05cdf39830 2019-11-22 11:33:43+01 2022-12-19 11:29:56.621829+01 9 1 63 1 Ramirez Marta \N femme 1978-08-07 02:00:00+02 Sao Paulo, Brésil \N domicilie1@yopmail.com 2018-03-01 01:00:00+01 PREMIERE_DOM {"uuid": "52ba789e-eb21-4d84-9176-abe1e0d3c778", "motif": null, "statut": "VALIDE", "userId": 1, "dateFin": "2019-02-27T00:00:00.000Z", "typeDom": "PREMIERE", "userName": "Patrick Roméro", "dateDebut": "2018-03-01T00:00:00.000Z", "orientation": "", "dateDecision": "2018-03-01T00:00:00.000Z", "motifDetails": "", "orientationDetails": ""} [{"uuid": "52ba789e-eb21-4d84-9176-abe1e0d3c778", "motif": null, "statut": "VALIDE", "userId": 1, "dateFin": "2019-02-27T00:00:00.000Z", "typeDom": "PREMIERE_DOM", "userName": "Patrick Roméro", "dateDebut": "2018-03-01T00:00:00.000Z", "orientation": null, "dateDecision": "2018-03-01T00:00:00.000Z", "motifDetails": null, "orientationDetails": null}] [{"nom": "Martinez", "lien": "ENFANT", "prenom": "Luiz", "dateNaissance": "1992-12-20T00:00:00.000Z"}, {"nom": "Martinez", "lien": "ENFANT", "prenom": "Sylvia", "dateNaissance": "2007-10-20T00:00:00.000Z"}] {"colisIn": 4, "enAttente": true, "courrierIn": 1, "recommandeIn": 3, "dateInteraction": "2020-07-29T11:46:34.680Z"} 5 \N {"npai": {"actif": false}, "transfert": {"nom": "LHSS Plaisance", "actif": true, "adresse": "12 rue ridder 75014 Paris", "dateFin": "2020-11-07T00:00:00.000Z", "dateDebut": "2020-06-03T12:20:00.603Z"}, "procurations": [], "portailUsagerEnabled": false} \N t {"numero": "0600000000", "countryCode": "FR"} f \N \N \N VALIDE ramirez marta 1 \N +5215f197-5f9b-4c2a-8b2e-60a0fcc5fc85 2021-06-28 15:26:31.533838+02 2022-12-19 11:29:56.621829+01 9 8 8 1 Smith John homme 2000-03-15 01:00:00+01 Londres \N \N PREMIERE_DOM {"motif": "LIEN_COMMUNE", "statut": "REFUS", "userId": 1, "dateFin": "2021-06-28T00:00:00.000Z", "typeDom": "PREMIERE_DOM", "userName": "Patrick Roméro", "dateDebut": "2021-06-28T00:00:00.000Z", "orientation": "asso", "dateDecision": "2021-06-28T13:27:25.493Z", "motifDetails": null, "orientationDetails": "CCAS de sa commune"} [{"uuid": "6d781a28-a5dc-4d95-826d-6aa0f78e5864", "motif": null, "statut": "INSTRUCTION", "userId": 1, "dateFin": "2021-06-28T13:26:31.533Z", "userName": "Patrick Roméro", "orientation": null, "dateDecision": "2021-06-28T13:26:31.533Z", "motifDetails": null, "orientationDetails": null}, {"motif": "LIEN_COMMUNE", "statut": "REFUS", "userId": 1, "dateFin": "2021-06-28T00:00:00.000Z", "typeDom": "PREMIERE_DOM", "userName": "Patrick Roméro", "dateDebut": "2021-06-28T00:00:00.000Z", "orientation": "asso", "dateDecision": "2021-06-28T13:27:25.493Z", "motifDetails": null, "orientationDetails": "CCAS de sa commune"}] [] {"colisIn": 0, "enAttente": false, "courrierIn": 0, "recommandeIn": 0, "dateInteraction": "2021-06-28T13:26:31.530Z"} 5 {"userId": 1, "dateRdv": "2021-06-28T13:25:42.151Z", "userName": "Patrick Roméro"} {"npai": {"actif": false, "dateDebut": null}, "transfert": {"nom": null, "actif": false, "adresse": null, "dateFin": null, "dateDebut": null}, "procurations": [], "portailUsagerEnabled": false} \N t {"numero": "", "countryCode": "FR"} f \N \N \N REFUS smith john 8 \N +3ba5c3f0-8003-4c1c-8bf5-929a12e396f5 2021-11-30 15:05:21.635622+01 2022-12-19 11:29:56.621829+01 10 12 12 1 Rara Dié homme 1975-08-08 01:00:00+01 Nantes \N 2021-11-30 01:00:00+01 PREMIERE_DOM {"motif": "A_SA_DEMANDE", "statut": "RADIE", "userId": 1, "dateFin": "2021-11-30T00:00:00.000Z", "typeDom": "PREMIERE_DOM", "userName": "Patrick Roméro", "dateDebut": "2021-11-30T00:00:00.000Z", "dateDecision": "2021-11-30T14:05:41.678Z", "motifDetails": null} [{"uuid": "e8e8c681-9151-4335-8e1c-4e9140946b02", "motif": null, "statut": "INSTRUCTION", "userId": 1, "dateFin": "2021-11-30T14:05:21.634Z", "userName": "Patrick Roméro", "orientation": null, "dateDecision": "2021-11-30T14:05:21.634Z", "motifDetails": null, "orientationDetails": null}, {"motif": null, "statut": "VALIDE", "userId": 1, "dateFin": "2022-11-29T00:00:00.000Z", "typeDom": "PREMIERE_DOM", "userName": "Patrick Roméro", "customRef": "12", "dateDebut": "2021-11-30T00:00:00.000Z", "orientation": null, "dateDecision": "2021-11-30T14:05:31.936Z", "motifDetails": null, "orientationDetails": null}, {"motif": "A_SA_DEMANDE", "statut": "RADIE", "userId": 1, "dateFin": "2021-11-30T00:00:00.000Z", "typeDom": "PREMIERE_DOM", "userName": "Patrick Roméro", "dateDebut": "2021-11-30T00:00:00.000Z", "orientation": null, "dateDecision": "2021-11-30T14:05:41.678Z", "motifDetails": null, "orientationDetails": null}] [] {"colisIn": 0, "enAttente": false, "courrierIn": 0, "recommandeIn": 0, "dateInteraction": "2021-11-30T14:05:21.631Z"} 5 {"userId": 1, "dateRdv": "2021-11-30T14:04:24.108Z", "userName": "Patrick Roméro"} {"npai": {"actif": false, "dateDebut": null}, "transfert": {"nom": null, "actif": false, "adresse": null, "dateFin": null, "dateDebut": null}, "procurations": [], "portailUsagerEnabled": false} \N t {"numero": "", "countryCode": "FR"} f \N \N \N RADIE rara die 12 \N +6d93ecf8-c59a-42cc-ac1e-b5bd6f977a01 2022-03-17 17:34:17.752334+01 2022-12-19 11:29:56.621829+01 78 1 1 5 Salvador Henri \N homme 1960-02-12 01:00:00+01 Cayenne \N \N 2022-03-16 20:00:00+01 PREMIERE_DOM {"statut": "VALIDE", "userId": 11, "dateFin": "2023-03-15T22:59:59.999Z", "typeDom": "PREMIERE_DOM", "userName": "Mauricette Pali", "customRef": "1", "dateDebut": "2022-03-16T19:00:00.000Z", "dateDecision": "2022-03-17T11:34:29.960Z"} [{"uuid": "db8c8e7d-0300-48e3-a970-10588d410194", "motif": null, "statut": "INSTRUCTION", "userId": 11, "dateFin": "2022-03-17T11:34:17.714Z", "userName": "Mauricette Pali", "dateDebut": "2022-03-17T11:34:17.714Z", "orientation": null, "dateDecision": "2022-03-17T11:34:17.714Z", "motifDetails": null, "orientationDetails": null}, {"motif": null, "statut": "VALIDE", "userId": 11, "dateFin": "2023-03-15T22:59:59.999Z", "typeDom": "PREMIERE_DOM", "userName": "Mauricette Pali", "customRef": "1", "dateDebut": "2022-03-16T19:00:00.000Z", "orientation": null, "dateDecision": "2022-03-17T11:34:29.960Z", "motifDetails": null, "orientationDetails": null}] [] {"colisIn": 0, "enAttente": false, "courrierIn": 0, "recommandeIn": 0, "dateInteraction": "2020-12-01T05:00:24.980Z"} 5 {"userId": 11, "dateRdv": "2022-03-17T16:33:19.998Z", "userName": "Mauricette Pali"} {"npai": {"actif": false, "dateDebut": null}, "transfert": {"nom": null, "actif": false, "adresse": null, "dateFin": null, "dateDebut": null}, "procurations": [], "portailUsagerEnabled": false} \N t {"numero": "", "countryCode": "FR"} f \N \N \N VALIDE salvador henri 1 \N +ee7ef219-b101-422c-8ad4-4d5aedf9caad 2020-11-01 18:50:10.047+01 2022-12-19 11:29:56.621829+01 8 6 6 1 NOUVEAU DOSSIER TEST homme 1988-11-02 01:00:00+01 Paris \N fake-mail@yopmail.com 2020-11-01 01:00:00+01 PREMIERE_DOM {"uuid": "bf35d476-35d6-4d3d-93b4-dfd49816904f", "statut": "VALIDE", "userId": 1, "dateFin": "2021-10-31T00:00:00.000Z", "userName": "Patrick Roméro", "dateDebut": "2020-11-01T00:00:00.000Z", "dateDecision": "2020-11-01T17:50:29.003Z", "orientationDetails": null} [{"uuid": "8bd1eae7-7635-4c75-ba64-ad78b1141baf", "motif": null, "statut": "INSTRUCTION", "userId": 1, "dateFin": "2020-11-01T17:50:10.042Z", "typeDom": "PREMIERE_DOM", "userName": "Patrick Roméro", "dateDebut": "2020-11-01T17:50:10.042Z", "orientation": null, "dateDecision": "2020-11-01T17:50:10.042Z", "motifDetails": null, "orientationDetails": null}, {"uuid": "bf35d476-35d6-4d3d-93b4-dfd49816904f", "motif": null, "statut": "VALIDE", "userId": 1, "dateFin": "2021-10-31T00:00:00.000Z", "typeDom": "PREMIERE_DOM", "userName": "Patrick Roméro", "dateDebut": "2020-11-01T00:00:00.000Z", "orientation": null, "dateDecision": "2020-11-01T17:50:29.003Z", "motifDetails": null, "orientationDetails": null}] [{"nom": "TEST 1 ", "lien": "PARENT", "prenom": "TEST 2 ", "dateNaissance": "1991-12-20T00:00:00.000Z"}] {"colisIn": 0, "enAttente": false, "courrierIn": 0, "recommandeIn": 0, "dateInteraction": "2020-11-01T00:00:00.000Z"} 5 {"userId": 1, "dateRdv": "2020-11-01T17:50:12.019Z", "userName": "Roméro Patrick"} {"npai": {"actif": false, "dateDebut": null}, "transfert": {"nom": null, "actif": false, "adresse": null, "dateFin": null, "dateDebut": null}, "procurations": [], "portailUsagerEnabled": false} \N t {"numero": "0600000000", "countryCode": "FR"} f \N \N \N VALIDE nouveau dossier test 6 \N +4dcdcddc-fad2-4827-aac5-0acf1df7b5bc 2021-01-27 10:21:49.173276+01 2022-12-19 11:29:56.621829+01 7 5 5 1 Derick Inspecteur \N homme 1911-05-24 00:00:00+00 Bergerac \N \N \N PREMIERE_DOM {"uuid": "c6aabd3b-7485-4efd-8c09-5080b91709d9", "statut": "ATTENTE_DECISION", "userId": 2, "dateFin": "2021-01-27T09:21:49.242Z", "userName": "Isabelle Juste", "dateDecision": "2019-10-07T19:28:10.777Z", "orientationDetails": null} [{"uuid": "6f18c8d5-27b7-45c5-882d-e23876a3b1ed", "motif": null, "statut": "INSTRUCTION", "userId": 1, "dateFin": "2020-10-07T18:52:09.797Z", "typeDom": "PREMIERE_DOM", "userName": "Patrick Roméro", "dateDebut": "2019-10-07T18:52:09.797Z", "orientation": null, "dateDecision": "2019-10-07T18:53:06.510Z", "motifDetails": null, "orientationDetails": null}, {"uuid": "c6aabd3b-7485-4efd-8c09-5080b91709d9", "motif": null, "statut": "ATTENTE_DECISION", "userId": 2, "dateFin": "2021-01-27T09:21:49.242Z", "typeDom": "PREMIERE_DOM", "userName": "Isabelle Juste", "dateDebut": "2019-10-07T19:28:10.777Z", "orientation": null, "dateDecision": "2019-10-07T19:28:10.777Z", "motifDetails": null, "orientationDetails": null}] [{"nom": "Inspecteur", "lien": "ENFANT", "prenom": "Gadget", "dateNaissance": "1990-10-12T00:00:00.000Z"}] {"appel": null, "visite": null, "colisIn": 0, "enAttente": false, "courrierIn": 0, "nbCourrier": 0, "courrierOut": null, "recommandeIn": 0, "recommandeOut": null, "dateInteraction": "2021-01-27T09:21:49.242Z"} 0 {"userId": 2, "dateRdv": "2019-10-07T19:30:02.675Z", "userName": "Juste Isabelle"} {"npai": {"actif": false, "dateDebut": null}, "transfert": {"nom": null, "actif": false, "adresse": null, "dateFin": null, "dateDebut": null}, "procurations": [], "portailUsagerEnabled": false} \N t {"numero": "", "countryCode": "FR"} f \N \N \N ATTENTE_DECISION derick inspecteur 5 \N +b2c26e55-ab37-457d-b307-6fe161050a9b 2021-06-28 15:24:22.924091+02 2023-12-18 17:54:10.680396+01 37 7 7 1 Dupont Pauline Paula homme 1996-01-02 01:00:00+01 Paris fr 2021-06-28 02:00:00+02 PREMIERE_DOM {"statut": "VALIDE", "userId": 1, "dateFin": "2022-06-28T00:00:00.000Z", "typeDom": "PREMIERE_DOM", "userName": "Patrick Roméro", "dateDebut": "2021-06-28T00:00:00.000Z", "dateDecision": "2021-06-28T13:25:20.685Z"} [{"uuid": "db7ff8b2-66e3-47ee-9346-e080945b418e", "motif": null, "statut": "INSTRUCTION", "userId": 1, "dateFin": "2021-06-28T13:24:22.920Z", "userName": "Patrick Roméro", "orientation": null, "dateDecision": "2021-06-28T13:24:22.920Z", "motifDetails": null, "orientationDetails": null}, {"motif": null, "statut": "VALIDE", "userId": 1, "dateFin": "2022-06-28T00:00:00.000Z", "typeDom": "PREMIERE_DOM", "userName": "Patrick Roméro", "dateDebut": "2021-06-28T00:00:00.000Z", "orientation": null, "dateDecision": "2021-06-28T13:25:20.685Z", "motifDetails": null, "orientationDetails": null}] [{"nom": "Dupont", "lien": "ENFANT", "prenom": "Paulin", "dateNaissance": "2015-08-15T00:00:00.000Z"}, {"nom": "Dupont", "lien": "ENFANT", "prenom": "Sophie", "dateNaissance": "2018-12-03T00:00:00.000Z"}] {"colisIn": 1, "enAttente": true, "courrierIn": 2, "recommandeIn": 0, "dateInteraction": "2021-06-28T13:25:36.004Z"} 5 {"userId": 1, "dateRdv": "2021-06-28T13:23:27.041Z", "userName": "Patrick Roméro"} {"npai": {"actif": false}, "transfert": {"actif": false}, "procurations": [], "portailUsagerEnabled": true} \N t {"numero": "", "countryCode": "FR"} f \N \N \N VALIDE dupont pauline paula 7 \N \. @@ -223,26 +223,6 @@ COPY public.structure_information (uuid, "createdAt", "updatedAt", version, titl -- COPY public.structure_stats_reporting (uuid, "createdAt", "updatedAt", version, "waitingList", workers, volunteers, "humanCosts", "totalCosts", year, "structureId", "completedBy", "confirmationDate", "waitingTime") FROM stdin; -1015fc4f-9174-45a0-a49b-72475b6c5536 2024-05-28 21:03:55.065767+02 2024-05-28 21:03:55.065767+02 1 \N \N \N \N \N 2020 2 \N \N \N -6c8fdfdd-696a-4343-bb2d-13281fb0e134 2024-05-28 21:03:55.065767+02 2024-05-28 21:03:55.065767+02 1 \N \N \N \N \N 2021 2 \N \N \N -86684796-f41f-40ab-8f24-3e8d9bbf294d 2024-05-28 21:03:55.065767+02 2024-05-28 21:03:55.065767+02 1 \N \N \N \N \N 2022 2 \N \N \N -34e879e0-8f36-420f-8fb6-8e237c46d852 2024-05-28 21:03:55.065767+02 2024-05-28 21:03:55.065767+02 1 \N \N \N \N \N 2023 2 \N \N \N -e0f057c9-5410-4306-9b22-7c2fdc0097bf 2024-05-28 21:03:55.089489+02 2024-05-28 21:03:55.089489+02 1 \N \N \N \N \N 2020 4 \N \N \N -8729c6b1-fd10-423e-8234-30bf8d1f0b6c 2024-05-28 21:03:55.089489+02 2024-05-28 21:03:55.089489+02 1 \N \N \N \N \N 2021 4 \N \N \N -91b72976-cfaf-4ca0-90a4-8e38af55bf41 2024-05-28 21:03:55.089489+02 2024-05-28 21:03:55.089489+02 1 \N \N \N \N \N 2022 4 \N \N \N -b9f54526-f4fa-42dc-8455-f4350e19d96b 2024-05-28 21:03:55.089489+02 2024-05-28 21:03:55.089489+02 1 \N \N \N \N \N 2023 4 \N \N \N -1b4da46e-36e4-4982-8916-43ec1ce84485 2024-05-28 21:03:55.092072+02 2024-05-28 21:03:55.092072+02 1 \N \N \N \N \N 2020 3 \N \N \N -5b306d2f-3006-4526-836f-7a4cdc640381 2024-05-28 21:03:55.092072+02 2024-05-28 21:03:55.092072+02 1 \N \N \N \N \N 2021 3 \N \N \N -8daee87d-9fa2-4632-ab5e-9fea015a87f7 2024-05-28 21:03:55.092072+02 2024-05-28 21:03:55.092072+02 1 \N \N \N \N \N 2022 3 \N \N \N -964710fb-6322-4f49-a5b2-b4c20f488f28 2024-05-28 21:03:55.092072+02 2024-05-28 21:03:55.092072+02 1 \N \N \N \N \N 2023 3 \N \N \N -3e1dc458-eb09-441b-9474-b3da12c8bb27 2024-05-28 21:03:55.09392+02 2024-05-28 21:03:55.09392+02 1 \N \N \N \N \N 2020 1 \N \N \N -5d755854-70f0-49b4-8758-f15cb4be520b 2024-05-28 21:03:55.09392+02 2024-05-28 21:03:55.09392+02 1 \N \N \N \N \N 2021 1 \N \N \N -d887dd71-6b09-4eef-bfc8-3a3d28cd9ab4 2024-05-28 21:03:55.09392+02 2024-05-28 21:03:55.09392+02 1 \N \N \N \N \N 2022 1 \N \N \N -58ed32d3-d73f-4a07-a9bf-232c1fb4ad05 2024-05-28 21:03:55.09392+02 2024-05-28 21:03:55.09392+02 1 \N \N \N \N \N 2023 1 \N \N \N -9d5a9911-74ba-486c-9b12-fa044276de2f 2024-05-28 21:03:55.095505+02 2024-05-28 21:03:55.095505+02 1 \N \N \N \N \N 2020 5 \N \N \N -29bc3dff-f665-4876-8bbb-499d47b3f499 2024-05-28 21:03:55.095505+02 2024-05-28 21:03:55.095505+02 1 \N \N \N \N \N 2021 5 \N \N \N -988908a2-e347-4326-a17d-cdad1591b152 2024-05-28 21:03:55.095505+02 2024-05-28 21:03:55.095505+02 1 \N \N \N \N \N 2022 5 \N \N \N -4ad20ed4-df7d-45b0-8e0e-31973d8ebead 2024-05-28 21:03:55.095505+02 2024-05-28 21:03:55.095505+02 1 \N \N \N \N \N 2023 5 \N \N \N \. diff --git a/packages/backend/src/_common/decorators/index.ts b/packages/backend/src/_common/decorators/index.ts index 16cc1c51ea..a163f7809a 100644 --- a/packages/backend/src/_common/decorators/index.ts +++ b/packages/backend/src/_common/decorators/index.ts @@ -1,13 +1,5 @@ //@index('./*.ts', f => `export * from '${f.path}'`) export * from "./IsValidPasswordDecorator"; export * from "./IsValidPhoneDecorator"; -export * from "./LowerCaseDecorator"; -export * from "./parse-hard-reset-token.pipe"; -export * from "./parse-token.pipe"; -export * from "./ParseRegion.pipe"; -export * from "./ParseString.pipe"; -export * from "./PhoneTransformDecorator"; -export * from "./StripTagsDecorator"; -export * from "./TrimDecorator"; -export * from "./TrimOrNullDecorator"; -export * from "./UpperCaseDecorator"; +export * from "./transformers"; +export * from "./parse-pipes"; diff --git a/packages/backend/src/_common/decorators/ParseRegion.pipe.ts b/packages/backend/src/_common/decorators/parse-pipes/ParseRegion.pipe.ts similarity index 100% rename from packages/backend/src/_common/decorators/ParseRegion.pipe.ts rename to packages/backend/src/_common/decorators/parse-pipes/ParseRegion.pipe.ts diff --git a/packages/backend/src/_common/decorators/ParseString.pipe.ts b/packages/backend/src/_common/decorators/parse-pipes/ParseString.pipe.ts similarity index 100% rename from packages/backend/src/_common/decorators/ParseString.pipe.ts rename to packages/backend/src/_common/decorators/parse-pipes/ParseString.pipe.ts diff --git a/packages/backend/src/_common/decorators/parse-pipes/index.ts b/packages/backend/src/_common/decorators/parse-pipes/index.ts new file mode 100644 index 0000000000..374b767877 --- /dev/null +++ b/packages/backend/src/_common/decorators/parse-pipes/index.ts @@ -0,0 +1,5 @@ +//@index('./*.ts', f => `export * from '${f.path}'`) +export * from "./parse-hard-reset-token.pipe"; +export * from "./parse-token.pipe"; +export * from "./ParseRegion.pipe"; +export * from "./ParseString.pipe"; diff --git a/packages/backend/src/_common/decorators/parse-hard-reset-token.pipe.ts b/packages/backend/src/_common/decorators/parse-pipes/parse-hard-reset-token.pipe.ts similarity index 100% rename from packages/backend/src/_common/decorators/parse-hard-reset-token.pipe.ts rename to packages/backend/src/_common/decorators/parse-pipes/parse-hard-reset-token.pipe.ts diff --git a/packages/backend/src/_common/decorators/parse-token.pipe.ts b/packages/backend/src/_common/decorators/parse-pipes/parse-token.pipe.ts similarity index 100% rename from packages/backend/src/_common/decorators/parse-token.pipe.ts rename to packages/backend/src/_common/decorators/parse-pipes/parse-token.pipe.ts diff --git a/packages/backend/src/_common/decorators/tests/parse-hard-reset-token-pipe.spec.ts b/packages/backend/src/_common/decorators/tests/parse-hard-reset-token-pipe.spec.ts index 9f4dc94889..ad164dd814 100644 --- a/packages/backend/src/_common/decorators/tests/parse-hard-reset-token-pipe.spec.ts +++ b/packages/backend/src/_common/decorators/tests/parse-hard-reset-token-pipe.spec.ts @@ -1,5 +1,5 @@ import { BadRequestException } from "@nestjs/common"; -import { ParseHardResetTokenPipe } from "../parse-hard-reset-token.pipe"; +import { ParseHardResetTokenPipe } from "../parse-pipes/parse-hard-reset-token.pipe"; describe("ParseHardResetTokenPipe", () => { let pipe: ParseHardResetTokenPipe; diff --git a/packages/backend/src/_common/decorators/tests/parse-token-pipe.spec.ts b/packages/backend/src/_common/decorators/tests/parse-token-pipe.spec.ts index de3abfef4a..a70c1464e8 100644 --- a/packages/backend/src/_common/decorators/tests/parse-token-pipe.spec.ts +++ b/packages/backend/src/_common/decorators/tests/parse-token-pipe.spec.ts @@ -1,6 +1,6 @@ import { BadRequestException } from "@nestjs/common"; import { tokenGenerator } from "../../../util"; -import { ParseTokenPipe } from "../parse-token.pipe"; +import { ParseTokenPipe } from "../parse-pipes/parse-token.pipe"; describe("ParseTokenPipe", () => { let pipe: ParseTokenPipe; diff --git a/packages/backend/src/_common/decorators/LowerCaseDecorator.ts b/packages/backend/src/_common/decorators/transformers/LowerCaseDecorator.ts similarity index 100% rename from packages/backend/src/_common/decorators/LowerCaseDecorator.ts rename to packages/backend/src/_common/decorators/transformers/LowerCaseDecorator.ts diff --git a/packages/backend/src/_common/decorators/PhoneTransformDecorator.ts b/packages/backend/src/_common/decorators/transformers/PhoneTransformDecorator.ts similarity index 100% rename from packages/backend/src/_common/decorators/PhoneTransformDecorator.ts rename to packages/backend/src/_common/decorators/transformers/PhoneTransformDecorator.ts diff --git a/packages/backend/src/_common/decorators/StripTagsDecorator.ts b/packages/backend/src/_common/decorators/transformers/StripTagsDecorator.ts similarity index 100% rename from packages/backend/src/_common/decorators/StripTagsDecorator.ts rename to packages/backend/src/_common/decorators/transformers/StripTagsDecorator.ts diff --git a/packages/backend/src/_common/decorators/TrimDecorator.ts b/packages/backend/src/_common/decorators/transformers/TrimDecorator.ts similarity index 100% rename from packages/backend/src/_common/decorators/TrimDecorator.ts rename to packages/backend/src/_common/decorators/transformers/TrimDecorator.ts diff --git a/packages/backend/src/_common/decorators/TrimOrNullDecorator.ts b/packages/backend/src/_common/decorators/transformers/TrimOrNullDecorator.ts similarity index 100% rename from packages/backend/src/_common/decorators/TrimOrNullDecorator.ts rename to packages/backend/src/_common/decorators/transformers/TrimOrNullDecorator.ts diff --git a/packages/backend/src/_common/decorators/UpperCaseDecorator.ts b/packages/backend/src/_common/decorators/transformers/UpperCaseDecorator.ts similarity index 100% rename from packages/backend/src/_common/decorators/UpperCaseDecorator.ts rename to packages/backend/src/_common/decorators/transformers/UpperCaseDecorator.ts diff --git a/packages/backend/src/_common/decorators/transformers/index.ts b/packages/backend/src/_common/decorators/transformers/index.ts new file mode 100644 index 0000000000..61d50631fe --- /dev/null +++ b/packages/backend/src/_common/decorators/transformers/index.ts @@ -0,0 +1,7 @@ +//@index('./*.ts', f => `export * from '${f.path}'`) +export * from "./LowerCaseDecorator"; +export * from "./PhoneTransformDecorator"; +export * from "./StripTagsDecorator"; +export * from "./TrimDecorator"; +export * from "./TrimOrNullDecorator"; +export * from "./UpperCaseDecorator"; diff --git a/packages/backend/src/_common/mocks/VERIFIED_USERS_STRUCTURE.const.ts b/packages/backend/src/_common/mocks/VERIFIED_USERS_STRUCTURE.const.ts new file mode 100644 index 0000000000..64fc080e4e --- /dev/null +++ b/packages/backend/src/_common/mocks/VERIFIED_USERS_STRUCTURE.const.ts @@ -0,0 +1,22 @@ +import { UserStructureProfile } from "@domifa/common"; + +export const VERIFIED_USERS_STRUCTURE: Pick< + UserStructureProfile, + "id" | "nom" | "prenom" +>[] = [ + { + id: 1, + nom: "Martin", + prenom: "Sophie", + }, + { + id: 2, + nom: "Dubois", + prenom: "Pierre", + }, + { + id: 3, + nom: "Laurent", + prenom: "Marie", + }, +]; diff --git a/packages/backend/src/_common/mocks/index.ts b/packages/backend/src/_common/mocks/index.ts index acc95cbd0a..8bf45d55e7 100644 --- a/packages/backend/src/_common/mocks/index.ts +++ b/packages/backend/src/_common/mocks/index.ts @@ -1,4 +1,5 @@ // @index('./*', f => `export * from '${f.path}'`) +export * from "./POST_USER_STRUCTURE_BODY.mock"; export * from "./STRUCTURE_MOCK.const"; export * from "./usagers"; -export * from "./POST_USER_STRUCTURE_BODY.mock"; +export * from "./VERIFIED_USERS_STRUCTURE.const"; diff --git a/packages/backend/src/_common/mocks/usagers/POST_USAGER.mock.ts b/packages/backend/src/_common/mocks/usagers/POST_USAGER.mock.ts index 17012e056a..c94a06229f 100644 --- a/packages/backend/src/_common/mocks/usagers/POST_USAGER.mock.ts +++ b/packages/backend/src/_common/mocks/usagers/POST_USAGER.mock.ts @@ -28,6 +28,7 @@ export const POST_USAGER: { surnom: "Surnom ", villeNaissance: "Monaco", nationalite: null, + referrerId: null, }, response: { nationalite: null, diff --git a/packages/backend/src/_common/model/structure-doc/constants/CUSTOM_DOCS_LABELS.const.ts b/packages/backend/src/_common/model/structure-doc/constants/CUSTOM_DOCS_LABELS.const.ts index ae4fec2a17..542c7ec038 100644 --- a/packages/backend/src/_common/model/structure-doc/constants/CUSTOM_DOCS_LABELS.const.ts +++ b/packages/backend/src/_common/model/structure-doc/constants/CUSTOM_DOCS_LABELS.const.ts @@ -40,6 +40,7 @@ export const CUSTOM_DOCS_LABELS: { USAGER_NATIONALITE: "Nationalité", USAGER_DATE_NAISSANCE: "Date naissance", USAGER_LIEU_NAISSANCE: "Lieu naissance", + REFERENT: "Référent.e dans la structure", AYANTS_DROITS_NOMBRE: "Nombre d'ayants-droit", AYANTS_DROITS_LISTE: "La liste des ayants droits avec nom prénom et date de naissance", diff --git a/packages/backend/src/_common/model/structure-doc/types/StructureCustomDocKeys.type.ts b/packages/backend/src/_common/model/structure-doc/types/StructureCustomDocKeys.type.ts index 0a7e29b25c..fc9862c8ca 100644 --- a/packages/backend/src/_common/model/structure-doc/types/StructureCustomDocKeys.type.ts +++ b/packages/backend/src/_common/model/structure-doc/types/StructureCustomDocKeys.type.ts @@ -39,6 +39,7 @@ export type StructureCustomDocKeys = | "USAGER_NUMERO_DISTRIBUTION_SPECIALE" | "AYANTS_DROITS_LISTE" | "AYANTS_DROITS_NOMBRE" + | "REFERENT" // DECISION | "STATUT_DOM" | "TYPE_DOM" diff --git a/packages/backend/src/_common/model/usager/UsagerLight.type.ts b/packages/backend/src/_common/model/usager/UsagerLight.type.ts index 1ccd901b2a..2e33f7c392 100644 --- a/packages/backend/src/_common/model/usager/UsagerLight.type.ts +++ b/packages/backend/src/_common/model/usager/UsagerLight.type.ts @@ -26,6 +26,7 @@ export type UsagerLight = AppEntity & | "options" | "historique" | "ayantsDroits" + | "referrerId" | "villeNaissance" | "telephone" | "import" diff --git a/packages/backend/src/_common/model/user-structure/UserStructure.type.ts b/packages/backend/src/_common/model/user-structure/UserStructure.type.ts deleted file mode 100644 index be2b1c284e..0000000000 --- a/packages/backend/src/_common/model/user-structure/UserStructure.type.ts +++ /dev/null @@ -1,30 +0,0 @@ -import { - UserStructureRole, - UserStructureMails, - StructureCommon, - AppEntity, -} from "@domifa/common"; - -export type UserStructure = AppEntity & { - id: number; - - prenom: string; - nom: string; - fonction?: string; - structureId: number; - - // login tokens - email: string; - password: string; - - lastLogin: Date; - passwordLastUpdate: Date; - - verified: boolean; - - role: UserStructureRole; // security profile - - mails: UserStructureMails; - acceptTerms: Date | null; - structure?: StructureCommon; -}; diff --git a/packages/backend/src/_common/model/user-structure/UserStructureProfile.type.ts b/packages/backend/src/_common/model/user-structure/UserStructureProfile.type.ts deleted file mode 100644 index 25febf22e5..0000000000 --- a/packages/backend/src/_common/model/user-structure/UserStructureProfile.type.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { UserStructure } from "./UserStructure.type"; - -export type UserStructureProfile = Pick< - UserStructure, - | "id" - | "email" - | "nom" - | "prenom" - | "role" - | "verified" - | "structureId" - | "structure" - | "fonction" ->; diff --git a/packages/backend/src/_common/model/user-structure/UserStructurePublic.type.ts b/packages/backend/src/_common/model/user-structure/UserStructurePublic.type.ts index 504a2fa64e..caa3750735 100644 --- a/packages/backend/src/_common/model/user-structure/UserStructurePublic.type.ts +++ b/packages/backend/src/_common/model/user-structure/UserStructurePublic.type.ts @@ -1,4 +1,4 @@ -import { UserStructure } from "./UserStructure.type"; +import { UserStructure } from "@domifa/common"; // UserStructure: attributs publics (retournés au frontend via UserStructureAuthenticated) export type UserStructurePublic = Pick< diff --git a/packages/backend/src/_common/model/user-structure/index.ts b/packages/backend/src/_common/model/user-structure/index.ts index 70c834d938..3a4ad214e3 100644 --- a/packages/backend/src/_common/model/user-structure/index.ts +++ b/packages/backend/src/_common/model/user-structure/index.ts @@ -1,8 +1,6 @@ // @index('./*', f => `export * from '${f.path}'`) export * from "./_constants"; -export * from "./UserStructure.type"; export * from "./UserStructureAuthenticated.type"; -export * from "./UserStructureProfile.type"; export * from "./UserStructurePublic.type"; export * from "./UserStructureSecurity.type"; export * from "./UserStructureSecurityEvent.type"; diff --git a/packages/backend/src/_migrations/1736291936636-auto-migration.ts b/packages/backend/src/_migrations/1736291936636-auto-migration.ts new file mode 100644 index 0000000000..714062d277 --- /dev/null +++ b/packages/backend/src/_migrations/1736291936636-auto-migration.ts @@ -0,0 +1,20 @@ +import { MigrationInterface, QueryRunner } from "typeorm"; +import { domifaConfig } from "../config"; + +export class AutoMigration1736291936636 implements MigrationInterface { + name = "AutoMigration1736291936636"; + + public async up(queryRunner: QueryRunner): Promise { + if ( + domifaConfig().envId === "prod" || + domifaConfig().envId === "preprod" || + domifaConfig().envId === "local" + ) { + await queryRunner.query(`ALTER TABLE "usager" ADD "referrerId" integer`); + } + } + + public async down(queryRunner: QueryRunner): Promise { + await queryRunner.query(`ALTER TABLE "usager" DROP COLUMN "referrerId"`); + } +} 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 93ce428fcf..3710d89b52 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 @@ -430,6 +430,7 @@ async function createTables(queryRunner: QueryRunner) { "numeroDistribution" text NULL, "pinnedNote" jsonb NULL, nationalite text NULL, + "referrerId" int4 NULL, statut text DEFAULT 'INSTRUCTION'::text NOT NULL, nom_prenom_surnom_ref varchar NOT NULL, CONSTRAINT "PK_1bb36e24229bec446a281573612" PRIMARY KEY (uuid), diff --git a/packages/backend/src/app.bootstrap.ts b/packages/backend/src/app.bootstrap.ts index a562d02067..2ab04e3cbb 100644 --- a/packages/backend/src/app.bootstrap.ts +++ b/packages/backend/src/app.bootstrap.ts @@ -74,6 +74,10 @@ export async function bootstrapApplication(): Promise<{ stopAtFirstError: true, enableDebugMessages: true, disableErrorMessages: domifaConfig().envId !== "local", + transform: true, + transformOptions: { + enableImplicitConversion: false, + }, }) ); diff --git a/packages/backend/src/auth/services/auth-checker.service.ts b/packages/backend/src/auth/services/auth-checker.service.ts index c698cdf1fa..6b168691e8 100644 --- a/packages/backend/src/auth/services/auth-checker.service.ts +++ b/packages/backend/src/auth/services/auth-checker.service.ts @@ -1,11 +1,7 @@ import { appLogger } from "../../util"; -import { - UserAuthenticated, - UserProfile, - UserStructure, -} from "../../_common/model"; +import { UserAuthenticated, UserProfile } from "../../_common/model"; import { DOMIFA_ADMIN_STRUCTURE_ID } from "./DOMIFA_ADMIN_STRUCTURE_ID.const"; -import { UserStructureRole } from "@domifa/common"; +import { UserStructure, UserStructureRole } from "@domifa/common"; export const authChecker = { checkRole, diff --git a/packages/backend/src/auth/services/structures-auth.service.ts b/packages/backend/src/auth/services/structures-auth.service.ts index bed1429df2..13cde57f2b 100644 --- a/packages/backend/src/auth/services/structures-auth.service.ts +++ b/packages/backend/src/auth/services/structures-auth.service.ts @@ -5,13 +5,12 @@ import { domifaConfig } from "../../config"; import { userStructureRepository, structureRepository } from "../../database"; import { CURRENT_JWT_PAYLOAD_VERSION, - UserStructure, UserStructureAuthenticated, UserStructureJwtPayload, UserStructurePublic, } from "../../_common/model"; import { isDomifaAdmin } from "./auth-checker.service"; -import { StructureCommon } from "@domifa/common"; +import { UserStructure, StructureCommon } from "@domifa/common"; export const APP_USER_PUBLIC_ATTRIBUTES: (keyof UserStructurePublic)[] = [ "uuid", diff --git a/packages/backend/src/database/entities/usager/UsagerTable.typeorm.ts b/packages/backend/src/database/entities/usager/UsagerTable.typeorm.ts index 362f67fb8f..54231b5005 100644 --- a/packages/backend/src/database/entities/usager/UsagerTable.typeorm.ts +++ b/packages/backend/src/database/entities/usager/UsagerTable.typeorm.ts @@ -123,6 +123,9 @@ export class UsagerTable @Column({ type: "integer", default: 0 }) public etapeDemande!: number; + @Column({ type: "integer", default: null, nullable: true }) + public referrerId!: number; + @Column({ type: "jsonb", nullable: true }) public rdv!: UsagerRdv | null; diff --git a/packages/backend/src/database/services/app-log/user-structure-security/userStructureSecurityPasswordChecker.service.ts b/packages/backend/src/database/services/app-log/user-structure-security/userStructureSecurityPasswordChecker.service.ts index 43f183393d..cc3482ec6f 100644 --- a/packages/backend/src/database/services/app-log/user-structure-security/userStructureSecurityPasswordChecker.service.ts +++ b/packages/backend/src/database/services/app-log/user-structure-security/userStructureSecurityPasswordChecker.service.ts @@ -1,6 +1,6 @@ +import { UserStructure } from "@domifa/common"; +import { passwordGenerator } from "../../../../util"; import { userStructureRepository } from "../../user-structure"; -import { passwordGenerator } from "../../../../util/encoding/passwordGenerator.service"; -import { UserStructure } from "../../../../_common/model"; import { userStructureSecurityEventHistoryManager } from "./userStructureSecurityEventHistoryManager.service"; import { userStructureSecurityRepository } from "./userStructureSecurityRepository.service"; diff --git a/packages/backend/src/database/services/app-log/user-structure-security/userStructureSecurityResetPasswordInitiator.service.ts b/packages/backend/src/database/services/app-log/user-structure-security/userStructureSecurityResetPasswordInitiator.service.ts index b55efe52ad..84906a6a77 100644 --- a/packages/backend/src/database/services/app-log/user-structure-security/userStructureSecurityResetPasswordInitiator.service.ts +++ b/packages/backend/src/database/services/app-log/user-structure-security/userStructureSecurityResetPasswordInitiator.service.ts @@ -3,7 +3,6 @@ import { addDays } from "date-fns"; import { domifaConfig } from "../../../../config"; import { tokenGenerator } from "../../../../util"; import { - UserStructureProfile, UserStructureSecurity, UserStructureTokens, UserStructureTokenType, @@ -11,6 +10,7 @@ import { import { userStructureRepository } from "../../user-structure"; import { userStructureSecurityEventHistoryManager } from "./userStructureSecurityEventHistoryManager.service"; import { userStructureSecurityRepository } from "./userStructureSecurityRepository.service"; +import { UserStructureProfile } from "@domifa/common"; export const userStructureSecurityResetPasswordInitiator = { buildResetPasswordLink, diff --git a/packages/backend/src/database/services/app-log/user-structure-security/userStructureSecurityResetPasswordUpdater.service.ts b/packages/backend/src/database/services/app-log/user-structure-security/userStructureSecurityResetPasswordUpdater.service.ts index c95e6c603c..d10600426f 100644 --- a/packages/backend/src/database/services/app-log/user-structure-security/userStructureSecurityResetPasswordUpdater.service.ts +++ b/packages/backend/src/database/services/app-log/user-structure-security/userStructureSecurityResetPasswordUpdater.service.ts @@ -1,11 +1,9 @@ import { passwordGenerator } from "../../../../util/encoding/passwordGenerator.service"; -import { - UserStructureProfile, - UserStructureSecurity, -} from "../../../../_common/model"; +import { UserStructureSecurity } from "../../../../_common/model"; import { userStructureRepository } from "../../user-structure/userStructureRepository.service"; import { userStructureSecurityEventHistoryManager } from "./userStructureSecurityEventHistoryManager.service"; import { userStructureSecurityRepository } from "./userStructureSecurityRepository.service"; +import { UserStructureProfile } from "@domifa/common"; export const userStructureSecurityResetPasswordUpdater = { checkResetPasswordToken, diff --git a/packages/backend/src/database/services/usager/constants/USAGER_LIGHT_ATTRIBUTES.const.ts b/packages/backend/src/database/services/usager/constants/USAGER_LIGHT_ATTRIBUTES.const.ts index 37d55aa990..409106ddb6 100644 --- a/packages/backend/src/database/services/usager/constants/USAGER_LIGHT_ATTRIBUTES.const.ts +++ b/packages/backend/src/database/services/usager/constants/USAGER_LIGHT_ATTRIBUTES.const.ts @@ -23,6 +23,7 @@ export const USAGER_LIGHT_ATTRIBUTES: (keyof Usager)[] = [ "lastInteraction", "options", "historique", + "referrerId", "ayantsDroits", //"villeNaissance", "telephone", diff --git a/packages/backend/src/database/services/user-structure/userStructureRepository.service.ts b/packages/backend/src/database/services/user-structure/userStructureRepository.service.ts index 3bcdc7de4a..a3dc330213 100644 --- a/packages/backend/src/database/services/user-structure/userStructureRepository.service.ts +++ b/packages/backend/src/database/services/user-structure/userStructureRepository.service.ts @@ -1,8 +1,11 @@ import { In } from "typeorm"; -import { UserStructureProfile } from "../../../_common/model"; import { UserStructureTable } from "../../entities"; import { myDataSource } from "../_postgres"; -import { UserStructureRole, UserStructure } from "@domifa/common"; +import { + UserStructureRole, + UserStructure, + UserStructureProfile, +} from "@domifa/common"; export type AppUserForAdminEmail = Pick< UserStructure, @@ -12,6 +15,29 @@ export type AppUserForAdminEmail = Pick< export const userStructureRepository = myDataSource .getRepository(UserStructureTable) .extend({ + getVerifiedUsersByStructureId( + structureId: number + ): Promise { + return userStructureRepository.find({ + where: { + structureId, + }, + select: { + uuid: true, + id: true, + role: true, + nom: true, + prenom: true, + email: true, + createdAt: true, + lastLogin: true, + verified: true, + }, + order: { + nom: "ASC", + }, + }); + }, findVerifiedStructureUsersByRoles({ structureId, roles, diff --git a/packages/backend/src/usagers/controllers/agenda.controller.ts b/packages/backend/src/usagers/controllers/agenda.controller.ts index e041c1eabb..a0b70f5ecd 100644 --- a/packages/backend/src/usagers/controllers/agenda.controller.ts +++ b/packages/backend/src/usagers/controllers/agenda.controller.ts @@ -23,10 +23,7 @@ import { usagerRepository, } from "../../database"; import { ExpressResponse } from "../../util/express"; -import { - UserStructureAuthenticated, - UserStructureProfile, -} from "../../_common/model"; +import { UserStructureAuthenticated } from "../../_common/model"; import { RdvDto } from "../dto/decision-form/rdv.dto"; import { UsagersService } from "../services/usagers.service"; import { getUsagerNomComplet, Usager } from "@domifa/common"; @@ -39,18 +36,6 @@ import { usagerAppointmentCreatedEmailSender } from "../../modules/mails/service export class AgendaController { constructor(private readonly usagersService: UsagersService) {} - @Get("users") - @ApiOperation({ summary: "Liste des utilisateurs pour l'agenda" }) - @AllowUserStructureRoles("simple", "responsable", "admin") - public getAllUsersForAgenda( - @CurrentUser() currentUser: UserStructureAuthenticated - ): Promise { - return userStructureRepository.findVerifiedStructureUsersByRoles({ - structureId: currentUser.structureId, - roles: ["admin", "simple", "responsable"], - }); - } - @Get("") @ApiOperation({ summary: "Liste des rendez-vous à venir" }) @AllowUserStructureRoles("simple", "responsable", "admin") diff --git a/packages/backend/src/usagers/controllers/export-structure-usagers.controller.ts b/packages/backend/src/usagers/controllers/export-structure-usagers.controller.ts index 67883b7a1e..f38c39392e 100644 --- a/packages/backend/src/usagers/controllers/export-structure-usagers.controller.ts +++ b/packages/backend/src/usagers/controllers/export-structure-usagers.controller.ts @@ -28,6 +28,7 @@ import { AppLogsService } from "../../modules/app-logs/app-logs.service"; import { domifaConfig } from "../../config"; import { UsagersFilterCriteriaStatut } from "@domifa/common"; +import { userStructureRepository } from "../../database"; let lastCpuUsage = process.cpuUsage(); let lastTime = Date.now(); @@ -91,6 +92,9 @@ export class ExportStructureUsagersController { const workbook = XLSX.utils.book_new(); + const users = await userStructureRepository.getVerifiedUsersByStructureId( + user.structureId + ); const { firstSheetHeaders, secondSheetHeaders } = renderStructureUsagersHeaders(user.structure); @@ -128,7 +132,7 @@ export class ExportStructureUsagersController { logProcessState(`Processing chunk (${currentRowUsagers}/${count})`); const { firstSheetUsagers, secondSheetEntretiens } = - renderStructureUsagersRows(chunk, user.structure); + renderStructureUsagersRows(chunk, user.structure, users); // Application du format des dates applyDateFormat(firstSheetUsagers, [ diff --git a/packages/backend/src/usagers/controllers/import/step3-create/usagersImportCreator.service.ts b/packages/backend/src/usagers/controllers/import/step3-create/usagersImportCreator.service.ts index 0ffe7b5e49..002800985e 100644 --- a/packages/backend/src/usagers/controllers/import/step3-create/usagersImportCreator.service.ts +++ b/packages/backend/src/usagers/controllers/import/step3-create/usagersImportCreator.service.ts @@ -1,4 +1,3 @@ -import { usagerHistoryStatesRepository } from "./../../../../database/services/usager/usagerHistoryStatesRepository.service"; import { ImportProcessTracker } from "../ImportProcessTracker.type"; import { UsagersImportUsager } from "../step2-validate-row"; import { usagersImportBuilder } from "./usagersImportBuilder.service"; @@ -8,11 +7,13 @@ import { usagerRepository, usagerEntretienRepository, UsagerEntretienTable, + usagerHistoryStatesRepository, } from "../../../../database"; -import { UserStructure } from "../../../../_common/model"; -import { usagersCreator } from "../../../services"; -import { UsagerHistoryStateService } from "../../../services/usagerHistoryState.service"; + +import { UsagerHistoryStateService, usagersCreator } from "../../../services"; + import { Injectable } from "@nestjs/common"; +import { UserStructure } from "@domifa/common"; @Injectable() export class ImportCreatorService { diff --git a/packages/backend/src/usagers/controllers/search-usagers.controller.ts b/packages/backend/src/usagers/controllers/search-usagers.controller.ts new file mode 100644 index 0000000000..7669ff9044 --- /dev/null +++ b/packages/backend/src/usagers/controllers/search-usagers.controller.ts @@ -0,0 +1,212 @@ +import { + Usager, + UsagerDecision, + CriteriaSearchField, + getUsagerDeadlines, + ETAPE_ENTRETIEN, +} from "@domifa/common"; +import { + Body, + Controller, + Get, + ParseBoolPipe, + Post, + Query, + UseGuards, +} from "@nestjs/common"; +import { AuthGuard } from "@nestjs/passport"; +import { ApiBearerAuth } from "@nestjs/swagger"; +import { format, parse, subMinutes } from "date-fns"; +import { Not } from "typeorm"; +import { + USER_STRUCTURE_ROLE_ALL, + UserStructureAuthenticated, +} from "../../_common/model"; +import { AllowUserStructureRoles, CurrentUser } from "../../auth/decorators"; +import { AppUserGuard } from "../../auth/guards"; +import { + usagerRepository, + USAGER_LIGHT_ATTRIBUTES, + joinSelectFields, +} from "../../database"; + +import { SearchUsagerDto } from "../dto"; + +@Controller("search-usagers") +@UseGuards(AuthGuard("jwt"), AppUserGuard) +@ApiBearerAuth() +export class SearchUsagersController { + @Get() + @AllowUserStructureRoles(...USER_STRUCTURE_ROLE_ALL) + public async findAllByStructure( + @Query("chargerTousRadies", new ParseBoolPipe()) + chargerTousRadies: boolean, + @CurrentUser() user: UserStructureAuthenticated + ) { + const usagersNonRadies = await usagerRepository.find({ + where: { + statut: Not("RADIE"), + structureId: user.structureId, + }, + select: USAGER_LIGHT_ATTRIBUTES, + }); + + const usagersRadiesFirsts = await usagerRepository.find({ + where: { + statut: "RADIE", + structureId: user.structureId, + }, + select: USAGER_LIGHT_ATTRIBUTES, + take: chargerTousRadies ? undefined : 1600, + }); + + const usagersRadiesTotalCount = chargerTousRadies + ? usagersRadiesFirsts.length + : await usagerRepository.count({ + where: { + statut: "RADIE", + structureId: user.structureId, + }, + }); + + const filterHistorique = (usager: Usager) => { + if (usager.historique && Array.isArray(usager.historique)) { + usager.historique = usager.historique.map((item: UsagerDecision) => ({ + statut: item.statut, + dateDecision: item.dateDecision, + dateDebut: item.dateDebut, + dateFin: item.dateFin, + })) as UsagerDecision[]; + } + return usager; + }; + + const usagersMerges = [...usagersNonRadies, ...usagersRadiesFirsts].map( + filterHistorique + ); + + return { + usagersRadiesTotalCount, + usagers: usagersMerges, + }; + } + + @Get("update-manage") + @AllowUserStructureRoles(...USER_STRUCTURE_ROLE_ALL) + public async updateManage(@CurrentUser() user: UserStructureAuthenticated) { + return await usagerRepository + .createQueryBuilder() + .select(joinSelectFields(USAGER_LIGHT_ATTRIBUTES)) + .where( + `"structureId" = :structureId AND "updatedAt" >= :fiveMinutesAgo`, + { + structureId: user.structureId, + fiveMinutesAgo: subMinutes(new Date(), 5), + } + ) + .getRawMany(); + } + + @Post("search-radies") + @AllowUserStructureRoles(...USER_STRUCTURE_ROLE_ALL) + public async searchInRadies( + @Body() search: SearchUsagerDto, + @CurrentUser() user: UserStructureAuthenticated + ) { + const query = usagerRepository + .createQueryBuilder("usager") + .select(joinSelectFields(USAGER_LIGHT_ATTRIBUTES)) + .where(`"structureId" = :structureId and statut = 'RADIE'`, { + structureId: user.structureId, + }); + + if (search.searchString) { + if (search.searchStringField === CriteriaSearchField.DEFAULT) { + query.andWhere("nom_prenom_surnom_ref ILIKE :str", { + str: `%${search.searchString}%`, + }); + } else if (search.searchStringField === CriteriaSearchField.BIRTH_DATE) { + const formattedDate = format( + parse(search.searchString, "ddMMyyyy", new Date()), + "yyyy-MM-dd" + ); + query.andWhere(`DATE("dateNaissance") = DATE(:date)`, { + date: formattedDate, + }); + } else if ( + search.searchStringField === CriteriaSearchField.PHONE_NUMBER + ) { + query.andWhere(`telephone->>'numero' ILIKE :phone`, { + phone: `%${search.searchString}%`, + }); + } + } + + if (search?.lastInteractionDate) { + const deadlines = getUsagerDeadlines(); + const date = deadlines[search.lastInteractionDate].value; + + query.andWhere( + `("lastInteraction"->>'dateInteraction')::timestamp >= :dateRef::timestamp`, + { + dateRef: date, + } + ); + } + + if (typeof search?.referrerId !== "undefined") { + query.andWhere( + search.referrerId === null + ? `"referrerId" IS NULL` + : `"referrerId" = :referrerId`, + { referrerId: search.referrerId } + ); + } + + if (search?.entretien) { + query.andWhere( + `rdv->>'dateRdv' IS NOT NULL AND "etapeDemande" <= :step AND (rdv->>'dateRdv')::date ${ + search.entretien === "COMING" ? ">" : "<" + } CURRENT_DATE`, + { step: ETAPE_ENTRETIEN } + ); + } + + if (search?.echeance) { + const deadlines = getUsagerDeadlines(); + const now = new Date(); + const deadline = deadlines[search.echeance]; + + if (search.echeance === "EXCEEDED") { + query.andWhere(`(decision->>'dateDecision')::timestamp < :now`, { + now, + }); + } else if (search.echeance.startsWith("NEXT_")) { + query.andWhere( + `(decision->>'dateDecision')::timestamp <= :deadline AND (decision->>'dateDecision')::timestamp > :now`, + { + deadline: deadline.value, + now, + } + ); + } else if (search?.echeance.startsWith("PREVIOUS_")) { + query.andWhere(`(decision->>'dateDecision')::timestamp < :deadline`, { + deadline: deadline.value, + now, + }); + } + } + + if ( + !search.searchString && + !search?.echeance && + !search?.entretien && + typeof search?.referrerId !== "undefined" && + !search?.lastInteractionDate + ) { + query.take(100); + } + + return await query.getRawMany(); + } +} diff --git a/packages/backend/src/usagers/controllers/security-tests/agenda.controller.security-tests.ts b/packages/backend/src/usagers/controllers/security-tests/agenda.controller.security-tests.ts index 25e0a9dc72..d0fe41face 100644 --- a/packages/backend/src/usagers/controllers/security-tests/agenda.controller.security-tests.ts +++ b/packages/backend/src/usagers/controllers/security-tests/agenda.controller.security-tests.ts @@ -28,18 +28,4 @@ export const AgendaControllerSecurityTests: AppTestHttpClientSecurityTestDef[] = ), }), }, - { - label: `${CONTROLLER}.getAllUsersForAgenda`, - query: async (context: AppTestContext) => ({ - response: await AppTestHttpClient.get("/agenda/users", { - context, - }), - expectedStatus: expectedResponseStatusBuilder.allowStructureOnly( - context.user, - { - roles: ["simple", "responsable", "admin"], - } - ), - }), - }, ]; diff --git a/packages/backend/src/usagers/controllers/security-tests/search-usagers.controller.security-tests.ts b/packages/backend/src/usagers/controllers/security-tests/search-usagers.controller.security-tests.ts new file mode 100644 index 0000000000..423faa0408 --- /dev/null +++ b/packages/backend/src/usagers/controllers/security-tests/search-usagers.controller.security-tests.ts @@ -0,0 +1,35 @@ +import { AppTestContext, AppTestHttpClient } from "../../../util/test"; +import { USER_STRUCTURE_ROLE_ALL } from "../../../_common/model"; +import { + AppTestHttpClientSecurityTestDef, + expectedResponseStatusBuilder, +} from "../../../_tests"; + +////////////////// IMPORTANT ////////////////// +// +// Ce fichier doit être importé dans : +// - API_SECURITY_STRUCTURE_CONTROLLER_TEST_DEFS +// + +const CONTROLLER = "SearchUsagersController"; + +export const UsagersControllerSecurityTests: AppTestHttpClientSecurityTestDef[] = + [ + { + label: `${CONTROLLER}.findAllByStructure`, + query: async (context: AppTestContext) => ({ + response: await AppTestHttpClient.get( + "/usagers?chargerTousRadies=false", + { + context, + } + ), + expectedStatus: expectedResponseStatusBuilder.allowStructureOnly( + context.user, + { + roles: USER_STRUCTURE_ROLE_ALL, + } + ), + }), + }, + ]; diff --git a/packages/backend/src/usagers/controllers/security-tests/usagers.controller.security-tests.ts b/packages/backend/src/usagers/controllers/security-tests/usagers.controller.security-tests.ts index 41798ac9a9..08050d6885 100644 --- a/packages/backend/src/usagers/controllers/security-tests/usagers.controller.security-tests.ts +++ b/packages/backend/src/usagers/controllers/security-tests/usagers.controller.security-tests.ts @@ -1,6 +1,5 @@ import { HttpStatus } from "@nestjs/common"; import { AppTestContext, AppTestHttpClient } from "../../../util/test"; -import { USER_STRUCTURE_ROLE_ALL } from "../../../_common/model"; import { AppTestHttpClientSecurityTestDef, expectedResponseStatusBuilder, @@ -16,23 +15,6 @@ const CONTROLLER = "UsagersController"; export const UsagersControllerSecurityTests: AppTestHttpClientSecurityTestDef[] = [ - { - label: `${CONTROLLER}.findAllByStructure`, - query: async (context: AppTestContext) => ({ - response: await AppTestHttpClient.get( - "/usagers?chargerTousRadies=false", - { - context, - } - ), - expectedStatus: expectedResponseStatusBuilder.allowStructureOnly( - context.user, - { - roles: USER_STRUCTURE_ROLE_ALL, - } - ), - }), - }, { label: `${CONTROLLER}.checkDuplicates`, query: async (context: AppTestContext) => ({ diff --git a/packages/backend/src/usagers/controllers/tests/search-usagers.controller.spec.ts b/packages/backend/src/usagers/controllers/tests/search-usagers.controller.spec.ts new file mode 100644 index 0000000000..0ef168c9fa --- /dev/null +++ b/packages/backend/src/usagers/controllers/tests/search-usagers.controller.spec.ts @@ -0,0 +1,132 @@ +import { SearchUsagersController } from "../search-usagers.controller"; +import { TESTS_USERS_STRUCTURE } from "../../../_tests"; +import { UsersModule } from "../../../users/users.module"; +import { + AppTestContext, + AppTestHelper, + AppTestHttpClient, +} from "../../../util/test"; +import { UsagersModule } from "../../usagers.module"; +import { CriteriaSearchField } from "@domifa/common"; + +describe("SearchUsagersController", () => { + let controller: SearchUsagersController; + let context: AppTestContext; + + afterAll(async () => { + await AppTestHelper.tearDownTestApp(context); + }); + + beforeAll(async () => { + context = await AppTestHelper.bootstrapTestApp( + { + controllers: [SearchUsagersController], + imports: [UsagersModule, UsersModule], + }, + { initApp: true } + ); + + const authInfo = + TESTS_USERS_STRUCTURE.BY_EMAIL["preprod.domifa@fabrique.social.gouv.fr"]; + await AppTestHelper.authenticateStructure(authInfo, { context }); + + controller = context.module.get( + SearchUsagersController + ); + }); + + it("should be defined", () => { + expect(controller).toBeDefined(); + }); + + it("should search with all parameters", async () => { + const response = await AppTestHttpClient.post( + "/search-usagers/search-radies", + { + context, + body: { + searchString: "dupuis", + searchStringField: CriteriaSearchField.DEFAULT, + echeance: "NEXT_TWO_WEEKS", + lastInteractionDate: "PREVIOUS_TWO_MONTHS", + entretien: "COMING", + referrerId: 42, + }, + } + ).expect(201); + + expect(response.body).toBeDefined(); + }); + + it("should search with null referrerId", async () => { + const response = await AppTestHttpClient.post( + "/search-usagers/search-radies", + { + context, + body: { + searchString: " DIé", + searchStringField: CriteriaSearchField.DEFAULT, + referrerId: null, + }, + } + ).expect(201); + expect(response.body).toBeDefined(); + expect(response.body.length).toEqual(1); + expect(response.body[0].nom).toEqual("Rara"); + }); + + it("should handle phone number search", async () => { + const response = await AppTestHttpClient.post( + "/search-usagers/search-radies", + { + context, + body: { + searchString: "06. 06-06/06-06", + searchStringField: CriteriaSearchField.PHONE_NUMBER, + }, + } + ).expect(201); + + expect(response.body).toBeDefined(); + expect(response.body.length).toEqual(1); + expect(response.body[0].nom).toEqual("Loumiel"); + }); + + it("should handle birth date search", async () => { + const response = await AppTestHttpClient.post( + "/search-usagers/search-radies", + { + context, + body: { + searchString: "18/04/1990", + searchStringField: CriteriaSearchField.BIRTH_DATE, + }, + } + ).expect(201); + + expect(response.body).toBeDefined(); + expect(response.body.length).toEqual(1); + expect(response.body[0].nom).toEqual("Loumiel"); + }); + + it("should reject invalid birth date", async () => { + await AppTestHttpClient.post("/search-usagers/search-radies", { + context, + body: { + searchString: "32/13/1999", + searchStringField: CriteriaSearchField.BIRTH_DATE, + }, + }).expect(400); + }); + + it("should reject invalid echeance value", async () => { + await AppTestHttpClient.post("/search-usagers/search-radies", { + context, + body: { + searchString: "dupuis", + searchStringField: CriteriaSearchField.DEFAULT, + echeance: "INVALID_VALUE", + }, + }).expect(400); + }); +}); diff --git a/packages/backend/src/usagers/controllers/tests/usagers.controller.spec.ts b/packages/backend/src/usagers/controllers/tests/usagers.controller.spec.ts index bc0314d767..344016636a 100644 --- a/packages/backend/src/usagers/controllers/tests/usagers.controller.spec.ts +++ b/packages/backend/src/usagers/controllers/tests/usagers.controller.spec.ts @@ -77,11 +77,9 @@ describe("Usagers Controller", () => { expect(new Date(usager.decision.dateDecision)).toEqual(new Date()); expect(new Date(usager.historique[0].dateDecision)).toEqual(new Date()); - // Type de dom expect(usager.typeDom).toEqual("PREMIERE_DOM"); expect(usager.decision.typeDom).toEqual("PREMIERE_DOM"); expect(usager.historique[0].typeDom).toEqual("PREMIERE_DOM"); - // Trim et nettoyage des données expect(usager.nom).toEqual(exceptedResponse.nom); expect(usager.prenom).toEqual(exceptedResponse.prenom); diff --git a/packages/backend/src/usagers/controllers/usager-structure-docs.controller.ts b/packages/backend/src/usagers/controllers/usager-structure-docs.controller.ts index 1dc398ef5b..317b6c77d0 100644 --- a/packages/backend/src/usagers/controllers/usager-structure-docs.controller.ts +++ b/packages/backend/src/usagers/controllers/usager-structure-docs.controller.ts @@ -19,7 +19,10 @@ import { CurrentUsager } from "../../auth/decorators/current-usager.decorator"; import { CurrentUser } from "../../auth/decorators/current-user.decorator"; import { AppUserGuard } from "../../auth/guards"; import { UsagerAccessGuard } from "../../auth/guards/usager-access.guard"; -import { structureDocRepository } from "../../database"; +import { + structureDocRepository, + userStructureRepository, +} from "../../database"; import { UserStructureAuthenticated } from "../../_common/model"; import { buildCustomDoc, @@ -62,6 +65,9 @@ export class UsagerStructureDocsController { uuid: structureDocUuid, }); + const users = await userStructureRepository.getVerifiedUsersByStructureId( + user.structureId + ); if (!doc) { return res .status(HttpStatus.BAD_REQUEST) @@ -98,6 +104,7 @@ export class UsagerStructureDocsController { structure: user.structure, date: new Date(), extraParameters: null, + users, }); try { @@ -136,6 +143,9 @@ export class UsagerStructureDocsController { let content = ""; + const users = await userStructureRepository.getVerifiedUsersByStructureId( + user.structureId + ); if (doc) { const filePath = join( "structure-documents", @@ -172,6 +182,7 @@ export class UsagerStructureDocsController { structure: user.structure, extraParameters, date: new Date(), + users, }); if (docType === "acces_espace_domicilie") { diff --git a/packages/backend/src/usagers/controllers/usagers.controller.ts b/packages/backend/src/usagers/controllers/usagers.controller.ts index 1784d8abe8..4d8003a898 100644 --- a/packages/backend/src/usagers/controllers/usagers.controller.ts +++ b/packages/backend/src/usagers/controllers/usagers.controller.ts @@ -5,12 +5,10 @@ import { Get, HttpStatus, Param, - ParseBoolPipe, ParseEnumPipe, ParseIntPipe, Patch, Post, - Query, Res, UseGuards, } from "@nestjs/common"; @@ -25,7 +23,6 @@ import { AppUserGuard } from "../../auth/guards"; import { UsagerAccessGuard } from "../../auth/guards/usager-access.guard"; import { usagerRepository, - USAGER_LIGHT_ATTRIBUTES, joinSelectFields, messageSmsRepository, usagerDocsRepository, @@ -43,7 +40,6 @@ import { EntretienDto, ContactDetailsDto, } from "../dto"; -import { SearchUsagerDto } from "../dto/search-usager.dto"; import { UsagersService } from "../services"; import { AppLogsService } from "../../modules/app-logs/app-logs.service"; import { generateCerfaData } from "../services/cerfa"; @@ -53,19 +49,10 @@ import pdftk = require("node-pdftk"); import { join, resolve } from "path"; import { readFile } from "fs-extra"; import { ExpressResponse } from "../../util/express"; -import { - Usager, - ETAPE_DOCUMENTS, - CerfaDocType, - UsagerDecision, - getUsagerDeadlines, - CriteriaSearchField, -} from "@domifa/common"; +import { Usager, ETAPE_DOCUMENTS, CerfaDocType } from "@domifa/common"; import { UsagerHistoryStateService } from "../services/usagerHistoryState.service"; import { domifaConfig } from "../../config"; import { FileManagerService } from "../../util/file-manager/file-manager.service"; -import { Not } from "typeorm"; -import { subMinutes } from "date-fns"; @Controller("usagers") @ApiTags("usagers") @@ -79,156 +66,6 @@ export class UsagersController { private readonly fileManagerService: FileManagerService ) {} - @Get() - @AllowUserStructureRoles(...USER_STRUCTURE_ROLE_ALL) - public async findAllByStructure( - @Query("chargerTousRadies", new ParseBoolPipe()) - chargerTousRadies: boolean, - @CurrentUser() user: UserStructureAuthenticated - ) { - const usagersNonRadies = await usagerRepository.find({ - where: { - statut: Not("RADIE"), - structureId: user.structureId, - }, - select: USAGER_LIGHT_ATTRIBUTES, - }); - - const usagersRadiesFirsts = await usagerRepository.find({ - where: { - statut: "RADIE", - structureId: user.structureId, - }, - select: USAGER_LIGHT_ATTRIBUTES, - take: chargerTousRadies ? undefined : 1600, - }); - - const usagersRadiesTotalCount = chargerTousRadies - ? usagersRadiesFirsts.length - : await usagerRepository.count({ - where: { - statut: "RADIE", - structureId: user.structureId, - }, - }); - - const filterHistorique = (usager: Usager) => { - if (usager.historique && Array.isArray(usager.historique)) { - usager.historique = usager.historique.map((item: UsagerDecision) => ({ - statut: item.statut, - dateDecision: item.dateDecision, - dateDebut: item.dateDebut, - dateFin: item.dateFin, - })) as UsagerDecision[]; - } - return usager; - }; - - const usagersMerges = [...usagersNonRadies, ...usagersRadiesFirsts].map( - filterHistorique - ); - - return { - usagersRadiesTotalCount, - usagers: usagersMerges, - }; - } - - @Get("update-manage") - @AllowUserStructureRoles(...USER_STRUCTURE_ROLE_ALL) - public async updateManage(@CurrentUser() user: UserStructureAuthenticated) { - return await usagerRepository - .createQueryBuilder() - .select(joinSelectFields(USAGER_LIGHT_ATTRIBUTES)) - .where( - `"structureId" = :structureId AND "updatedAt" >= :fiveMinutesAgo`, - { - structureId: user.structureId, - fiveMinutesAgo: subMinutes(new Date(), 5), - } - ) - .getRawMany(); - } - - @Post("search-radies") - @AllowUserStructureRoles(...USER_STRUCTURE_ROLE_ALL) - public async searchInRadies( - @Body() search: SearchUsagerDto, - @CurrentUser() user: UserStructureAuthenticated - ) { - const query = usagerRepository - .createQueryBuilder("usager") - .select(joinSelectFields(USAGER_LIGHT_ATTRIBUTES)) - .where(`"structureId" = :structureId and statut = 'RADIE'`, { - structureId: user.structureId, - }); - - if (search.searchString) { - if (search.searchStringField === CriteriaSearchField.DEFAULT) { - query.andWhere("nom_prenom_surnom_ref ILIKE :str", { - str: `%${search.searchString}%`, - }); - } else if (search.searchStringField === CriteriaSearchField.BIRTH_DATE) { - query.andWhere(`DATE("dateNaissance") = DATE(:date)`, { - date: search.searchString, - }); - } else if ( - search.searchStringField === CriteriaSearchField.PHONE_NUMBER - ) { - query.andWhere(`telephone->>'numero' ILIKE :phone`, { - phone: `%${search.searchString}%`, - }); - } - } - - if (search?.lastInteractionDate) { - const deadlines = getUsagerDeadlines(); - const date = deadlines[search.lastInteractionDate].value; - - query.andWhere( - `("lastInteraction"->>'dateInteraction')::timestamp >= :date`, - { - date, - } - ); - } - - if (search?.echeance) { - const deadlines = getUsagerDeadlines(); - const now = new Date(); - const deadline = deadlines[search.echeance]; - - if (search.echeance === "EXCEEDED") { - query.andWhere(`(decision->>'dateDecision')::timestamp < :now`, { - now, - }); - } else if (search.echeance.startsWith("NEXT_")) { - query.andWhere( - `(decision->>'dateDecision')::timestamp <= :deadline AND (decision->>'dateDecision')::timestamp > :now`, - { - deadline: deadline.value, - now, - } - ); - } else if (search?.echeance.startsWith("PREVIOUS_")) { - query.andWhere(`(decision->>'dateDecision')::timestamp < :deadline`, { - deadline: deadline.value, - now, - }); - } - } - - if ( - !search.searchString && - !search?.echeance && - !search?.lastInteractionDate - ) { - query.take(100); - } - - return await query.getRawMany(); - } - @Post() @AllowUserStructureRoles("simple", "responsable", "admin") public createUsager( diff --git a/packages/backend/src/usagers/dto/UsagerAyantDroitDto.ts b/packages/backend/src/usagers/dto/UsagerAyantDroitDto.ts index 4bd8304722..5113a9f1e3 100644 --- a/packages/backend/src/usagers/dto/UsagerAyantDroitDto.ts +++ b/packages/backend/src/usagers/dto/UsagerAyantDroitDto.ts @@ -51,6 +51,7 @@ export class UsagerAyantDroitDto { example: "20/12/2002", description: "Date de naissance de l'ayant-droit", type: Date, + required: true, }) @IsNotEmpty() @IsDateString() diff --git a/packages/backend/src/usagers/dto/decision-form/create-usager.dto.ts b/packages/backend/src/usagers/dto/decision-form/create-usager.dto.ts index 9d164afbac..467b06e49a 100644 --- a/packages/backend/src/usagers/dto/decision-form/create-usager.dto.ts +++ b/packages/backend/src/usagers/dto/decision-form/create-usager.dto.ts @@ -19,6 +19,7 @@ import { IsArray, ValidateIf, ValidateNested, + IsNumber, } from "class-validator"; import { Trim, @@ -128,6 +129,8 @@ export class CreateUsagerDto { public customRef!: string; @ApiProperty({ + required: false, + type: "string", example: "test@test.fr", description: "Email du domicilié", }) @@ -137,6 +140,16 @@ export class CreateUsagerDto { @LowerCaseTransform() public email!: string; + @ApiProperty({ + required: false, + example: 10, + type: Number, + description: "Id du référent", + }) + @IsOptional() + @IsNumber() + public referrerId!: number; + @ApiProperty({ type: Object, required: false, diff --git a/packages/backend/src/usagers/dto/search-usager.dto.ts b/packages/backend/src/usagers/dto/search-usager.dto.ts index eee69f646e..05c3c3f36e 100644 --- a/packages/backend/src/usagers/dto/search-usager.dto.ts +++ b/packages/backend/src/usagers/dto/search-usager.dto.ts @@ -1,54 +1,47 @@ import { ApiProperty } from "@nestjs/swagger"; -import { IsIn, IsOptional, IsString, MinLength } from "class-validator"; import { - LowerCaseTransform, - StripTagsTransform, -} from "../../_common/decorators"; + IsIn, + IsNumber, + IsOptional, + IsString, + MinLength, + ValidateIf, +} from "class-validator"; import { CriteriaSearchField, normalizeString, UsagersFilterCriteriaDernierPassage, UsagersFilterCriteriaEcheance, + UsagersFilterCriteriaEntretien, } from "@domifa/common"; import { Transform } from "class-transformer"; -import { isValid, parse } from "date-fns"; -import { BadRequestException } from "@nestjs/common"; +import { ValidateSearchField } from "../utils"; export class SearchUsagerDto { @ApiProperty({ example: "dupuis", description: "Nom ou prénom", }) - @IsOptional() - @IsString() - @MinLength(1) - @StripTagsTransform() - @LowerCaseTransform() @Transform(({ value, obj }) => { if (!value) { return null; } - switch (obj.searchStringField) { - case CriteriaSearchField.PHONE_NUMBER: - return value.replace(/\D/g, ""); - - case CriteriaSearchField.BIRTH_DATE: - const cleanDate = value.replace(/\D/g, ""); - const parsedDate = parse(cleanDate, "ddMMyyyy", new Date()); - - if (!isValid(parsedDate)) { - throw new BadRequestException( - 'Format de date invalide. Utilisez le format "dd/MM/yyyy"' - ); - } - return cleanDate; - - case CriteriaSearchField.DEFAULT: - default: - return normalizeString(value).trim(); + if ( + [ + CriteriaSearchField.PHONE_NUMBER, + CriteriaSearchField.BIRTH_DATE, + ].includes(obj.searchStringField) + ) { + return value.replace(/\D/g, ""); } + + return normalizeString(value).trim(); }) + @ValidateIf((obj) => obj.searchStringField) + @IsString() + @MinLength(1) + @ValidateSearchField() public searchString!: string; @IsIn(Object.values(CriteriaSearchField)) @@ -67,4 +60,13 @@ export class SearchUsagerDto { @IsIn(["PREVIOUS_TWO_MONTHS", "PREVIOUS_THREE_MONTHS"]) @IsOptional() public readonly lastInteractionDate: UsagersFilterCriteriaDernierPassage; + + @IsIn(Object.values(UsagersFilterCriteriaEntretien)) + @IsOptional() + public readonly entretien: UsagersFilterCriteriaEntretien; + + @IsNumber() + @IsOptional() + @ValidateIf((_object, value) => value !== null) + public readonly referrerId: number | null; } diff --git a/packages/backend/src/usagers/services/custom-docs/buildCustomDoc.service.ts b/packages/backend/src/usagers/services/custom-docs/buildCustomDoc.service.ts index ad8cce4a05..1fecd35284 100644 --- a/packages/backend/src/usagers/services/custom-docs/buildCustomDoc.service.ts +++ b/packages/backend/src/usagers/services/custom-docs/buildCustomDoc.service.ts @@ -15,6 +15,7 @@ import { UsagerOptionsProcuration, Usager, ENTRETIEN_LIEN_COMMUNE, + UserStructureProfile, } from "@domifa/common"; import { StructureCustomDocKeys, @@ -40,6 +41,7 @@ export function buildCustomDoc({ structure, date, extraParameters = null, + users, }: { usager: Usager; structure: StructureCommon; @@ -48,6 +50,7 @@ export function buildCustomDoc({ ESPACE_DOM_ID: string; ESPACE_DOM_MDP: string; } | null; + users: Pick[]; }): { [key in StructureCustomDocKeys]: string | Date | number; } { @@ -135,6 +138,7 @@ export function buildCustomDoc({ ...buildEntretienForDocs(usager), ...buildDecision(usager, structure, DATE_FORMAT.JOUR_LONG), ...buildMonDomifaForDocs(usager, extraParameters), + REFERENT: buildReferrer(usager, users), SMS_ACTIVATION: formatBoolean(usager.contactByPhone), // Transferts @@ -171,6 +175,18 @@ export function buildCustomDoc({ }; } +export const buildReferrer = ( + usager: Pick, + users: Pick[] +): string => { + if (!usager.referrerId) { + return ""; + } + + const referrer = users.find((user) => user.id === usager.referrerId); + return referrer ? `${referrer.nom} ${referrer.prenom}` : "Compte supprimé"; +}; + export const buildDecision = ( usager: Pick< Usager, diff --git a/packages/backend/src/usagers/services/custom-docs/tests/CUSTOM_DOC_ATTESTATION_POSTALE.const.ts b/packages/backend/src/usagers/services/custom-docs/tests/CUSTOM_DOC_ATTESTATION_POSTALE.const.ts index d9cfbab7c6..1ee33960a3 100644 --- a/packages/backend/src/usagers/services/custom-docs/tests/CUSTOM_DOC_ATTESTATION_POSTALE.const.ts +++ b/packages/backend/src/usagers/services/custom-docs/tests/CUSTOM_DOC_ATTESTATION_POSTALE.const.ts @@ -87,4 +87,5 @@ export const CUSTOM_DOC_ATTESTATION_POSTALE: StructureCustomDocTags = { PROCURATION_DATE_FIN: "", PROCURATION_DATE_NAISSANCE: "", PROCURATIONS_NOMBRE: 0, + REFERENT: "", }; diff --git a/packages/backend/src/usagers/services/custom-docs/tests/CUSTOM_DOC_COURRIER_REFUS.ts b/packages/backend/src/usagers/services/custom-docs/tests/CUSTOM_DOC_COURRIER_REFUS.ts index eb4ff53686..75eba7b418 100644 --- a/packages/backend/src/usagers/services/custom-docs/tests/CUSTOM_DOC_COURRIER_REFUS.ts +++ b/packages/backend/src/usagers/services/custom-docs/tests/CUSTOM_DOC_COURRIER_REFUS.ts @@ -40,7 +40,7 @@ export const CUSTOM_DOC_COURRIER_REFUS: StructureCustomDocTags = { DATE_PREMIERE_DOM: "11 janvier 2018", DATE_RADIATION: "", PREMIERE_DOM_NOM_AGENT: "", - + REFERENT: "", ENTRETIEN_ACCOMPAGNEMENT: "NON", ENTRETIEN_ACCOMPAGNEMENT_DETAIL: "", ENTRETIEN_ORIENTATION: "OUI", diff --git a/packages/backend/src/usagers/services/custom-docs/tests/buildCustomDoc.service.spec.ts b/packages/backend/src/usagers/services/custom-docs/tests/buildCustomDoc.service.spec.ts index c0f7856d3c..dff8df63df 100644 --- a/packages/backend/src/usagers/services/custom-docs/tests/buildCustomDoc.service.spec.ts +++ b/packages/backend/src/usagers/services/custom-docs/tests/buildCustomDoc.service.spec.ts @@ -4,6 +4,7 @@ import { STRUCTURE_MOCK, USAGER_REFUS_MOCK, USAGER_VALIDE_MOCK, + VERIFIED_USERS_STRUCTURE, } from "../../../../_common/mocks"; import { StructureCustomDocTags } from "../../../../_common/model"; @@ -29,6 +30,7 @@ describe("buildCustomDoc.service", () => { structure: STRUCTURE_MOCK, date, extraParameters, + users: [...VERIFIED_USERS_STRUCTURE], }); expect(docRadiation).toEqual({ @@ -46,6 +48,7 @@ describe("buildCustomDoc.service", () => { structure: STRUCTURE_MOCK, date, extraParameters: null, + users: [...VERIFIED_USERS_STRUCTURE], }); expect(docActif).toEqual(CUSTOM_DOC_ATTESTATION_POSTALE); @@ -63,6 +66,7 @@ describe("buildCustomDoc.service", () => { structure: STRUCTURE_MOCK, date, extraParameters: null, + users: [...VERIFIED_USERS_STRUCTURE], }); expect(docActif).toEqual(CUSTOM_DOC_COURRIER_REFUS); @@ -73,6 +77,7 @@ describe("buildCustomDoc.service", () => { structure: STRUCTURE_MOCK, date, extraParameters: null, + users: [...VERIFIED_USERS_STRUCTURE], }); expect(docNumeroDistribution.USAGER_NUMERO_DISTRIBUTION_SPECIALE).toEqual( @@ -118,6 +123,7 @@ describe("buildCustomDoc.service", () => { structure: STRUCTURE_MOCK, date, extraParameters: null, + users: [...VERIFIED_USERS_STRUCTURE], }); expect(customDocGenerated.TRANSFERT_ACTIF).toEqual("OUI"); @@ -163,6 +169,7 @@ describe("buildCustomDoc.service", () => { structure: STRUCTURE_MOCK, date, extraParameters: null, + users: [...VERIFIED_USERS_STRUCTURE], }); expect(testDoc.DATE_JOUR_HEURE).toEqual("12/04/2022 à 10:43"); @@ -182,6 +189,7 @@ describe("buildCustomDoc.service", () => { structure: STRUCTURE_MOCK, date, extraParameters: null, + users: [...VERIFIED_USERS_STRUCTURE], }); expect(testDoc.DATE_JOUR_HEURE).toEqual("23/03/2022 à 05:32"); diff --git a/packages/backend/src/usagers/services/usagers.service.ts b/packages/backend/src/usagers/services/usagers.service.ts index e823be5b3e..d22958fa19 100644 --- a/packages/backend/src/usagers/services/usagers.service.ts +++ b/packages/backend/src/usagers/services/usagers.service.ts @@ -5,11 +5,7 @@ import { usagerRepository, UsagerTable, } from "../../database"; -import { - UserStructure, - UserStructureProfile, - UserStructureAuthenticated, -} from "../../_common/model"; +import { UserStructureAuthenticated } from "../../_common/model"; import { usagersCreator } from "./usagersCreator.service"; import { usagerVisibleHistoryManager } from "./usagerVisibleHistoryManager.service"; @@ -27,6 +23,8 @@ import { UsagerDecision, Usager, UsagersFilterCriteriaStatut, + UserStructure, + UserStructureProfile, } from "@domifa/common"; import { UsagerHistoryStateService } from "./usagerHistoryState.service"; import { StructureUsagerExport } from "./xlsx-structure-usagers-renderer"; @@ -38,7 +36,7 @@ export class UsagersService { ) {} public async create( usagerDto: CreateUsagerDto, - user: UserStructureProfile + user: Pick ): Promise { const usager = new UsagerTable(usagerDto); usagersCreator.setUsagerDefaultAttributes(usager); diff --git a/packages/backend/src/usagers/services/usagersCreator.service.ts b/packages/backend/src/usagers/services/usagersCreator.service.ts index 14a2116ba2..9c26b24622 100644 --- a/packages/backend/src/usagers/services/usagersCreator.service.ts +++ b/packages/backend/src/usagers/services/usagersCreator.service.ts @@ -31,6 +31,7 @@ function setUsagerDefaultAttributes(usager: Partial): void { }; usager.typeDom = usager?.typeDom ?? "PREMIERE_DOM"; usager.pinnedNote = null; + usager.referrerId = null; if (!usager.ayantsDroits) { usager.ayantsDroits = []; diff --git a/packages/backend/src/usagers/services/xlsx-structure-usagers-renderer/renderStructureUsagersRows.ts b/packages/backend/src/usagers/services/xlsx-structure-usagers-renderer/renderStructureUsagersRows.ts index 83da926821..ee6cdd0d5b 100644 --- a/packages/backend/src/usagers/services/xlsx-structure-usagers-renderer/renderStructureUsagersRows.ts +++ b/packages/backend/src/usagers/services/xlsx-structure-usagers-renderer/renderStructureUsagersRows.ts @@ -1,4 +1,8 @@ -import { StructureCommon, UsagerAyantDroit } from "@domifa/common"; +import { + StructureCommon, + UsagerAyantDroit, + UserStructureProfile, +} from "@domifa/common"; import set from "lodash.set"; import { @@ -72,6 +76,8 @@ export const renderStructureUsagersHeaders = ( CUSTOM_DOCS_LABELS.ENTRETIEN_ORIENTATION_DETAIL, ENTRETIEN_DOMICILIATION_EXISTANTE: CUSTOM_DOCS_LABELS.ENTRETIEN_DOMICILIATION_EXISTANTE, + ENTRETIEN_SITUATION_PROFESSIONNELLE: + CUSTOM_DOCS_LABELS.ENTRETIEN_SITUATION_PROFESSIONNELLE, ENTRETIEN_REVENUS: CUSTOM_DOCS_LABELS.ENTRETIEN_REVENUS, ENTRETIEN_REVENUS_DETAIL: CUSTOM_DOCS_LABELS.ENTRETIEN_REVENUS_DETAIL, ENTRETIEN_LIEN_COMMUNE: CUSTOM_DOCS_LABELS.ENTRETIEN_LIEN_COMMUNE, @@ -85,8 +91,7 @@ export const renderStructureUsagersHeaders = ( ENTRETIEN_ACCOMPAGNEMENT_DETAIL: CUSTOM_DOCS_LABELS.ENTRETIEN_ACCOMPAGNEMENT_DETAIL, ENTRETIEN_RATTACHEMENT: CUSTOM_DOCS_LABELS.ENTRETIEN_RATTACHEMENT, - ENTRETIEN_SITUATION_PROFESSIONNELLE: - CUSTOM_DOCS_LABELS.ENTRETIEN_SITUATION_PROFESSIONNELLE, + ENTRETIEN_COMMENTAIRE: CUSTOM_DOCS_LABELS.ENTRETIEN_COMMENTAIRE, }; @@ -123,7 +128,8 @@ export const renderStructureUsagersHeaders = ( export const renderStructureUsagersRows = ( usagers: StructureUsagerExport[], - structure: StructureCommon + structure: StructureCommon, + users: Pick[] ): { firstSheetUsagers: StructureCustomDocTags[]; secondSheetEntretiens: StructureCustomDocTags[]; @@ -133,21 +139,23 @@ export const renderStructureUsagersRows = ( for (const usagerToExport of usagers) { try { + const firstPartOfData = buildCustomDoc({ + usager: { + ...usagerToExport, + structureId: structure.id, + contactByPhone: null, + etapeDemande: null, + statut: usagerToExport.decision.statut, + rdv: null, + pinnedNote: null, + }, + structure, + date: new Date(), + extraParameters: null, + users, + }); const customData = { - ...buildCustomDoc({ - usager: { - ...usagerToExport, - structureId: structure.id, - contactByPhone: null, - etapeDemande: null, - statut: usagerToExport.decision.statut, - rdv: null, - pinnedNote: null, - }, - structure, - date: new Date(), - extraParameters: null, - }), + ...firstPartOfData, ...buildDecision(usagerToExport, structure, DATE_FORMAT.JOUR), }; @@ -210,6 +218,7 @@ export const renderFirstSheetData = ( DATE_FIN_DOM: usager.DATE_FIN_DOM, DATE_PREMIERE_DOM: usager.DATE_PREMIERE_DOM, DATE_DERNIER_PASSAGE: usager.DATE_DERNIER_PASSAGE, + REFERENT: usager.REFERENT, AYANTS_DROITS_NOMBRE: usager.AYANTS_DROITS_NOMBRE, TRANSFERT_ACTIF: usager.TRANSFERT_ACTIF, TRANSFERT_NOM: usager.TRANSFERT_NOM, @@ -236,6 +245,8 @@ export const renderSecondSheetData = ( ENTRETIEN_ORIENTATION: usager.ENTRETIEN_ORIENTATION, ENTRETIEN_ORIENTATION_DETAIL: usager.ENTRETIEN_ORIENTATION_DETAIL, ENTRETIEN_DOMICILIATION_EXISTANTE: usager.ENTRETIEN_DOMICILIATION_EXISTANTE, + ENTRETIEN_SITUATION_PROFESSIONNELLE: + usager.ENTRETIEN_SITUATION_PROFESSIONNELLE, ENTRETIEN_REVENUS: usager.ENTRETIEN_REVENUS, ENTRETIEN_REVENUS_DETAIL: usager.ENTRETIEN_REVENUS_DETAIL, ENTRETIEN_LIEN_COMMUNE: usager.ENTRETIEN_LIEN_COMMUNE, @@ -246,8 +257,6 @@ export const renderSecondSheetData = ( ENTRETIEN_ACCOMPAGNEMENT: usager.ENTRETIEN_ACCOMPAGNEMENT, ENTRETIEN_ACCOMPAGNEMENT_DETAIL: usager.ENTRETIEN_ACCOMPAGNEMENT_DETAIL, ENTRETIEN_RATTACHEMENT: usager.ENTRETIEN_RATTACHEMENT, - ENTRETIEN_SITUATION_PROFESSIONNELLE: - usager.ENTRETIEN_SITUATION_PROFESSIONNELLE, ENTRETIEN_COMMENTAIRE: usager.ENTRETIEN_COMMENTAIRE, }; }; diff --git a/packages/backend/src/usagers/services/xlsx-structure-usagers-renderer/tests/FIRST_SHEET_USAGERS.mock.ts b/packages/backend/src/usagers/services/xlsx-structure-usagers-renderer/tests/FIRST_SHEET_USAGERS.mock.ts index 8fdebe759e..09341a0d27 100644 --- a/packages/backend/src/usagers/services/xlsx-structure-usagers-renderer/tests/FIRST_SHEET_USAGERS.mock.ts +++ b/packages/backend/src/usagers/services/xlsx-structure-usagers-renderer/tests/FIRST_SHEET_USAGERS.mock.ts @@ -34,6 +34,7 @@ export const FIRST_SHEET_USAGERS = [ TRANSFERT_NOM: "", MON_DOMIFA_ACTIVATION: "NON", SMS_ACTIVATION: "NON", + REFERENT: "", }, { AD_DATE_NAISSANCE_0: "20/12/1978", @@ -74,5 +75,6 @@ export const FIRST_SHEET_USAGERS = [ TRANSFERT_NOM: "", MON_DOMIFA_ACTIVATION: "NON", SMS_ACTIVATION: "NON", + REFERENT: "", }, ]; diff --git a/packages/backend/src/usagers/services/xlsx-structure-usagers-renderer/tests/renderStructureUsagersRows.spec.ts b/packages/backend/src/usagers/services/xlsx-structure-usagers-renderer/tests/renderStructureUsagersRows.spec.ts index c744fc3527..902270f79f 100644 --- a/packages/backend/src/usagers/services/xlsx-structure-usagers-renderer/tests/renderStructureUsagersRows.spec.ts +++ b/packages/backend/src/usagers/services/xlsx-structure-usagers-renderer/tests/renderStructureUsagersRows.spec.ts @@ -3,6 +3,7 @@ import { STRUCTURE_MOCK, USAGER_REFUS_MOCK, USAGER_VALIDE_MOCK, + VERIFIED_USERS_STRUCTURE, } from "../../../../_common/mocks"; import { renderStructureUsagersRows } from "../renderStructureUsagersRows"; import { FIRST_SHEET_USAGERS } from "./FIRST_SHEET_USAGERS.mock"; @@ -14,7 +15,11 @@ describe("renderStructureUsagersRows", () => { ]; it("Generate sheets", async () => { - const chips = renderStructureUsagersRows(usagers, STRUCTURE_MOCK); + const chips = renderStructureUsagersRows( + usagers, + STRUCTURE_MOCK, + VERIFIED_USERS_STRUCTURE + ); expect(chips.firstSheetUsagers.length).toEqual(2); expect(chips.firstSheetUsagers[0]).toEqual(FIRST_SHEET_USAGERS[0]); expect(chips.firstSheetUsagers[1]).toEqual(FIRST_SHEET_USAGERS[1]); diff --git a/packages/backend/src/usagers/usagers.module.ts b/packages/backend/src/usagers/usagers.module.ts index d0b689c47a..9b9225e5a4 100644 --- a/packages/backend/src/usagers/usagers.module.ts +++ b/packages/backend/src/usagers/usagers.module.ts @@ -23,6 +23,7 @@ import { ImportCreatorService } from "./controllers/import/step3-create"; import { FileManagerService } from "../util/file-manager/file-manager.service"; import { AppLogsService } from "../modules/app-logs/app-logs.service"; import { MailsModule } from "../modules/mails/mails.module"; +import { SearchUsagersController } from "./controllers/search-usagers.controller"; @Module({ controllers: [ @@ -35,6 +36,7 @@ import { MailsModule } from "../modules/mails/mails.module"; UsagerDocsController, ExportStructureUsagersController, UsagerOptionsController, + SearchUsagersController, ], exports: [UsagersService, UsagerHistoryStateService, ImportCreatorService], imports: [ diff --git a/packages/backend/src/usagers/utils/index.ts b/packages/backend/src/usagers/utils/index.ts new file mode 100644 index 0000000000..c727341e0c --- /dev/null +++ b/packages/backend/src/usagers/utils/index.ts @@ -0,0 +1,3 @@ +// @index('./*', f => `export * from '${f.path}'`) +export * from "./validate-search-field.decorator"; +export * from "./validate-search-field"; diff --git a/packages/backend/src/usagers/utils/validate-search-field.decorator.ts b/packages/backend/src/usagers/utils/validate-search-field.decorator.ts new file mode 100644 index 0000000000..42809a8a77 --- /dev/null +++ b/packages/backend/src/usagers/utils/validate-search-field.decorator.ts @@ -0,0 +1,33 @@ +import { + ValidationOptions, + registerDecorator, + ValidationArguments, +} from "class-validator"; +import { validateSearchField } from "./validate-search-field"; + +export function ValidateSearchField(validationOptions?: ValidationOptions) { + return function (object: object, propertyName: string) { + registerDecorator({ + name: "validateSearchField", + target: object.constructor, + propertyName: propertyName, + options: validationOptions, + validator: { + validate(value: string, args: ValidationArguments) { + const searchStringField = args.object["searchStringField"]; + if (!searchStringField) { + return false; + } + return validateSearchField(value, searchStringField); + }, + defaultMessage(args: ValidationArguments) { + const searchStringField = args.object["searchStringField"]; + if (!searchStringField) { + return "Le type de recherche est requis"; + } + return "La valeur de recherche est invalide pour le type spécifié"; + }, + }, + }); + }; +} diff --git a/packages/backend/src/usagers/utils/validate-search-field.ts b/packages/backend/src/usagers/utils/validate-search-field.ts new file mode 100644 index 0000000000..388e8f1756 --- /dev/null +++ b/packages/backend/src/usagers/utils/validate-search-field.ts @@ -0,0 +1,55 @@ +import { CriteriaSearchField, normalizeString } from "@domifa/common"; +import { BadRequestException } from "@nestjs/common"; +import { isValid, parse } from "date-fns"; + +export function validateSearchField( + value: string, + searchField: CriteriaSearchField +): boolean { + if (!value || !searchField) { + return false; + } + + try { + switch (searchField) { + case CriteriaSearchField.BIRTH_DATE: + const cleanDate = value.replace(/\D/g, ""); + if (cleanDate.length !== 8) { + throw new BadRequestException( + 'Format de date invalide. La date doit être au format "jj/mm/aaaa"' + ); + } + + const parsedDate = parse(cleanDate, "ddMMyyyy", new Date()); + if (!isValid(parsedDate)) { + throw new BadRequestException( + "Date invalide. Vérifiez que le jour et le mois sont corrects" + ); + } + return true; + + case CriteriaSearchField.PHONE_NUMBER: + const cleanPhone = value.replace(/\D/g, ""); + if (cleanPhone.length === 0) { + throw new BadRequestException( + "Le numéro de téléphone doit contenir au moins un chiffre" + ); + } + return true; + + default: + const cleanText = normalizeString(value).trim(); + if (cleanText.length === 0) { + throw new BadRequestException( + "Le texte de recherche doit contenir au moins un caractère" + ); + } + return true; + } + } catch (error) { + if (error instanceof BadRequestException) { + throw error; + } + return false; + } +} diff --git a/packages/backend/src/users/controllers/users.controller.security-tests.ts b/packages/backend/src/users/controllers/users.controller.security-tests.ts index eb51ae1c12..83706e6f37 100644 --- a/packages/backend/src/users/controllers/users.controller.security-tests.ts +++ b/packages/backend/src/users/controllers/users.controller.security-tests.ts @@ -11,6 +11,7 @@ import { expectedResponseStatusBuilder, securityTestDataBuilder, } from "../../_tests"; +import { USER_STRUCTURE_ROLE_ALL } from "../../_common/model"; const CONTROLLER = "UserController"; @@ -24,7 +25,7 @@ export const UserControllerSecurityTests: AppTestHttpClientSecurityTestDef[] = [ expectedStatus: expectedResponseStatusBuilder.allowStructureOnly( context.user, { - roles: ["responsable", "admin"], + roles: USER_STRUCTURE_ROLE_ALL, } ), }), diff --git a/packages/backend/src/users/controllers/users.controller.ts b/packages/backend/src/users/controllers/users.controller.ts index 5ed07831fe..57916bc651 100644 --- a/packages/backend/src/users/controllers/users.controller.ts +++ b/packages/backend/src/users/controllers/users.controller.ts @@ -14,11 +14,6 @@ import { import { AuthGuard } from "@nestjs/passport"; import { ApiBearerAuth, ApiOperation, ApiTags } from "@nestjs/swagger"; -import { AllowUserStructureRoles } from "../../auth/decorators"; -import { CurrentChosenUserStructure } from "../../auth/decorators/current-chosen-user-structure.decorator"; -import { CurrentUser } from "../../auth/decorators/current-user.decorator"; -import { AppUserGuard } from "../../auth/guards"; -import { CanGetUserStructureGuard } from "../../auth/guards/CanGetUserStructure.guard"; import { userStructureRepository, structureRepository, @@ -28,48 +23,51 @@ import { import { Response } from "express"; import { - UserStructure, UserStructureAuthenticated, - UserStructureProfile, USER_STRUCTURE_ROLE_ALL, } from "../../_common/model"; -import { EditMyPasswordDto } from "../dto/edit-my-password.dto"; -import { RegisterUserAdminDto } from "../dto/register-user-admin.dto"; -import { UpdateRoleDto } from "../dto/update-role.dto"; -import { UserEditDto } from "../dto/user-edit.dto"; + import { usersDeletor } from "../services"; import { userStructureCreator } from "../services/user-structure-creator.service"; +import { UserStructureProfile, UserStructure } from "@domifa/common"; import { userAccountCreatedByAdminEmailSender } from "../../modules/mails/services/templates-renderers/user-account-created-by-admin"; +import { + UpdateRoleDto, + UserEditDto, + RegisterUserAdminDto, + EditMyPasswordDto, +} from "../dto"; +import { + AllowUserStructureRoles, + CurrentUser, + CurrentChosenUserStructure, +} from "../../auth/decorators"; +import { AppUserGuard, CanGetUserStructureGuard } from "../../auth/guards"; @Controller("users") @ApiTags("users") @UseGuards(AuthGuard("jwt"), AppUserGuard) export class UsersController { - @AllowUserStructureRoles("responsable", "admin") @ApiBearerAuth() @ApiOperation({ summary: "Liste des utilisateurs" }) + @AllowUserStructureRoles(...USER_STRUCTURE_ROLE_ALL) @Get("") - public getUsers( + public async getUsers( @CurrentUser() user: UserStructureAuthenticated ): Promise { - return userStructureRepository.find({ - where: { - structureId: user.structureId, - }, - select: { - uuid: true, - role: true, - nom: true, - prenom: true, - email: true, - createdAt: true, - lastLogin: true, - verified: true, - }, - order: { - nom: "ASC", - }, - }); + const users = await userStructureRepository.getVerifiedUsersByStructureId( + user.structureId + ); + if (user.role === "facteur" || user.role === "simple") { + return users.map((user) => { + return { + id: user.id, + nom: user.nom, + prenom: user.prenom, + }; + }) as UserStructureProfile[]; + } + return users; } @AllowUserStructureRoles(...USER_STRUCTURE_ROLE_ALL) diff --git a/packages/backend/src/users/controllers/users.public.controller.spec.ts b/packages/backend/src/users/controllers/users.public.controller.spec.ts index ce135963e9..b64ee5bbed 100644 --- a/packages/backend/src/users/controllers/users.public.controller.spec.ts +++ b/packages/backend/src/users/controllers/users.public.controller.spec.ts @@ -18,7 +18,6 @@ describe("Users Public Controller", () => { context = await AppTestHelper.bootstrapTestApp({ controllers: [UsersPublicController], imports: [MailsModule, StructuresModule, UsagersModule, HttpModule], - providers: [], }); controller = context.module.get( UsersPublicController diff --git a/packages/backend/src/users/services/user-usager-creator.service.ts b/packages/backend/src/users/services/user-usager-creator.service.ts index 3b991dc0b1..5c3dc53d76 100644 --- a/packages/backend/src/users/services/user-usager-creator.service.ts +++ b/packages/backend/src/users/services/user-usager-creator.service.ts @@ -3,9 +3,9 @@ import { userUsagerSecurityRepository, UserUsagerTable, } from "../../database"; -import { UserStructure, UserUsagerSecurity } from "../../_common/model"; +import { UserUsagerSecurity } from "../../_common/model"; import { userUsagerLoginPasswordGenerator } from "./user-usager-login-password-generator.service"; -import { UserUsager } from "@domifa/common"; +import { UserStructure, UserUsager } from "@domifa/common"; export const userUsagerCreator = { createUserWithTmpPassword, diff --git a/packages/common/src/search/classes/Search.class.ts b/packages/common/src/search/classes/Search.class.ts index 2efcabe254..84a6375dea 100644 --- a/packages/common/src/search/classes/Search.class.ts +++ b/packages/common/src/search/classes/Search.class.ts @@ -4,7 +4,7 @@ export class Search { public searchString: string | null; public sortKey: string; public sortValue: SortValues; - public page: number; + public page = 1; constructor(search?: any) { this.searchString = search?.searchString ?? null; diff --git a/packages/common/src/search/types/UsagersFilterCriteriaEntretien.enum.ts b/packages/common/src/search/types/UsagersFilterCriteriaEntretien.enum.ts new file mode 100644 index 0000000000..a2f9c3e1b2 --- /dev/null +++ b/packages/common/src/search/types/UsagersFilterCriteriaEntretien.enum.ts @@ -0,0 +1,4 @@ +export enum UsagersFilterCriteriaEntretien { + COMING = "COMING", + OVERDUE = "OVERDUE", +} diff --git a/packages/common/src/search/types/index.ts b/packages/common/src/search/types/index.ts index 08fa2e722b..045d56ced0 100644 --- a/packages/common/src/search/types/index.ts +++ b/packages/common/src/search/types/index.ts @@ -2,4 +2,5 @@ export * from "./CriteriaSearchField.enum"; export * from "./SortValues.type"; export * from "./Timings.type"; +export * from "./UsagersFilterCriteriaEntretien.enum"; export * from "./UsagersFilterCriteriaStatut.enum"; diff --git a/packages/common/src/usager/interfaces/Usager.interface.ts b/packages/common/src/usager/interfaces/Usager.interface.ts index eb280e4196..bd54cc3bd7 100644 --- a/packages/common/src/usager/interfaces/Usager.interface.ts +++ b/packages/common/src/usager/interfaces/Usager.interface.ts @@ -55,6 +55,7 @@ export interface Usager extends AppEntity { numeroDistribution: string | null; pinnedNote: UsagerPinnedNote; + referrerId?: number | null; nbNotes?: number; statusInfos?: any; diff --git a/packages/common/src/usager/interfaces/UsagerDecision.interface.ts b/packages/common/src/usager/interfaces/UsagerDecision.interface.ts index d1afd37d4a..27c36615e5 100644 --- a/packages/common/src/usager/interfaces/UsagerDecision.interface.ts +++ b/packages/common/src/usager/interfaces/UsagerDecision.interface.ts @@ -1,7 +1,9 @@ -import { type UsagerDecisionMotif } from "../types/UsagerDecisionMotif.type"; -import { type UsagerDecisionOrientation } from "../types/UsagerDecisionOrientation.type"; -import { type UsagerDecisionStatut } from "../types/UsagerDecisionStatut.type"; -import { type UsagerTypeDom } from "../types/UsagerTypeDom.type"; +import { + UsagerTypeDom, + UsagerDecisionStatut, + UsagerDecisionMotif, + UsagerDecisionOrientation, +} from "../types"; export interface UsagerDecision { uuid: string; // permet d'identifier une décision en cas de suppression de l'historique diff --git a/packages/common/src/usager/types/UsagerDecisionMotif.type.ts b/packages/common/src/usager/types/decision/UsagerDecisionMotif.type.ts similarity index 100% rename from packages/common/src/usager/types/UsagerDecisionMotif.type.ts rename to packages/common/src/usager/types/decision/UsagerDecisionMotif.type.ts diff --git a/packages/common/src/usager/types/UsagerDecisionOrientation.type.ts b/packages/common/src/usager/types/decision/UsagerDecisionOrientation.type.ts similarity index 100% rename from packages/common/src/usager/types/UsagerDecisionOrientation.type.ts rename to packages/common/src/usager/types/decision/UsagerDecisionOrientation.type.ts diff --git a/packages/common/src/usager/types/UsagerDecisionStatut.type.ts b/packages/common/src/usager/types/decision/UsagerDecisionStatut.type.ts similarity index 100% rename from packages/common/src/usager/types/UsagerDecisionStatut.type.ts rename to packages/common/src/usager/types/decision/UsagerDecisionStatut.type.ts diff --git a/packages/common/src/usager/types/decision/index.ts b/packages/common/src/usager/types/decision/index.ts new file mode 100644 index 0000000000..5faf15fd36 --- /dev/null +++ b/packages/common/src/usager/types/decision/index.ts @@ -0,0 +1,4 @@ +// @index('./*', f => `export * from '${f.path}'`) +export * from "./UsagerDecisionMotif.type"; +export * from "./UsagerDecisionOrientation.type"; +export * from "./UsagerDecisionStatut.type"; diff --git a/packages/common/src/usager/types/index.ts b/packages/common/src/usager/types/index.ts index bebb77bd97..23778fab8b 100644 --- a/packages/common/src/usager/types/index.ts +++ b/packages/common/src/usager/types/index.ts @@ -1,9 +1,7 @@ // @index('./*', f => `export * from '${f.path}'`) export * from "./AyantDroitLienParente.type"; +export * from "./decision"; export * from "./entretien"; -export * from "./UsagerDecisionMotif.type"; -export * from "./UsagerDecisionOrientation.type"; -export * from "./UsagerDecisionStatut.type"; export * from "./UsagerImport.type"; export * from "./UsagerPinnedNote.type"; export * from "./UsagerSexe.type"; diff --git a/packages/frontend/src/_common/model/user-structure/UserStructureProfile.type.ts b/packages/common/src/user-structure/types/UserStructureProfile.type.ts similarity index 69% rename from packages/frontend/src/_common/model/user-structure/UserStructureProfile.type.ts rename to packages/common/src/user-structure/types/UserStructureProfile.type.ts index 68ba84e260..346acc7fe8 100644 --- a/packages/frontend/src/_common/model/user-structure/UserStructureProfile.type.ts +++ b/packages/common/src/user-structure/types/UserStructureProfile.type.ts @@ -1,13 +1,15 @@ -import { UserStructure } from "@domifa/common"; +import { UserStructure } from "../interfaces"; export type UserStructureProfile = Pick< UserStructure, - | "email" + | "uuid" + | "id" + | "role" | "nom" | "prenom" - | "role" - | "verified" - | "uuid" + | "email" | "createdAt" | "lastLogin" + | "structureId" + | "verified" >; diff --git a/packages/common/src/user-structure/types/index.ts b/packages/common/src/user-structure/types/index.ts index 85f3522d99..ff23fdc2dc 100644 --- a/packages/common/src/user-structure/types/index.ts +++ b/packages/common/src/user-structure/types/index.ts @@ -1,4 +1,5 @@ // @index('./*', f => `export * from '${f.path}'`) export * from "./UserRightStatus.type"; export * from "./UserStructureCreatedBy.type"; +export * from "./UserStructureProfile.type"; export * from "./UserStructureRole.type"; diff --git a/packages/frontend/src/_common/model/usager/UsagerLight.type.ts b/packages/frontend/src/_common/model/usager/UsagerLight.type.ts index 8afa9e7283..9b80594efb 100644 --- a/packages/frontend/src/_common/model/usager/UsagerLight.type.ts +++ b/packages/frontend/src/_common/model/usager/UsagerLight.type.ts @@ -33,6 +33,7 @@ export type UsagerLight = AppEntity & | "rdvInfo" | "pinnedNote" | "datePremiereDom" + | "referrerId" | "nbNotes" > & { phoneNumber?: string; diff --git a/packages/frontend/src/_common/model/usager/form/UsagerEtatCivilFormData.type.ts b/packages/frontend/src/_common/model/usager/form/UsagerEtatCivilFormData.type.ts index 3f432c2de8..0fbb4e9764 100644 --- a/packages/frontend/src/_common/model/usager/form/UsagerEtatCivilFormData.type.ts +++ b/packages/frontend/src/_common/model/usager/form/UsagerEtatCivilFormData.type.ts @@ -16,5 +16,6 @@ export type UsagerEtatCivilFormData = { nationalite: string | null; telephone: Telephone; contactByPhone: boolean; + referrerId: number | null; ayantsDroits: UsagerAyantDroit[]; }; diff --git a/packages/frontend/src/_common/model/user-structure/index.ts b/packages/frontend/src/_common/model/user-structure/index.ts index 9bc71f3305..014dcbe5bc 100644 --- a/packages/frontend/src/_common/model/user-structure/index.ts +++ b/packages/frontend/src/_common/model/user-structure/index.ts @@ -1,2 +1 @@ export * from "./UserStructureEditProfile.type"; -export * from "./UserStructureProfile.type"; diff --git a/packages/frontend/src/app/app-routing.module.ts b/packages/frontend/src/app/app-routing.module.ts index a5cfd8739d..ae1ef82b9e 100644 --- a/packages/frontend/src/app/app-routing.module.ts +++ b/packages/frontend/src/app/app-routing.module.ts @@ -71,6 +71,14 @@ export const routes: Routes = [ ), path: "manage", }, + { + canActivate: [AuthGuard], + loadChildren: () => + import("./modules/manage-users/manage-users.module").then( + (m) => m.ManageUsersModule + ), + path: "manage-users", + }, { canActivate: [AuthGuard, FacteurGuard], loadChildren: () => diff --git a/packages/frontend/src/app/modules/general/components/login/login.component.html b/packages/frontend/src/app/modules/general/components/login/login.component.html index aefedef41d..f5291146f9 100644 --- a/packages/frontend/src/app/modules/general/components/login/login.component.html +++ b/packages/frontend/src/app/modules/general/components/login/login.component.html @@ -143,7 +143,7 @@


Mot de passe oublié diff --git a/packages/frontend/src/app/modules/manage-usagers/components/manage-filters/manage-filters.component.html b/packages/frontend/src/app/modules/manage-usagers/components/manage-filters/manage-filters.component.html index 2f7da0367f..a89f6d22dd 100644 --- a/packages/frontend/src/app/modules/manage-usagers/components/manage-filters/manage-filters.component.html +++ b/packages/frontend/src/app/modules/manage-usagers/components/manage-filters/manage-filters.component.html @@ -278,7 +278,7 @@ (click)=" updateFilters.emit({ element: 'entretien', - value: 'COMING' + value: UsagersFilterCriteriaEntretien.COMING }) " ngbDropdownItem @@ -291,7 +291,7 @@ (click)=" updateFilters.emit({ element: 'entretien', - value: 'OVERDUE' + value: UsagersFilterCriteriaEntretien.OVERDUE }) " ngbDropdownItem @@ -301,6 +301,85 @@ +
+ + + +
([ @@ -50,7 +56,9 @@ export class ManageFiltersComponent implements OnInit, OnChanges { "PREVIOUS_THREE_MONTHS", ]); - public readonly labelsEntretien = { + public readonly labelsEntretien: { + [key in UsagersFilterCriteriaEntretien]: string; + } = { COMING: "à venir", OVERDUE: "date dépassée", }; @@ -61,8 +69,14 @@ export class ManageFiltersComponent implements OnInit, OnChanges { label: string; }> = []; + public users: UserStructureProfile[] = []; + public subscription: Subscription = new Subscription(); + + constructor(private readonly manageUsersService: ManageUsersService) {} + ngOnInit(): void { this.sortMenuItems = this.getSortKeys(); + this.users = this.manageUsersService.referrers; } ngOnChanges() { diff --git a/packages/frontend/src/app/modules/manage-usagers/components/usager-filter/UsagersFilterCriteria.ts b/packages/frontend/src/app/modules/manage-usagers/components/usager-filter/UsagersFilterCriteria.ts index dae46d59f5..b525920d63 100644 --- a/packages/frontend/src/app/modules/manage-usagers/components/usager-filter/UsagersFilterCriteria.ts +++ b/packages/frontend/src/app/modules/manage-usagers/components/usager-filter/UsagersFilterCriteria.ts @@ -3,6 +3,7 @@ import { Search, UsagersFilterCriteriaDernierPassage, UsagersFilterCriteriaEcheance, + UsagersFilterCriteriaEntretien, UsagersFilterCriteriaStatut, } from "@domifa/common"; @@ -13,8 +14,6 @@ export type UsagersFilterCriteriaSortKey = | "RDV" | "ID"; -export type UsagersFilterCriteriaEntretien = "COMING" | "OVERDUE"; - export class UsagersFilterCriteria extends Search { // text search filter // DEFAULT = Nom, prénom du domicilié, nom, prénom d'un des ayant-droits @@ -25,6 +24,7 @@ export class UsagersFilterCriteria extends Search { public interactionType: "courrierIn" | null; public lastInteractionDate: UsagersFilterCriteriaDernierPassage | null; public entretien: UsagersFilterCriteriaEntretien | null; + public referrerId?: number | null; // order by public sortKey: UsagersFilterCriteriaSortKey; @@ -41,5 +41,6 @@ export class UsagersFilterCriteria extends Search { this.page = search?.page || 1; this.sortKey = search?.sortKey || "NOM"; this.sortValue = search?.sortValue || "asc"; + this.referrerId = search?.referrerId || undefined; } } diff --git a/packages/frontend/src/app/modules/manage-usagers/components/usager-filter/usagersFilter.service.ts b/packages/frontend/src/app/modules/manage-usagers/components/usager-filter/usagersFilter.service.ts index 6f7aaa97fe..2ba66a24f4 100644 --- a/packages/frontend/src/app/modules/manage-usagers/components/usager-filter/usagersFilter.service.ts +++ b/packages/frontend/src/app/modules/manage-usagers/components/usager-filter/usagersFilter.service.ts @@ -3,6 +3,7 @@ import { CriteriaSearchField, ETAPE_ENTRETIEN, search, + UsagersFilterCriteriaEntretien, } from "@domifa/common"; import { UsagerLight } from "../../../../../_common/model"; import { @@ -26,22 +27,17 @@ function filter( }: { criteria: UsagersFilterCriteria; } -) { +): UsagerLight[] { return filterByCriteria(usagers, criteria); } function filterByCriteria( usagers: UsagerLight[], criteria: UsagersFilterCriteria -) { - const now = new Date().toISOString().split("T")[0]; - - if (criteria.entretien) { - return filterByEntretien(usagers, criteria.entretien, now); - } - +): UsagerLight[] { // Si pas de filtres ni de recherche textuelle après le traitement entretien const activeFilters = buildActiveFilters(criteria); + if (!criteria.searchString && !activeFilters.length) { return usagers; } @@ -94,6 +90,18 @@ function buildActiveFilters(criteria: UsagersFilterCriteria) { // Créer un tableau de fonctions de filtrage actives const activeFilters = []; + if (criteria.entretien) { + activeFilters.push((usager: UsagerLight) => + filterByEntretien(usager, criteria.entretien) + ); + } + + if (typeof criteria.referrerId !== "undefined") { + activeFilters.push( + (usager: UsagerLight) => usager.referrerId === criteria.referrerId + ); + } + if (criteria.statut) { activeFilters.push((usager: UsagerLight) => usagerStatutChecker.check({ usager, statut: criteria.statut }) @@ -127,16 +135,17 @@ function buildActiveFilters(criteria: UsagersFilterCriteria) { } function filterByEntretien( - usagers: UsagerLight[], - entretien: string, - now: string -): UsagerLight[] { - return usagers.filter((usager) => { - if (!usager.rdv?.dateRdv || usager.etapeDemande > ETAPE_ENTRETIEN) { - return false; - } + usager: UsagerLight, + entretien: UsagersFilterCriteriaEntretien +): boolean { + const now = new Date().toISOString().split("T")[0]; - const dateRdv = new Date(usager.rdv.dateRdv).toISOString().split("T")[0]; - return entretien === "COMING" ? dateRdv > now : dateRdv < now; - }); + if (!usager.rdv?.dateRdv || usager.etapeDemande > ETAPE_ENTRETIEN) { + return false; + } + + const dateRdv = new Date(usager.rdv.dateRdv).toISOString().split("T")[0]; + return entretien === UsagersFilterCriteriaEntretien.COMING + ? dateRdv > now + : dateRdv < now; } diff --git a/packages/frontend/src/app/modules/manage-usagers/services/manage-usagers.service.ts b/packages/frontend/src/app/modules/manage-usagers/services/manage-usagers.service.ts index 9897cb83b2..a4b5973aba 100644 --- a/packages/frontend/src/app/modules/manage-usagers/services/manage-usagers.service.ts +++ b/packages/frontend/src/app/modules/manage-usagers/services/manage-usagers.service.ts @@ -3,9 +3,6 @@ import { Injectable } from "@angular/core"; import { Observable } from "rxjs"; import { map, tap } from "rxjs/operators"; import { environment } from "src/environments/environment"; - -import { UsagerLight } from "../../../../_common/model/usager/UsagerLight.type"; - import { Store } from "@ngrx/store"; import { setUsagerInformation, @@ -13,12 +10,13 @@ import { UsagerState, } from "../../../shared"; import { UsagersFilterCriteria } from "../components/usager-filter"; +import { UsagerLight } from "../../../../_common/model"; @Injectable({ providedIn: "root", }) export class ManageUsagersService { - public endPointUsagers = environment.apiUrl + "usagers"; + public endPoint = environment.apiUrl + "search-usagers"; constructor( private readonly http: HttpClient, @@ -32,7 +30,7 @@ export class ManageUsagersService { }): Observable { return this.http .get<{ usagers: UsagerLight[]; usagersRadiesTotalCount: number }>( - `${environment.apiUrl}usagers/?chargerTousRadies=${chargerTousRadies}` + `${this.endPoint}?chargerTousRadies=${chargerTousRadies}` ) .pipe( map( @@ -64,10 +62,7 @@ export class ManageUsagersService { filters: UsagersFilterCriteria ): Observable { return this.http - .post( - `${environment.apiUrl}usagers/search-radies`, - filters - ) + .post(`${this.endPoint}search-radies`, filters) .pipe( tap((usagers: UsagerLight[]) => { if (usagers?.length) { @@ -83,16 +78,14 @@ export class ManageUsagersService { } public updateManage(): Observable { - return this.http - .get(`${environment.apiUrl}usagers/update-manage`) - .pipe( - tap((usagers: UsagerLight[]) => { - if (usagers?.length) { - this.store.dispatch( - usagerActions.updateManyUsagersForManage({ usagers }) - ); - } - }) - ); + return this.http.get(`${this.endPoint}update-manage`).pipe( + tap((usagers: UsagerLight[]) => { + if (usagers?.length) { + this.store.dispatch( + usagerActions.updateManyUsagersForManage({ usagers }) + ); + } + }) + ); } } diff --git a/packages/frontend/src/app/modules/users/components/edit-user/edit-user.component.html b/packages/frontend/src/app/modules/manage-users/components/edit-user/edit-user.component.html similarity index 100% rename from packages/frontend/src/app/modules/users/components/edit-user/edit-user.component.html rename to packages/frontend/src/app/modules/manage-users/components/edit-user/edit-user.component.html diff --git a/packages/frontend/src/app/modules/users/components/edit-user/edit-user.component.spec.ts b/packages/frontend/src/app/modules/manage-users/components/edit-user/edit-user.component.spec.ts similarity index 100% rename from packages/frontend/src/app/modules/users/components/edit-user/edit-user.component.spec.ts rename to packages/frontend/src/app/modules/manage-users/components/edit-user/edit-user.component.spec.ts diff --git a/packages/frontend/src/app/modules/users/components/edit-user/edit-user.component.ts b/packages/frontend/src/app/modules/manage-users/components/edit-user/edit-user.component.ts similarity index 83% rename from packages/frontend/src/app/modules/users/components/edit-user/edit-user.component.ts rename to packages/frontend/src/app/modules/manage-users/components/edit-user/edit-user.component.ts index ed4090ac53..234a15e524 100644 --- a/packages/frontend/src/app/modules/users/components/edit-user/edit-user.component.ts +++ b/packages/frontend/src/app/modules/manage-users/components/edit-user/edit-user.component.ts @@ -18,20 +18,21 @@ import { Title } from "@angular/platform-browser"; import { Observable, of, Subject, Subscription } from "rxjs"; import { map, takeUntil } from "rxjs/operators"; +import { EmailValidator, NoWhiteSpaceValidator } from "../../../../shared"; +import { AuthService, CustomToastService } from "../../../shared/services"; +import { UserStructure } from "@domifa/common"; +import { format } from "date-fns"; import { - FormEmailTakenValidator, UsagerLight, + FormEmailTakenValidator, } from "../../../../../_common/model"; +import { PASSWORD_VALIDATOR } from "../../../users/PASSWORD_VALIDATOR.const"; import { - PasswordValidator, UsersService, + PasswordValidator, userStructureBuilder, -} from "../../services"; -import { format } from "date-fns"; -import { PASSWORD_VALIDATOR } from "../../PASSWORD_VALIDATOR.const"; -import { EmailValidator, NoWhiteSpaceValidator } from "../../../../shared"; -import { AuthService, CustomToastService } from "../../../shared/services"; -import { UserStructure } from "@domifa/common"; +} from "../../../users/services"; +import { ManageUsersService } from "../../services/manage-users.service"; @Component({ selector: "app-edit-user", @@ -72,7 +73,8 @@ export class EditUserComponent implements OnInit, OnDestroy { constructor( private readonly authService: AuthService, - private readonly userService: UsersService, + private readonly manageUsersService: ManageUsersService, + private readonly usersService: UsersService, private readonly toastService: CustomToastService, private readonly formBuilder: UntypedFormBuilder, private readonly titleService: Title, @@ -99,7 +101,7 @@ export class EditUserComponent implements OnInit, OnDestroy { this.getLastPasswordUpdate(); if (this.me?.role !== "facteur") { - this.usagers$ = this.userService.agenda(); + this.usagers$ = this.manageUsersService.agenda(); } } @@ -155,7 +157,7 @@ export class EditUserComponent implements OnInit, OnDestroy { private getLastPasswordUpdate(): void { this.subscription.add( - this.userService.getLastPasswordUpdate().subscribe({ + this.manageUsersService.getLastPasswordUpdate().subscribe({ next: (lastPassword: Date | null) => { this.lastPasswordUpdate = lastPassword === null @@ -177,7 +179,7 @@ export class EditUserComponent implements OnInit, OnDestroy { } this.loading = true; this.subscription.add( - this.userService.patch(this.userForm.value).subscribe({ + this.manageUsersService.patch(this.userForm.value).subscribe({ next: (user: UserStructure) => { this.loading = false; this.me = userStructureBuilder.buildUserStructure(user); @@ -208,23 +210,25 @@ export class EditUserComponent implements OnInit, OnDestroy { this.loading = true; this.subscription.add( - this.userService.updateMyPassword(this.passwordForm.value).subscribe({ - next: () => { - this.loading = false; - this.editPassword = false; - this.submitted = false; - this.getLastPasswordUpdate(); - this.toastService.success( - "Félicitations ! : votre mot de passe a été modifié avec succès" - ); - }, - error: () => { - this.loading = false; - this.toastService.error( - "Une erreur est survenue, veuillez vérifier le formulaire" - ); - }, - }) + this.manageUsersService + .updateMyPassword(this.passwordForm.value) + .subscribe({ + next: () => { + this.loading = false; + this.editPassword = false; + this.submitted = false; + this.getLastPasswordUpdate(); + this.toastService.success( + "Félicitations ! : votre mot de passe a été modifié avec succès" + ); + }, + error: () => { + this.loading = false; + this.toastService.error( + "Une erreur est survenue, veuillez vérifier le formulaire" + ); + }, + }) ); } @@ -240,7 +244,7 @@ export class EditUserComponent implements OnInit, OnDestroy { } return isEmail(control.value) - ? this.userService.validateEmail(control.value).pipe( + ? this.usersService.validateEmail(control.value).pipe( takeUntil(this.unsubscribe), map((res: boolean) => { return res === false ? null : { emailTaken: true }; diff --git a/packages/frontend/src/app/modules/users/components/register-user-admin/register-user-admin.component.html b/packages/frontend/src/app/modules/manage-users/components/register-user-admin/register-user-admin.component.html similarity index 100% rename from packages/frontend/src/app/modules/users/components/register-user-admin/register-user-admin.component.html rename to packages/frontend/src/app/modules/manage-users/components/register-user-admin/register-user-admin.component.html diff --git a/packages/frontend/src/app/modules/users/components/register-user-admin/register-user-admin.component.spec.ts b/packages/frontend/src/app/modules/manage-users/components/register-user-admin/register-user-admin.component.spec.ts similarity index 100% rename from packages/frontend/src/app/modules/users/components/register-user-admin/register-user-admin.component.spec.ts rename to packages/frontend/src/app/modules/manage-users/components/register-user-admin/register-user-admin.component.spec.ts diff --git a/packages/frontend/src/app/modules/users/components/register-user-admin/register-user-admin.component.ts b/packages/frontend/src/app/modules/manage-users/components/register-user-admin/register-user-admin.component.ts similarity index 93% rename from packages/frontend/src/app/modules/users/components/register-user-admin/register-user-admin.component.ts rename to packages/frontend/src/app/modules/manage-users/components/register-user-admin/register-user-admin.component.ts index 76a8024627..9c5ee3ca2a 100644 --- a/packages/frontend/src/app/modules/users/components/register-user-admin/register-user-admin.component.ts +++ b/packages/frontend/src/app/modules/manage-users/components/register-user-admin/register-user-admin.component.ts @@ -24,8 +24,9 @@ import { NoWhiteSpaceValidator, } from "../../../../shared"; import { CustomToastService } from "../../../shared/services"; -import { UsersService, userStructureBuilder } from "../../services"; + import { UserStructure } from "@domifa/common"; +import { UsersService, userStructureBuilder } from "../../../users/services"; @Component({ animations: [fadeInOut], @@ -55,7 +56,7 @@ export class RegisterUserAdminComponent implements OnInit, OnDestroy { constructor( private readonly formBuilder: UntypedFormBuilder, - private readonly userService: UsersService, + private readonly usersService: UsersService, private readonly toastService: CustomToastService ) { this.user = userStructureBuilder.buildUserStructure({}); @@ -92,7 +93,7 @@ export class RegisterUserAdminComponent implements OnInit, OnDestroy { } else { this.loading = true; this.subscription.add( - this.userService.registerUser(this.userForm.value).subscribe({ + this.usersService.registerUser(this.userForm.value).subscribe({ next: () => { this.loading = false; this.submitted = false; @@ -117,7 +118,7 @@ export class RegisterUserAdminComponent implements OnInit, OnDestroy { control: AbstractControl ): FormEmailTakenValidator { return isEmail(control.value) - ? this.userService.validateEmail(control.value).pipe( + ? this.usersService.validateEmail(control.value).pipe( takeUntil(this.unsubscribe), map((res: boolean) => { return res === false ? null : { emailTaken: true }; diff --git a/packages/frontend/src/app/modules/users/components/user-profil/user-profil.component.html b/packages/frontend/src/app/modules/manage-users/components/user-profil/user-profil.component.html similarity index 100% rename from packages/frontend/src/app/modules/users/components/user-profil/user-profil.component.html rename to packages/frontend/src/app/modules/manage-users/components/user-profil/user-profil.component.html diff --git a/packages/frontend/src/app/modules/users/components/user-profil/user-profil.component.spec.ts b/packages/frontend/src/app/modules/manage-users/components/user-profil/user-profil.component.spec.ts similarity index 100% rename from packages/frontend/src/app/modules/users/components/user-profil/user-profil.component.spec.ts rename to packages/frontend/src/app/modules/manage-users/components/user-profil/user-profil.component.spec.ts diff --git a/packages/frontend/src/app/modules/users/components/user-profil/user-profil.component.ts b/packages/frontend/src/app/modules/manage-users/components/user-profil/user-profil.component.ts similarity index 93% rename from packages/frontend/src/app/modules/users/components/user-profil/user-profil.component.ts rename to packages/frontend/src/app/modules/manage-users/components/user-profil/user-profil.component.ts index c4a4ad6dcb..a78ae8fc50 100644 --- a/packages/frontend/src/app/modules/users/components/user-profil/user-profil.component.ts +++ b/packages/frontend/src/app/modules/manage-users/components/user-profil/user-profil.component.ts @@ -5,14 +5,17 @@ import { NgbModal, NgbModalRef } from "@ng-bootstrap/ng-bootstrap"; import { CustomToastService } from "src/app/modules/shared/services/custom-toast.service"; -import { - DEFAULT_MODAL_OPTIONS, - UserStructureProfile, -} from "../../../../../_common/model"; +import { DEFAULT_MODAL_OPTIONS } from "../../../../../_common/model"; import { AuthService } from "../../../shared/services/auth.service"; -import { UsersService } from "../../services/users.service"; + import { differenceInCalendarDays } from "date-fns"; -import { SortValues, UserStructure, UserStructureRole } from "@domifa/common"; +import { + UserStructureProfile, + SortValues, + UserStructure, + UserStructureRole, +} from "@domifa/common"; +import { ManageUsersService } from "../../services/manage-users.service"; @Component({ selector: "app-user-profil", @@ -37,7 +40,7 @@ export class UserProfilComponent implements OnInit, OnDestroy { }; constructor( private readonly authService: AuthService, - private readonly userService: UsersService, + private readonly userService: ManageUsersService, private readonly modalService: NgbModal, private readonly toastService: CustomToastService, private readonly titleService: Title diff --git a/packages/frontend/src/app/modules/manage-users/manage-users-routing.module.ts b/packages/frontend/src/app/modules/manage-users/manage-users-routing.module.ts new file mode 100644 index 0000000000..92b7e9915a --- /dev/null +++ b/packages/frontend/src/app/modules/manage-users/manage-users-routing.module.ts @@ -0,0 +1,26 @@ +import { NgModule } from "@angular/core"; +import { Routes, RouterModule } from "@angular/router"; + +import { AuthGuard, ResponsableGuard } from "../../guards"; +import { EditUserComponent } from "./components/edit-user/edit-user.component"; +import { UserProfilComponent } from "./components/user-profil/user-profil.component"; + +const routes: Routes = [ + { + canActivate: [AuthGuard], + component: EditUserComponent, + path: "my-account", + }, + + { + canActivate: [AuthGuard, ResponsableGuard], + component: UserProfilComponent, + path: "accounts", + }, +]; + +@NgModule({ + imports: [RouterModule.forChild(routes)], + exports: [RouterModule], +}) +export class ManageUsersRoutingModule {} diff --git a/packages/frontend/src/app/modules/manage-users/manage-users.module.ts b/packages/frontend/src/app/modules/manage-users/manage-users.module.ts new file mode 100644 index 0000000000..2813e14c73 --- /dev/null +++ b/packages/frontend/src/app/modules/manage-users/manage-users.module.ts @@ -0,0 +1,34 @@ +import { NgModule } from "@angular/core"; +import { CommonModule } from "@angular/common"; +import { EditUserComponent } from "./components/edit-user/edit-user.component"; +import { HttpClientModule } from "@angular/common/http"; +import { FormsModule, ReactiveFormsModule } from "@angular/forms"; +import { NgbModule } from "@ng-bootstrap/ng-bootstrap"; +import { TableHeadSortComponent } from "../shared/components/table-head-sort/table-head-sort.component"; +import { SortArrayPipe } from "../shared/pipes"; +import { SharedModule } from "../shared/shared.module"; +import { UserProfilComponent } from "./components/user-profil/user-profil.component"; +import { UsersModule } from "../users/users.module"; +import { RegisterUserAdminComponent } from "./components/register-user-admin/register-user-admin.component"; +import { ManageUsersRoutingModule } from "./manage-users-routing.module"; + +@NgModule({ + declarations: [ + UserProfilComponent, + EditUserComponent, + RegisterUserAdminComponent, + ], + imports: [ + TableHeadSortComponent, + FormsModule, + HttpClientModule, + NgbModule, + UsersModule, + ReactiveFormsModule, + SharedModule, + CommonModule, + ManageUsersRoutingModule, + SortArrayPipe, + ], +}) +export class ManageUsersModule {} diff --git a/packages/frontend/src/app/modules/manage-users/services/manage-users.service.spec.ts b/packages/frontend/src/app/modules/manage-users/services/manage-users.service.spec.ts new file mode 100644 index 0000000000..778f11be9f --- /dev/null +++ b/packages/frontend/src/app/modules/manage-users/services/manage-users.service.spec.ts @@ -0,0 +1,23 @@ +import { TestBed } from "@angular/core/testing"; + +import { ManageUsersService } from "./manage-users.service"; +import { CommonModule, APP_BASE_HREF } from "@angular/common"; +import { HttpClientTestingModule } from "@angular/common/http/testing"; +import { CUSTOM_ELEMENTS_SCHEMA } from "@angular/core"; + +describe("ManageUsersService", () => { + let service: ManageUsersService; + + beforeEach(() => { + TestBed.configureTestingModule({ + imports: [HttpClientTestingModule, CommonModule], + providers: [{ provide: APP_BASE_HREF, useValue: "/" }], + schemas: [CUSTOM_ELEMENTS_SCHEMA], + }); + service = TestBed.inject(ManageUsersService); + }); + + it("should be created", () => { + expect(service).toBeTruthy(); + }); +}); diff --git a/packages/frontend/src/app/modules/manage-users/services/manage-users.service.ts b/packages/frontend/src/app/modules/manage-users/services/manage-users.service.ts new file mode 100644 index 0000000000..4d170b80df --- /dev/null +++ b/packages/frontend/src/app/modules/manage-users/services/manage-users.service.ts @@ -0,0 +1,88 @@ +import { HttpClient } from "@angular/common/http"; +import { Injectable } from "@angular/core"; +import { + UserStructure, + UserStructureRole, + ApiMessage, + UserStructureProfile, +} from "@domifa/common"; +import { BehaviorSubject, Observable, map } from "rxjs"; +import { + UserStructureEditProfile, + UsagerLight, +} from "../../../../_common/model"; +import { environment } from "../../../../environments/environment"; +import { userStructureBuilder } from "../../users/services"; + +@Injectable({ + providedIn: "root", +}) +export class ManageUsersService { + private endPoint = environment.apiUrl + "users"; + private usersSubject = new BehaviorSubject([]); + + readonly users$ = this.usersSubject.asObservable(); + readonly referrersMap: { [key: number]: string } = {}; + + public users: UserStructureProfile[] = []; + public referrers: UserStructureProfile[] = []; + + constructor(private readonly http: HttpClient) { + this.http.get(this.endPoint).subscribe((users) => { + this.usersSubject.next(users); + this.users = users; + users.forEach((user) => { + if (user.role !== "facteur") { + this.referrers.push(user); + this.referrersMap[user.id] = `${user.nom} ${user.prenom}`; + } + }); + }); + } + + public patch(userInfos: UserStructureEditProfile): Observable { + return this.http.patch(`${this.endPoint}`, userInfos).pipe( + map((response) => { + return userStructureBuilder.buildUserStructure(response); + }) + ); + } + + public getUsers(): Observable { + return this.http.get(`${this.endPoint}`); + } + + public updateRole( + uuid: string, + role: UserStructureRole + ): Observable { + return this.http.patch( + `${this.endPoint}/update-role/${uuid}`, + { + role, + } + ); + } + + public deleteUser(uuid: string): Observable { + return this.http.delete(`${this.endPoint}/${uuid}`); + } + + public getLastPasswordUpdate(): Observable { + return this.http.get(`${this.endPoint}/last-password-update`); + } + + public agenda(): Observable { + return this.http.get(`${environment.apiUrl}agenda`); + } + public updateMyPassword(data: { + passwordConfirmation: string; + password: string; + oldPassword: string; + }): Observable { + return this.http.post( + `${this.endPoint}/edit-my-password`, + data + ); + } +} diff --git a/packages/frontend/src/app/modules/usager-dossier/components/display-contact-details-decision/display-contact-details-decision.component.html b/packages/frontend/src/app/modules/usager-dossier/components/display-contact-details-decision/display-contact-details-decision.component.html index 0396c21915..aa7e4cf99d 100644 --- a/packages/frontend/src/app/modules/usager-dossier/components/display-contact-details-decision/display-contact-details-decision.component.html +++ b/packages/frontend/src/app/modules/usager-dossier/components/display-contact-details-decision/display-contact-details-decision.component.html @@ -1,5 +1,5 @@

- Téléphone: + Téléphone:  {{ usager.telephone | formatInternationalPhoneNumber }} diff --git a/packages/frontend/src/app/modules/usager-dossier/components/display-etat-civil-decision/display-etat-civil-decision.component.html b/packages/frontend/src/app/modules/usager-dossier/components/display-etat-civil-decision/display-etat-civil-decision.component.html index 548cef2ba7..9eeb73634c 100644 --- a/packages/frontend/src/app/modules/usager-dossier/components/display-etat-civil-decision/display-etat-civil-decision.component.html +++ b/packages/frontend/src/app/modules/usager-dossier/components/display-etat-civil-decision/display-etat-civil-decision.component.html @@ -30,6 +30,11 @@ {{ usager.numeroDistribution || "Non renseigné" }}

+ +

+ Référent: + {{ usager.referrerId | referrerName }} +

diff --git a/packages/frontend/src/app/modules/usager-dossier/components/step-etat-civil/step-etat-civil.component.html b/packages/frontend/src/app/modules/usager-dossier/components/step-etat-civil/step-etat-civil.component.html index faac9424e2..f94eb0dc26 100644 --- a/packages/frontend/src/app/modules/usager-dossier/components/step-etat-civil/step-etat-civil.component.html +++ b/packages/frontend/src/app/modules/usager-dossier/components/step-etat-civil/step-etat-civil.component.html @@ -392,6 +392,22 @@

État civil du demandeur

/> Exemple : BP 102, TSA 11000
+
+ + +
required > -

, private readonly formBuilder: UntypedFormBuilder, private readonly documentService: DocumentService, - private readonly nbgDate: NgbDateCustomParserFormatter + private readonly nbgDate: NgbDateCustomParserFormatter, + private readonly manageUsersService: ManageUsersService ) { super( authService, @@ -166,21 +168,14 @@ export class StepRdvComponent ); this.rdvForm.controls.jourRdv.setValue(this.usager.rdv.jourRdv); - this.editRdv = this.usager.rdv.userId === null; - this.subscription.add( - this.usagerDossierService - .getAllUsersForAgenda() - .subscribe((users: UserStructure[]) => { - this.agents = users; - const userIdRdv = this.usager.rdv?.userId || this.me?.id; + const userIdRdv = this.usager.rdv?.userId || this.me?.id; - this.rdvForm.controls.userId.setValue(userIdRdv, { - onlySelf: true, - }); - }) - ); + this.rdvForm.controls.userId.setValue(userIdRdv, { + onlySelf: true, + }); + this.users = this.manageUsersService.referrers; } public setValueRdv(value: boolean): void { @@ -277,7 +272,6 @@ export class StepRdvComponent } const heureRdv = control.value.split(":"); - const dateRdv: Date = setMinutes( setHours(new Date(), heureRdv[0]), heureRdv[1] diff --git a/packages/frontend/src/app/modules/usager-dossier/services/usager-dossier.service.ts b/packages/frontend/src/app/modules/usager-dossier/services/usager-dossier.service.ts index 07783e6e77..c55ba25aba 100644 --- a/packages/frontend/src/app/modules/usager-dossier/services/usager-dossier.service.ts +++ b/packages/frontend/src/app/modules/usager-dossier/services/usager-dossier.service.ts @@ -1,16 +1,15 @@ import { HttpClient } from "@angular/common/http"; import { Injectable } from "@angular/core"; import { Observable } from "rxjs"; -import { map, tap } from "rxjs/operators"; +import { tap } from "rxjs/operators"; import { environment } from "src/environments/environment"; import { UsagerEtatCivilFormData, UsagerLight, } from "../../../../_common/model"; -import { userStructureBuilder } from "../../users/services"; import { Store } from "@ngrx/store"; -import { UserStructure, Usager } from "@domifa/common"; +import { Usager } from "@domifa/common"; import { usagerActions, UsagerState } from "../../../shared"; import { RdvForm } from "../types"; @@ -102,16 +101,4 @@ export class UsagerDossierService { }) ); } - - public getAllUsersForAgenda(): Observable { - return this.http.get(environment.apiUrl + "agenda/users").pipe( - map((response) => { - return Array.isArray(response) - ? response.map((item) => - userStructureBuilder.buildUserStructure(item) - ) - : [userStructureBuilder.buildUserStructure(response)]; - }) - ); - } } diff --git a/packages/frontend/src/app/modules/usager-profil/components/_general-section/display-etat-civil/display-etat-civil.component.html b/packages/frontend/src/app/modules/usager-profil/components/_general-section/display-etat-civil/display-etat-civil.component.html index 6b38f2d35c..48ecf0b5bf 100644 --- a/packages/frontend/src/app/modules/usager-profil/components/_general-section/display-etat-civil/display-etat-civil.component.html +++ b/packages/frontend/src/app/modules/usager-profil/components/_general-section/display-etat-civil/display-etat-civil.component.html @@ -49,6 +49,13 @@ {{ usager.numeroDistribution || "Non renseigné" }}

+ +

+ Référent.e au sein de la structure + + {{ usager.referrerId | referrerName }} + +

diff --git a/packages/frontend/src/app/modules/usager-profil/components/pages/profil-general-section/profil-general-section.component.html b/packages/frontend/src/app/modules/usager-profil/components/pages/profil-general-section/profil-general-section.component.html index fd8c76be62..509eeac605 100644 --- a/packages/frontend/src/app/modules/usager-profil/components/pages/profil-general-section/profil-general-section.component.html +++ b/packages/frontend/src/app/modules/usager-profil/components/pages/profil-general-section/profil-general-section.component.html @@ -249,9 +249,11 @@

Dossier

Référence dossier
+
{{ usager.customRef }}
+
Statut
@@ -263,15 +265,24 @@

Dossier

-
- Ayants-droits -
-
- +
+ Type de domiciliation
+
+
+ Renouvellement +
+
+ Première demande +
+
Échéance
{{ usager?.echeanceInfos?.dateToDisplay | date : "dd MMMM yyyy" }} @@ -291,25 +302,21 @@

Dossier

{{ usager.datePremiereDom | date : "dd MMMM yyyy" }}
-
- Type de domiciliation + +
+ Ayants-droits +
+
+ +
+
+ Référent au sein de la structure
-
- Renouvellement -
- -
- Première demande -
+ {{ usager.referrerId | referrerName }}
-
{ nom: "TEST", prenom: "TEST PRENOM ", sexe: "homme", + referrerId: null, surnom: "Chips", numeroDistribution: "TSA 1000", telephone: { @@ -94,6 +95,7 @@ describe("EtatCivilParentFormComponent", () => { prenom: "AD PRENOM", }, ], + referrerId: null, contactByPhone: true, customRef: null, dateNaissance: new Date("2022-08-03T21:59:59.999Z"), diff --git a/packages/frontend/src/app/modules/usager-shared/components/etat-civil-parent-form/etat-civil-parent-form.component.ts b/packages/frontend/src/app/modules/usager-shared/components/etat-civil-parent-form/etat-civil-parent-form.component.ts index ffff0789d5..48f85877dd 100644 --- a/packages/frontend/src/app/modules/usager-shared/components/etat-civil-parent-form/etat-civil-parent-form.component.ts +++ b/packages/frontend/src/app/modules/usager-shared/components/etat-civil-parent-form/etat-civil-parent-form.component.ts @@ -59,9 +59,12 @@ import { LIEN_PARENTE_LABELS, UsagerAyantDroit, UserStructure, + UserStructureProfile, + COUNTRIES, } from "@domifa/common"; -import { COUNTRIES } from "@domifa/common"; + import { languagesAutocomplete } from "../../utils/languages"; +import { ManageUsersService } from "../../../manage-users/services/manage-users.service"; @Component({ selector: "app-etat-civil-parent-form", @@ -100,8 +103,8 @@ export class EtatCivilParentFormComponent implements OnDestroy { }); public subscription = new Subscription(); - public currentUserSubject$: Observable; + public users: UserStructureProfile[] = []; @ViewChildren("adName") public firstInputs!: QueryList; @@ -117,7 +120,8 @@ export class EtatCivilParentFormComponent implements OnDestroy { constructor( protected readonly formBuilder: UntypedFormBuilder, protected readonly authService: AuthService, - protected readonly changeDetectorRef: ChangeDetectorRef + protected readonly changeDetectorRef: ChangeDetectorRef, + protected readonly manageUsersService: ManageUsersService ) { this.submitted = false; this.loading = false; @@ -125,7 +129,7 @@ export class EtatCivilParentFormComponent implements OnDestroy { this.minDateToday = minDateToday; this.minDateNaissance = minDateNaissance; this.maxDateNaissance = formatDateToNgb(new Date()); - + this.users = this.manageUsersService.referrers; this.currentUserSubject$ = this.authService.currentUserSubject; } @@ -166,6 +170,7 @@ export class EtatCivilParentFormComponent implements OnDestroy { ], sexe: [this.usager.sexe, Validators.required], surnom: [this.usager.surnom, [Validators.maxLength(100)]], + referrerId: [this.usager.referrerId], villeNaissance: [ this.usager.villeNaissance, [Validators.required, NoWhiteSpaceValidator, Validators.maxLength(100)], @@ -195,7 +200,6 @@ export class EtatCivilParentFormComponent implements OnDestroy { this.updatePlaceHolder(this.usagerForm.value?.telephone?.countryCode); } - // Gestion des ayant-droits public addAyantDroit(ayantDroit: AyantDroit = new AyantDroit()): void { (this.usagerForm.controls.ayantsDroits as UntypedFormArray).push( this.newAyantDroit(ayantDroit) @@ -286,6 +290,9 @@ export class EtatCivilParentFormComponent implements OnDestroy { email: formValue?.email.toLowerCase().trim() || null, telephone, numeroDistribution: formValue?.numeroDistribution || null, + referrerId: formValue?.referrerId + ? parseInt(formValue?.referrerId) + : null, ayantsDroits, contactByPhone: formValue?.contactByPhone, dateNaissance: endOfDay(parseDateFromNgb(formValue.dateNaissance)), diff --git a/packages/frontend/src/app/modules/usager-shared/components/profil-etat-civil-form/profil-etat-civil-form.component.html b/packages/frontend/src/app/modules/usager-shared/components/profil-etat-civil-form/profil-etat-civil-form.component.html index 5027607fe8..87d1e4dd13 100644 --- a/packages/frontend/src/app/modules/usager-shared/components/profil-etat-civil-form/profil-etat-civil-form.component.html +++ b/packages/frontend/src/app/modules/usager-shared/components/profil-etat-civil-form/profil-etat-civil-form.component.html @@ -284,6 +284,21 @@ /> Exemple : BP 102, TSA 11000
+ +
+ + +
diff --git a/packages/frontend/src/app/modules/usager-shared/components/profil-etat-civil-form/profil-etat-civil-form.component.ts b/packages/frontend/src/app/modules/usager-shared/components/profil-etat-civil-form/profil-etat-civil-form.component.ts index 141e9a9ecb..1940c28498 100644 --- a/packages/frontend/src/app/modules/usager-shared/components/profil-etat-civil-form/profil-etat-civil-form.component.ts +++ b/packages/frontend/src/app/modules/usager-shared/components/profil-etat-civil-form/profil-etat-civil-form.component.ts @@ -19,6 +19,7 @@ import { CustomToastService } from "src/app/modules/shared/services/custom-toast import { UsagerFormModel } from "../../interfaces"; import { AuthService } from "../../../shared/services/auth.service"; +import { ManageUsersService } from "../../../manage-users/services/manage-users.service"; @Component({ selector: "app-profil-etat-civil-form", @@ -38,10 +39,11 @@ export class ProfilEtatCivilFormComponent public authService: AuthService, public formBuilder: UntypedFormBuilder, public changeDetectorRef: ChangeDetectorRef, + public manageUsersService: ManageUsersService, private readonly toastService: CustomToastService, private readonly etatCivilService: UsagerService ) { - super(formBuilder, authService, changeDetectorRef); + super(formBuilder, authService, changeDetectorRef, manageUsersService); this.displayContactDetails = false; } diff --git a/packages/frontend/src/app/modules/usager-shared/interfaces/UsagerFormModel.ts b/packages/frontend/src/app/modules/usager-shared/interfaces/UsagerFormModel.ts index 709e9ecfb4..ea8c1cf86b 100644 --- a/packages/frontend/src/app/modules/usager-shared/interfaces/UsagerFormModel.ts +++ b/packages/frontend/src/app/modules/usager-shared/interfaces/UsagerFormModel.ts @@ -82,6 +82,7 @@ export class UsagerFormModel implements Usager { public nationalite: string | null; public nbNotes?: number = 0; + public referrerId?: number | null; constructor(usager?: Usager) { this.pinnedNote = usager?.pinnedNote || null; @@ -94,6 +95,7 @@ export class UsagerFormModel implements Usager { this.prenom = usager?.prenom || ""; this.langue = usager?.langue || ""; this.numeroDistribution = usager?.numeroDistribution || null; + this.referrerId = usager?.referrerId || null; this.surnom = usager?.surnom || ""; this.dateNaissance = usager?.dateNaissance diff --git a/packages/frontend/src/app/modules/usager-shared/pipes/referrer-name.pipe.ts b/packages/frontend/src/app/modules/usager-shared/pipes/referrer-name.pipe.ts new file mode 100644 index 0000000000..a4c5733342 --- /dev/null +++ b/packages/frontend/src/app/modules/usager-shared/pipes/referrer-name.pipe.ts @@ -0,0 +1,16 @@ +import { Pipe, PipeTransform } from "@angular/core"; +import { ManageUsersService } from "../../manage-users/services/manage-users.service"; + +@Pipe({ + name: "referrerName", +}) +export class ReferrerNamePipe implements PipeTransform { + constructor(private manageUsersService: ManageUsersService) {} + + transform(referrerId: number | null): string { + if (!referrerId) { + return "Aucun référent"; + } + return this.manageUsersService.referrersMap[referrerId] || "Aucun référent"; + } +} diff --git a/packages/frontend/src/app/modules/usager-shared/usager-shared.module.ts b/packages/frontend/src/app/modules/usager-shared/usager-shared.module.ts index e6f5e632a1..d699cd5779 100644 --- a/packages/frontend/src/app/modules/usager-shared/usager-shared.module.ts +++ b/packages/frontend/src/app/modules/usager-shared/usager-shared.module.ts @@ -37,6 +37,7 @@ import { SortArrayPipe } from "../shared/pipes"; import { DisplayTableImageComponent } from "../shared/components/display-table-image/display-table-image.component"; import { UsagerNomCompletPipe } from "./pipes"; import { EditUsagerDocComponent } from "./components/edit-usager-doc/edit-usager-doc.component"; +import { ReferrerNamePipe } from "./pipes/referrer-name.pipe"; @NgModule({ declarations: [ @@ -57,6 +58,7 @@ import { EditUsagerDocComponent } from "./components/edit-usager-doc/edit-usager SetInteractionOutFormComponent, UploadComponent, EditUsagerDocComponent, + ReferrerNamePipe, ], imports: [ CommonModule, @@ -75,6 +77,7 @@ import { EditUsagerDocComponent } from "./components/edit-usager-doc/edit-usager ], exports: [ DecisionRadiationFormComponent, + ReferrerNamePipe, DeleteUsagerComponent, DeleteUsagerMenuComponent, DisplayAyantsDroitsComponent, diff --git a/packages/frontend/src/app/modules/users/components/reset-password/reset-password.component.ts b/packages/frontend/src/app/modules/users/components/reset-password/reset-password.component.ts index 8e911592e1..51a78fc9ff 100644 --- a/packages/frontend/src/app/modules/users/components/reset-password/reset-password.component.ts +++ b/packages/frontend/src/app/modules/users/components/reset-password/reset-password.component.ts @@ -66,7 +66,7 @@ export class ResetPasswordComponent implements OnInit, OnDestroy { } public ngOnInit(): void { - this.titleService.setTitle("Renouveller mon mot de passe DomiFa"); + this.titleService.setTitle("Renouveler mon mot de passe DomiFa"); if (this.route.snapshot.params.token) { const token = this.route.snapshot.params.token; diff --git a/packages/frontend/src/app/modules/users/services/users.service.ts b/packages/frontend/src/app/modules/users/services/users.service.ts index 3bd232a732..35e96f2314 100644 --- a/packages/frontend/src/app/modules/users/services/users.service.ts +++ b/packages/frontend/src/app/modules/users/services/users.service.ts @@ -1,16 +1,8 @@ import { HttpClient } from "@angular/common/http"; import { Injectable } from "@angular/core"; import { Observable } from "rxjs"; -import { map } from "rxjs/operators"; import { environment } from "src/environments/environment"; -import { - UsagerLight, - UserStructureEditProfile, - UserStructureProfile, -} from "../../../../_common/model"; -import { userStructureBuilder } from "./userStructureBuilder.service"; - -import { UserStructure, ApiMessage, UserStructureRole } from "@domifa/common"; +import { ApiMessage } from "@domifa/common"; @Injectable({ providedIn: "root", @@ -26,42 +18,10 @@ export class UsersService { }); } - public patch(userInfos: UserStructureEditProfile): Observable { - return this.http.patch(`${this.endPoint}`, userInfos).pipe( - map((response) => { - return userStructureBuilder.buildUserStructure(response); - }) - ); - } - - public getUsers(): Observable { - return this.http.get(`${this.endPoint}`); - } - - public updateRole( - uuid: string, - role: UserStructureRole - ): Observable { - return this.http.patch( - `${this.endPoint}/update-role/${uuid}`, - { - role, - } - ); - } - - public deleteUser(uuid: string): Observable { - return this.http.delete(`${this.endPoint}/${uuid}`); - } - public getPasswordToken(data: string) { return this.http.post(`${this.endPoint}/get-password-token`, data); } - public getLastPasswordUpdate(): Observable { - return this.http.get(`${this.endPoint}/last-password-update`); - } - public checkPasswordToken({ userId, token, @@ -83,22 +43,7 @@ export class UsersService { return this.http.post(`${this.endPoint}/reset-password`, data); } - public updateMyPassword(data: { - passwordConfirmation: string; - password: string; - oldPassword: string; - }): Observable { - return this.http.post( - `${this.endPoint}/edit-my-password`, - data - ); - } - public registerUser(data: string): Observable { return this.http.post(`${this.endPoint}/register`, data); } - - public agenda(): Observable { - return this.http.get(`${environment.apiUrl}agenda`); - } } diff --git a/packages/frontend/src/app/modules/users/users-routing.module.ts b/packages/frontend/src/app/modules/users/users-routing.module.ts index cb7ea2c340..c0c98e3a70 100644 --- a/packages/frontend/src/app/modules/users/users-routing.module.ts +++ b/packages/frontend/src/app/modules/users/users-routing.module.ts @@ -1,22 +1,17 @@ import { NgModule } from "@angular/core"; import { Routes, RouterModule } from "@angular/router"; -import { AuthGuard, LoggedGuard, ResponsableGuard } from "../../guards"; -import { EditUserComponent } from "./components/edit-user/edit-user.component"; +import { LoggedGuard } from "../../guards"; import { ResetPasswordComponent } from "./components/reset-password/reset-password.component"; -import { UserProfilComponent } from "./components/user-profil/user-profil.component"; const routes: Routes = [ { - canActivate: [AuthGuard], path: "mon-compte", - component: EditUserComponent, + redirectTo: "/manage-users/my-account", }, - { - canActivate: [AuthGuard, ResponsableGuard], - component: UserProfilComponent, path: "comptes", + redirectTo: "/manage-users/accounts", }, { canActivate: [LoggedGuard], diff --git a/packages/frontend/src/app/modules/users/users.module.ts b/packages/frontend/src/app/modules/users/users.module.ts index 1135682059..2a17a77bff 100644 --- a/packages/frontend/src/app/modules/users/users.module.ts +++ b/packages/frontend/src/app/modules/users/users.module.ts @@ -6,27 +6,15 @@ import { FormsModule, ReactiveFormsModule } from "@angular/forms"; import { NgbModule } from "@ng-bootstrap/ng-bootstrap"; import { ResetPasswordComponent } from "./components/reset-password/reset-password.component"; -import { UserProfilComponent } from "./components/user-profil/user-profil.component"; -import { RegisterUserAdminComponent } from "./components/register-user-admin/register-user-admin.component"; -import { EditUserComponent } from "./components/edit-user/edit-user.component"; import { SharedModule } from "../shared/shared.module"; -import { UsersRoutingModule } from "./users-routing.module"; import { UserStructurePasswordFormComponent } from "./components/user-structure-password-form/user-structure-password-form.component"; -import { TableHeadSortComponent } from "../shared/components/table-head-sort/table-head-sort.component"; -import { SortArrayPipe } from "../shared/pipes"; +import { UsersRoutingModule } from "./users-routing.module"; @NgModule({ - declarations: [ - ResetPasswordComponent, - UserProfilComponent, - RegisterUserAdminComponent, - EditUserComponent, - UserStructurePasswordFormComponent, - ], + declarations: [ResetPasswordComponent, UserStructurePasswordFormComponent], exports: [UserStructurePasswordFormComponent], imports: [ - TableHeadSortComponent, FormsModule, HttpClientModule, NgbModule, @@ -34,7 +22,6 @@ import { SortArrayPipe } from "../shared/pipes"; SharedModule, CommonModule, UsersRoutingModule, - SortArrayPipe, ], providers: [], schemas: [CUSTOM_ELEMENTS_SCHEMA],