From 61487afc6057a62d4c9a7d274619176de926c740 Mon Sep 17 00:00:00 2001 From: Yassine R Date: Mon, 30 Oct 2023 12:53:39 +0100 Subject: [PATCH] refactor(common): merge common types & interfaces --- packages/backend/package.json | 2 +- .../_common/model/_core/ApiMessage.type.ts | 1 - .../backend/src/_common/model/_core/index.ts | 1 - .../PortailUsagerPublic.type.ts | 5 ++-- .../src/_common/model/usager/Usager.type.ts | 10 ++++--- .../usager/UsagerLastInteractions.type.ts | 7 ----- .../_common/model/usager/UsagerNote.type.ts | 2 +- .../history/UsagerHistoryImport.type.ts | 3 +-- .../usager/history/UsagerHistoryState.type.ts | 2 +- .../backend/src/_common/model/usager/index.ts | 1 - .../user-structure/UserStructure.type.ts | 3 +-- .../user-structure/UserStructureMails.type.ts | 4 --- .../UserStructureResume.type.ts | 4 --- .../src/_common/model/user-structure/index.ts | 4 +-- .../model/user-usager/UserUsager.type.ts | 2 +- .../usager/UsagerNotesTable.typeorm.ts | 4 +-- .../entities/usager/UsagerTable.typeorm.ts | 10 ++++--- .../UserStructureTable.typeorm.ts | 4 +-- .../user-usager/UserUsagerTable.typeorm.ts | 4 +-- .../controllers/usager-notes.controller.ts | 2 +- .../usagerHistoryStateManager.service.ts | 9 ++----- packages/common/src/index.ts | 4 +-- ....ts => UsagerLastInteraction.interface.ts} | 2 +- .../common/src/usager/interfaces/index.ts | 2 +- .../src/{user => user-structure}/index.ts | 1 + .../UserStructureMails.interface.ts | 4 +++ .../UserStructureResume.interface.ts} | 4 +-- .../src/user-structure/interfaces/index.ts | 3 +++ .../types/UserStructureRole.type.ts | 0 .../{user => user-structure}/types/index.ts | 0 packages/frontend/package.json | 2 +- .../src/_common/mocks/USER_STRUCTURE.mock.ts | 4 +-- .../_common/model/_general/ApiMessage.type.ts | 1 - .../src/_common/model/_general/index.ts | 1 - .../src/_common/model/usager/Usager.type.ts | 5 ++-- .../usager/UsagerLastInteractions.type.ts | 7 ----- .../_common/model/usager/UsagerNote.type.ts | 2 +- .../usager/history/UsagerHistory.type.ts | 14 ---------- .../history/UsagerHistoryImport.type.ts | 6 ----- .../usager/history/UsagerHistoryState.type.ts | 18 ------------- .../UsagerHistoryStateCreationEvent.type.ts | 5 ---- .../src/_common/model/usager/history/index.ts | 5 ---- .../src/_common/model/usager/index.ts | 2 -- .../user-structure/UserStructure.type.ts | 3 +-- .../user-structure/UserStructureMails.type.ts | 4 --- .../user-structure/UserStructureRole.type.ts | 1 - .../UserStructureTokens.type.ts | 5 ---- .../src/_common/model/user-structure/index.ts | 4 --- .../profil-historique.component.ts | 12 +-------- .../services/usager-profil.service.ts | 3 ++- .../services/usager-decision.service.ts | 9 ------- .../user-profil/user-profil.component.ts | 2 +- .../modules/users/services/users.service.ts | 3 +-- packages/frontend/src/assets/files/news.json | 27 +++++++++++++++++++ 54 files changed, 86 insertions(+), 163 deletions(-) delete mode 100644 packages/backend/src/_common/model/_core/ApiMessage.type.ts delete mode 100644 packages/backend/src/_common/model/usager/UsagerLastInteractions.type.ts delete mode 100644 packages/backend/src/_common/model/user-structure/UserStructureMails.type.ts delete mode 100644 packages/backend/src/_common/model/user-structure/UserStructureResume.type.ts rename packages/common/src/usager/interfaces/{UsagerLastInteractions.interface.ts => UsagerLastInteraction.interface.ts} (73%) rename packages/common/src/{user => user-structure}/index.ts (71%) create mode 100644 packages/common/src/user-structure/interfaces/UserStructureMails.interface.ts rename packages/{frontend/src/_common/model/user-structure/UserStructureResume.type.ts => common/src/user-structure/interfaces/UserStructureResume.interface.ts} (68%) create mode 100644 packages/common/src/user-structure/interfaces/index.ts rename packages/common/src/{user => user-structure}/types/UserStructureRole.type.ts (100%) rename packages/common/src/{user => user-structure}/types/index.ts (100%) delete mode 100644 packages/frontend/src/_common/model/_general/ApiMessage.type.ts delete mode 100644 packages/frontend/src/_common/model/usager/UsagerLastInteractions.type.ts delete mode 100644 packages/frontend/src/_common/model/usager/history/UsagerHistory.type.ts delete mode 100644 packages/frontend/src/_common/model/usager/history/UsagerHistoryImport.type.ts delete mode 100644 packages/frontend/src/_common/model/usager/history/UsagerHistoryState.type.ts delete mode 100644 packages/frontend/src/_common/model/usager/history/UsagerHistoryStateCreationEvent.type.ts delete mode 100644 packages/frontend/src/_common/model/usager/history/index.ts delete mode 100644 packages/frontend/src/_common/model/user-structure/UserStructureMails.type.ts delete mode 100644 packages/frontend/src/_common/model/user-structure/UserStructureRole.type.ts delete mode 100644 packages/frontend/src/_common/model/user-structure/UserStructureTokens.type.ts diff --git a/packages/backend/package.json b/packages/backend/package.json index 835f68de41..1085052e38 100644 --- a/packages/backend/package.json +++ b/packages/backend/package.json @@ -1,7 +1,7 @@ { "name": "@domifa/backend", "private": true, - "version": "2.140.5", + "version": "2.141.0", "description": "", "author": "", "license": "MIT", diff --git a/packages/backend/src/_common/model/_core/ApiMessage.type.ts b/packages/backend/src/_common/model/_core/ApiMessage.type.ts deleted file mode 100644 index e110311c12..0000000000 --- a/packages/backend/src/_common/model/_core/ApiMessage.type.ts +++ /dev/null @@ -1 +0,0 @@ -export type ApiMessage = { message: string }; diff --git a/packages/backend/src/_common/model/_core/index.ts b/packages/backend/src/_common/model/_core/index.ts index 077e42eed1..64fdd18590 100644 --- a/packages/backend/src/_common/model/_core/index.ts +++ b/packages/backend/src/_common/model/_core/index.ts @@ -1,3 +1,2 @@ //@index('./*', f => `export * from '${f.path}'`) -export * from "./ApiMessage.type"; export * from "./AppEntity.type"; diff --git a/packages/backend/src/_common/model/_portail-usager/PortailUsagerPublic.type.ts b/packages/backend/src/_common/model/_portail-usager/PortailUsagerPublic.type.ts index 45ad8374c7..8838665b1d 100644 --- a/packages/backend/src/_common/model/_portail-usager/PortailUsagerPublic.type.ts +++ b/packages/backend/src/_common/model/_portail-usager/PortailUsagerPublic.type.ts @@ -2,12 +2,11 @@ import { Telephone } from "./../telephone/Telephone.type"; import { UsagerAyantDroit, UsagerDecision, - UsagerLastInteractions, UsagerOptions, UsagerTypeDom, } from ".."; import { AppEntity } from "../_core"; -import { UsagerRdv, UsagerSexe } from "@domifa/common"; +import { UsagerRdv, UsagerSexe, UsagerLastInteraction } from "@domifa/common"; export type PortailUsagerPublic = AppEntity & { customRef: string; // valeur par défaut: 'ref' @@ -45,7 +44,7 @@ export type PortailUsagerPublic = AppEntity & { historique: UsagerDecision[]; // INTERACTIONS - lastInteraction: UsagerLastInteractions; + lastInteraction: UsagerLastInteraction; options: UsagerOptions; }; diff --git a/packages/backend/src/_common/model/usager/Usager.type.ts b/packages/backend/src/_common/model/usager/Usager.type.ts index 3d545a2e16..889d760005 100644 --- a/packages/backend/src/_common/model/usager/Usager.type.ts +++ b/packages/backend/src/_common/model/usager/Usager.type.ts @@ -2,13 +2,17 @@ import { AppEntity } from "../_core/AppEntity.type"; import { UsagerAyantDroit } from "./UsagerAyantDroit.type"; import { UsagerDecision } from "./UsagerDecision.type"; import { UsagerImport } from "./UsagerImport.type"; -import { UsagerLastInteractions } from "./UsagerLastInteractions.type"; import { UsagerNote } from "./UsagerNote.type"; import { UsagerOptions } from "./options/UsagerOptions.type"; import { UsagerTypeDom } from "./UsagerTypeDom.type"; import { Telephone } from "../telephone/Telephone.type"; -import { UsagerEntretien, UsagerRdv, UsagerSexe } from "@domifa/common"; +import { + UsagerLastInteraction, + UsagerEntretien, + UsagerRdv, + UsagerSexe, +} from "@domifa/common"; export type Usager = AppEntity & { ref: number; // unique par structure @@ -52,7 +56,7 @@ export type Usager = AppEntity & { numeroDistribution: string | null; // INTERACTIONS - lastInteraction: UsagerLastInteractions; + lastInteraction: UsagerLastInteraction; options: UsagerOptions; migrated?: boolean; diff --git a/packages/backend/src/_common/model/usager/UsagerLastInteractions.type.ts b/packages/backend/src/_common/model/usager/UsagerLastInteractions.type.ts deleted file mode 100644 index 9c26e932be..0000000000 --- a/packages/backend/src/_common/model/usager/UsagerLastInteractions.type.ts +++ /dev/null @@ -1,7 +0,0 @@ -export type UsagerLastInteractions = { - dateInteraction: Date; - enAttente: boolean; - courrierIn: number; - recommandeIn: number; - colisIn: number; -}; diff --git a/packages/backend/src/_common/model/usager/UsagerNote.type.ts b/packages/backend/src/_common/model/usager/UsagerNote.type.ts index 9393ba1ea7..60ad19b292 100644 --- a/packages/backend/src/_common/model/usager/UsagerNote.type.ts +++ b/packages/backend/src/_common/model/usager/UsagerNote.type.ts @@ -1,4 +1,4 @@ -import { UserStructureResume } from "../user-structure/UserStructureResume.type"; +import { UserStructureResume } from "@domifa/common"; export type UsagerNote = { id: number; diff --git a/packages/backend/src/_common/model/usager/history/UsagerHistoryImport.type.ts b/packages/backend/src/_common/model/usager/history/UsagerHistoryImport.type.ts index 9712b4e53a..771241bc02 100644 --- a/packages/backend/src/_common/model/usager/history/UsagerHistoryImport.type.ts +++ b/packages/backend/src/_common/model/usager/history/UsagerHistoryImport.type.ts @@ -1,5 +1,4 @@ -import { UserStructureResume } from "../../user-structure/UserStructureResume.type"; - +import { UserStructureResume } from "@domifa/common"; export type UsagerHistoryImport = { createdAt: Date; createdBy: UserStructureResume; diff --git a/packages/backend/src/_common/model/usager/history/UsagerHistoryState.type.ts b/packages/backend/src/_common/model/usager/history/UsagerHistoryState.type.ts index 1936a89cd8..9f878c5bba 100644 --- a/packages/backend/src/_common/model/usager/history/UsagerHistoryState.type.ts +++ b/packages/backend/src/_common/model/usager/history/UsagerHistoryState.type.ts @@ -1,4 +1,4 @@ -import { UserStructureResume } from "../../user-structure/UserStructureResume.type"; +import { UserStructureResume } from "@domifa/common"; import { Usager } from "../Usager.type"; import { UsagerHistoryStateCreationEvent } from "./UsagerHistoryStateCreationEvent.type"; diff --git a/packages/backend/src/_common/model/usager/index.ts b/packages/backend/src/_common/model/usager/index.ts index 009bddb4ef..61b8fabf91 100644 --- a/packages/backend/src/_common/model/usager/index.ts +++ b/packages/backend/src/_common/model/usager/index.ts @@ -7,7 +7,6 @@ export * from "./UsagerAyantDroit.type"; export * from "./UsagerDecision.type"; export * from "./UsagerDoc.type"; export * from "./UsagerImport.type"; -export * from "./UsagerLastInteractions.type"; export * from "./UsagerLight.type"; export * from "./UsagerNote.type"; export * from "./UsagerTypeDom.type"; diff --git a/packages/backend/src/_common/model/user-structure/UserStructure.type.ts b/packages/backend/src/_common/model/user-structure/UserStructure.type.ts index 7b2b523a59..dee06ad4ba 100644 --- a/packages/backend/src/_common/model/user-structure/UserStructure.type.ts +++ b/packages/backend/src/_common/model/user-structure/UserStructure.type.ts @@ -1,7 +1,6 @@ import { StructureCommon } from "../structure/StructureCommon.type"; import { AppEntity } from "../_core/AppEntity.type"; -import { UserStructureMails } from "./UserStructureMails.type"; -import { UserStructureRole } from "@domifa/common"; +import { UserStructureRole, UserStructureMails } from "@domifa/common"; export type UserStructure = AppEntity & { id: number; diff --git a/packages/backend/src/_common/model/user-structure/UserStructureMails.type.ts b/packages/backend/src/_common/model/user-structure/UserStructureMails.type.ts deleted file mode 100644 index 33ea80a441..0000000000 --- a/packages/backend/src/_common/model/user-structure/UserStructureMails.type.ts +++ /dev/null @@ -1,4 +0,0 @@ -export type UserStructureMails = { - guide: boolean; - import: boolean; -}; diff --git a/packages/backend/src/_common/model/user-structure/UserStructureResume.type.ts b/packages/backend/src/_common/model/user-structure/UserStructureResume.type.ts deleted file mode 100644 index 53bbc8ab33..0000000000 --- a/packages/backend/src/_common/model/user-structure/UserStructureResume.type.ts +++ /dev/null @@ -1,4 +0,0 @@ -export type UserStructureResume = { - userId: number; // UserStructure.id - userName: string; // UserStructure.nom / prenom -}; diff --git a/packages/backend/src/_common/model/user-structure/index.ts b/packages/backend/src/_common/model/user-structure/index.ts index 20108719d2..e203eb4edf 100644 --- a/packages/backend/src/_common/model/user-structure/index.ts +++ b/packages/backend/src/_common/model/user-structure/index.ts @@ -1,12 +1,10 @@ // @index('./*', f => `export * from '${f.path}'`) -export * from "./_constants/USER_STRUCTURE_ROLE_ALL.const"; +export * from "./_constants"; export * from "./UserStructure.type"; export * from "./UserStructureAuthenticated.type"; export * from "./UserStructureCreatedBy.type"; -export * from "./UserStructureMails.type"; export * from "./UserStructureProfile.type"; export * from "./UserStructurePublic.type"; -export * from "./UserStructureResume.type"; export * from "./UserStructureSecurity.type"; export * from "./UserStructureSecurityEvent.type"; export * from "./UserStructureSecurityEventType.type"; diff --git a/packages/backend/src/_common/model/user-usager/UserUsager.type.ts b/packages/backend/src/_common/model/user-usager/UserUsager.type.ts index 324de45ca9..d21a7aac95 100644 --- a/packages/backend/src/_common/model/user-usager/UserUsager.type.ts +++ b/packages/backend/src/_common/model/user-usager/UserUsager.type.ts @@ -1,4 +1,4 @@ -import { UserStructureResume } from "../user-structure/UserStructureResume.type"; +import { UserStructureResume } from "@domifa/common"; import { AppEntity } from "../_core/AppEntity.type"; export type UserUsager = AppEntity & { diff --git a/packages/backend/src/database/entities/usager/UsagerNotesTable.typeorm.ts b/packages/backend/src/database/entities/usager/UsagerNotesTable.typeorm.ts index f91832ad31..eef7c13d73 100644 --- a/packages/backend/src/database/entities/usager/UsagerNotesTable.typeorm.ts +++ b/packages/backend/src/database/entities/usager/UsagerNotesTable.typeorm.ts @@ -10,8 +10,8 @@ import { import { AppTypeormTable } from "../_core/AppTypeormTable.typeorm"; import { StructureTable } from "../structure"; import { UsagerTable } from "./UsagerTable.typeorm"; -import { UsagerNote, UserStructureResume } from "../../../_common/model"; - +import { UsagerNote } from "../../../_common/model"; +import { UserStructureResume } from "@domifa/common"; // https://typeorm.io/#/entities/column-types-for-postgres @Entity({ name: "usager_notes" }) export class UsagerNotesTable diff --git a/packages/backend/src/database/entities/usager/UsagerTable.typeorm.ts b/packages/backend/src/database/entities/usager/UsagerTable.typeorm.ts index 3619c08695..4ac4512654 100644 --- a/packages/backend/src/database/entities/usager/UsagerTable.typeorm.ts +++ b/packages/backend/src/database/entities/usager/UsagerTable.typeorm.ts @@ -11,7 +11,6 @@ import { } from "typeorm"; import { Usager, - UsagerLastInteractions, UsagerOptions, UsagerTypeDom, Telephone, @@ -24,7 +23,12 @@ import { StructureTable } from "../structure/StructureTable.typeorm"; import { AppTypeormTable } from "../_core/AppTypeormTable.typeorm"; import { UsagerImport } from "./../../../_common/model/usager/UsagerImport.type"; import { UsagerNotesTable } from "./UsagerNotesTable.typeorm"; -import { UsagerEntretien, UsagerRdv, UsagerSexe } from "@domifa/common"; +import { + UsagerEntretien, + UsagerRdv, + UsagerSexe, + UsagerLastInteraction, +} from "@domifa/common"; // https://typeorm.io/#/entities/column-types-for-postgres @Entity({ name: "usager" }) @@ -108,7 +112,7 @@ export class UsagerTable default: '{"dateInteraction":"NOW()", "enAttente":"false", "courrierIn":"0", "recommandeIn":"0", "colisIn":"0"}', }) - public lastInteraction!: UsagerLastInteractions; + public lastInteraction!: UsagerLastInteraction; @Column({ type: "integer", default: 0 }) public etapeDemande!: number; diff --git a/packages/backend/src/database/entities/user-structure/UserStructureTable.typeorm.ts b/packages/backend/src/database/entities/user-structure/UserStructureTable.typeorm.ts index 55da8312aa..634ab169a7 100644 --- a/packages/backend/src/database/entities/user-structure/UserStructureTable.typeorm.ts +++ b/packages/backend/src/database/entities/user-structure/UserStructureTable.typeorm.ts @@ -9,9 +9,9 @@ import { } from "typeorm"; import { titleCase } from "typeorm/util/StringUtils"; import { StructureTable } from ".."; -import { UserStructure, UserStructureMails } from "../../../_common/model"; +import { UserStructure } from "../../../_common/model"; import { AppTypeormTable } from "../_core/AppTypeormTable.typeorm"; -import { UserStructureRole } from "@domifa/common"; +import { UserStructureRole, UserStructureMails } from "@domifa/common"; // https://typeorm.io/#/entities/column-types-for-postgres @Entity({ name: "user_structure" }) diff --git a/packages/backend/src/database/entities/user-usager/UserUsagerTable.typeorm.ts b/packages/backend/src/database/entities/user-usager/UserUsagerTable.typeorm.ts index 0ecb77cb88..bd08c5fec4 100644 --- a/packages/backend/src/database/entities/user-usager/UserUsagerTable.typeorm.ts +++ b/packages/backend/src/database/entities/user-usager/UserUsagerTable.typeorm.ts @@ -8,8 +8,8 @@ import { OneToOne, } from "typeorm"; import { StructureTable, UsagerTable } from ".."; - -import { UserStructureResume, UserUsager } from "../../../_common/model"; +import { UserStructureResume } from "@domifa/common"; +import { UserUsager } from "../../../_common/model"; import { AppTypeormTable } from "../_core/AppTypeormTable.typeorm"; // https://typeorm.io/#/entities/column-types-for-postgres diff --git a/packages/backend/src/usagers/controllers/usager-notes.controller.ts b/packages/backend/src/usagers/controllers/usager-notes.controller.ts index 6d8e7af94b..e19e8da02b 100644 --- a/packages/backend/src/usagers/controllers/usager-notes.controller.ts +++ b/packages/backend/src/usagers/controllers/usager-notes.controller.ts @@ -22,8 +22,8 @@ import { Usager, UsagerNote, UserStructureAuthenticated, - UserStructureResume, } from "../../_common/model"; +import { UserStructureResume } from "@domifa/common"; import { CreateNoteDto } from "../dto/create-note.dto"; import { AppLogTable, diff --git a/packages/backend/src/usagers/services/usagerHistoryStateManager.service.ts b/packages/backend/src/usagers/services/usagerHistoryStateManager.service.ts index 9de697457c..634878ab81 100644 --- a/packages/backend/src/usagers/services/usagerHistoryStateManager.service.ts +++ b/packages/backend/src/usagers/services/usagerHistoryStateManager.service.ts @@ -1,12 +1,7 @@ import { UsagerHistoryTable } from "../../database/entities/usager/UsagerHistoryTable.typeorm"; import { usagerHistoryRepository } from "../../database/services/usager/usagerHistoryRepository.service"; - -import { - Usager, - UsagerHistory, - UsagerHistoryState, - UserStructureResume, -} from "../../_common/model"; +import { UserStructureResume } from "@domifa/common"; +import { Usager, UsagerHistory, UsagerHistoryState } from "../../_common/model"; import { UsagerHistoryStateCreationEvent } from "../../_common/model/usager/history/UsagerHistoryStateCreationEvent.type"; import { v4 as uuidv4 } from "uuid"; import { endOfDay, startOfDay, subDays } from "date-fns"; diff --git a/packages/common/src/index.ts b/packages/common/src/index.ts index 677bf1a29b..01cbad8c20 100644 --- a/packages/common/src/index.ts +++ b/packages/common/src/index.ts @@ -1,5 +1,5 @@ // @index('./*', f => `export * from '${f.path}'`) export * from "./_core"; -export * from "./usager"; export * from "./structure"; -export * from "./user"; +export * from "./usager"; +export * from "./user-structure"; diff --git a/packages/common/src/usager/interfaces/UsagerLastInteractions.interface.ts b/packages/common/src/usager/interfaces/UsagerLastInteraction.interface.ts similarity index 73% rename from packages/common/src/usager/interfaces/UsagerLastInteractions.interface.ts rename to packages/common/src/usager/interfaces/UsagerLastInteraction.interface.ts index 81e2b2549d..7fb85752ed 100644 --- a/packages/common/src/usager/interfaces/UsagerLastInteractions.interface.ts +++ b/packages/common/src/usager/interfaces/UsagerLastInteraction.interface.ts @@ -1,4 +1,4 @@ -export interface UsagerLastInteractions { +export interface UsagerLastInteraction { dateInteraction: Date; enAttente: boolean; courrierIn: number; diff --git a/packages/common/src/usager/interfaces/index.ts b/packages/common/src/usager/interfaces/index.ts index 0a9b2927a1..28ca2a14d7 100644 --- a/packages/common/src/usager/interfaces/index.ts +++ b/packages/common/src/usager/interfaces/index.ts @@ -3,5 +3,5 @@ export * from "./UsagerAyantDroit.interface"; export * from "./UsagerDecision.interface"; export * from "./UsagerDoc.interface"; export * from "./UsagerEntretien.interface"; -export * from "./UsagerLastInteractions.interface"; +export * from "./UsagerLastInteraction.interface"; export * from "./UsagerRdv.interface"; diff --git a/packages/common/src/user/index.ts b/packages/common/src/user-structure/index.ts similarity index 71% rename from packages/common/src/user/index.ts rename to packages/common/src/user-structure/index.ts index 7d4a3015fb..67d4c13b24 100644 --- a/packages/common/src/user/index.ts +++ b/packages/common/src/user-structure/index.ts @@ -1,2 +1,3 @@ // @index('./*', f => `export * from '${f.path}'`) +export * from "./interfaces"; export * from "./types"; diff --git a/packages/common/src/user-structure/interfaces/UserStructureMails.interface.ts b/packages/common/src/user-structure/interfaces/UserStructureMails.interface.ts new file mode 100644 index 0000000000..47cd030a9a --- /dev/null +++ b/packages/common/src/user-structure/interfaces/UserStructureMails.interface.ts @@ -0,0 +1,4 @@ +export interface UserStructureMails { + guide: boolean; + import: boolean; +} diff --git a/packages/frontend/src/_common/model/user-structure/UserStructureResume.type.ts b/packages/common/src/user-structure/interfaces/UserStructureResume.interface.ts similarity index 68% rename from packages/frontend/src/_common/model/user-structure/UserStructureResume.type.ts rename to packages/common/src/user-structure/interfaces/UserStructureResume.interface.ts index 53bbc8ab33..7ab6f940bf 100644 --- a/packages/frontend/src/_common/model/user-structure/UserStructureResume.type.ts +++ b/packages/common/src/user-structure/interfaces/UserStructureResume.interface.ts @@ -1,4 +1,4 @@ -export type UserStructureResume = { +export interface UserStructureResume { userId: number; // UserStructure.id userName: string; // UserStructure.nom / prenom -}; +} diff --git a/packages/common/src/user-structure/interfaces/index.ts b/packages/common/src/user-structure/interfaces/index.ts new file mode 100644 index 0000000000..7e2ac6860f --- /dev/null +++ b/packages/common/src/user-structure/interfaces/index.ts @@ -0,0 +1,3 @@ +// @index('./*', f => `export * from '${f.path}'`) +export * from "./UserStructureMails.interface"; +export * from "./UserStructureResume.interface"; diff --git a/packages/common/src/user/types/UserStructureRole.type.ts b/packages/common/src/user-structure/types/UserStructureRole.type.ts similarity index 100% rename from packages/common/src/user/types/UserStructureRole.type.ts rename to packages/common/src/user-structure/types/UserStructureRole.type.ts diff --git a/packages/common/src/user/types/index.ts b/packages/common/src/user-structure/types/index.ts similarity index 100% rename from packages/common/src/user/types/index.ts rename to packages/common/src/user-structure/types/index.ts diff --git a/packages/frontend/package.json b/packages/frontend/package.json index 29f34ef8db..d920a49b60 100644 --- a/packages/frontend/package.json +++ b/packages/frontend/package.json @@ -1,6 +1,6 @@ { "name": "@domifa/frontend", - "version": "2.140.5", + "version": "2.141.0", "main": "index.js", "author": "Incubateur des Ministères Sociaux (https://incubateur.social.gouv.fr)", "license": "Apache-2.0", diff --git a/packages/frontend/src/_common/mocks/USER_STRUCTURE.mock.ts b/packages/frontend/src/_common/mocks/USER_STRUCTURE.mock.ts index 283daa70b2..e61200b5c5 100644 --- a/packages/frontend/src/_common/mocks/USER_STRUCTURE.mock.ts +++ b/packages/frontend/src/_common/mocks/USER_STRUCTURE.mock.ts @@ -1,6 +1,6 @@ import { CountryISO } from "ngx-intl-tel-input"; -import { UserStructure, UserStructureRole } from "../model"; -import { StructureType } from "@domifa/common"; +import { UserStructure } from "../model"; +import { StructureType, UserStructureRole } from "@domifa/common"; export const USER_STRUCTURE_MOCK: UserStructure = { password: "xxx", diff --git a/packages/frontend/src/_common/model/_general/ApiMessage.type.ts b/packages/frontend/src/_common/model/_general/ApiMessage.type.ts deleted file mode 100644 index e110311c12..0000000000 --- a/packages/frontend/src/_common/model/_general/ApiMessage.type.ts +++ /dev/null @@ -1 +0,0 @@ -export type ApiMessage = { message: string }; diff --git a/packages/frontend/src/_common/model/_general/index.ts b/packages/frontend/src/_common/model/_general/index.ts index 96ce5243f3..55a7e4b464 100644 --- a/packages/frontend/src/_common/model/_general/index.ts +++ b/packages/frontend/src/_common/model/_general/index.ts @@ -1,4 +1,3 @@ //@index('./*', f => `export * from '${f.path}'`) -export * from "./ApiMessage.type"; export * from "./DEFAULT_MODAL_OPTIONS.const"; export * from "./FormEmailTakenValidator.type"; diff --git a/packages/frontend/src/_common/model/usager/Usager.type.ts b/packages/frontend/src/_common/model/usager/Usager.type.ts index 48d4d31caa..3687380072 100644 --- a/packages/frontend/src/_common/model/usager/Usager.type.ts +++ b/packages/frontend/src/_common/model/usager/Usager.type.ts @@ -9,7 +9,7 @@ import { UsagerEntretien } from "./entretien"; import { UsagerDecision } from "./decision/types/UsagerDecision.type"; import { UsagerImport } from "./UsagerImport.type"; -import { UsagerLastInteractions } from "./UsagerLastInteractions.type"; + import { UsagerNote } from "./UsagerNote.type"; import { UsagerOptions } from "./options/UsagerOptions.type"; @@ -18,6 +18,7 @@ import { UsagerRdv, UsagerSexe, UsagerTypeDom, + UsagerLastInteraction, } from "@domifa/common"; export type Usager = AppEntity & { @@ -59,7 +60,7 @@ export type Usager = AppEntity & { historique: UsagerDecision[]; // INTERACTIONS - lastInteraction: UsagerLastInteractions; + lastInteraction: UsagerLastInteraction; options: UsagerOptions; numeroDistribution: string | null; diff --git a/packages/frontend/src/_common/model/usager/UsagerLastInteractions.type.ts b/packages/frontend/src/_common/model/usager/UsagerLastInteractions.type.ts deleted file mode 100644 index 57b4115e19..0000000000 --- a/packages/frontend/src/_common/model/usager/UsagerLastInteractions.type.ts +++ /dev/null @@ -1,7 +0,0 @@ -export type UsagerLastInteractions = { - dateInteraction: Date | null; - enAttente: boolean; - courrierIn: number; - recommandeIn: number; - colisIn: number; -}; diff --git a/packages/frontend/src/_common/model/usager/UsagerNote.type.ts b/packages/frontend/src/_common/model/usager/UsagerNote.type.ts index 981e449bdc..f7dd371947 100644 --- a/packages/frontend/src/_common/model/usager/UsagerNote.type.ts +++ b/packages/frontend/src/_common/model/usager/UsagerNote.type.ts @@ -1,4 +1,4 @@ -import { UserStructureResume } from "../user-structure/UserStructureResume.type"; +import { UserStructureResume } from "@domifa/common"; export type UsagerNote = { id: number; diff --git a/packages/frontend/src/_common/model/usager/history/UsagerHistory.type.ts b/packages/frontend/src/_common/model/usager/history/UsagerHistory.type.ts deleted file mode 100644 index f2e8bcfd61..0000000000 --- a/packages/frontend/src/_common/model/usager/history/UsagerHistory.type.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { AppEntity } from "../../_core/AppEntity.type"; -import { UsagerHistoryImport } from "./UsagerHistoryImport.type"; -import { UsagerHistoryState } from "./UsagerHistoryState.type"; - -export type UsagerHistory = AppEntity & { - usagerUUID: string; // unique - usagerRef: number; // unique par structure - structureId: number; - - import?: UsagerHistoryImport; - // ces objets sont stockées au moment de leur créations, jamais modifiés par la suite (on stocke une nouvelle version) - // sauf en cas de suppression de la dernière décision (en cas de renouvellement annulé???) - states: UsagerHistoryState[]; -}; diff --git a/packages/frontend/src/_common/model/usager/history/UsagerHistoryImport.type.ts b/packages/frontend/src/_common/model/usager/history/UsagerHistoryImport.type.ts deleted file mode 100644 index 9712b4e53a..0000000000 --- a/packages/frontend/src/_common/model/usager/history/UsagerHistoryImport.type.ts +++ /dev/null @@ -1,6 +0,0 @@ -import { UserStructureResume } from "../../user-structure/UserStructureResume.type"; - -export type UsagerHistoryImport = { - createdAt: Date; - createdBy: UserStructureResume; -}; diff --git a/packages/frontend/src/_common/model/usager/history/UsagerHistoryState.type.ts b/packages/frontend/src/_common/model/usager/history/UsagerHistoryState.type.ts deleted file mode 100644 index 1936a89cd8..0000000000 --- a/packages/frontend/src/_common/model/usager/history/UsagerHistoryState.type.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { UserStructureResume } from "../../user-structure/UserStructureResume.type"; -import { Usager } from "../Usager.type"; -import { UsagerHistoryStateCreationEvent } from "./UsagerHistoryStateCreationEvent.type"; - -// état d'un usager pendant une période, change à chaque modification (décision, entretien, ayants droits) -// les UsagerHistoryState ne se chevauchent pas, mais se succèdent -export type UsagerHistoryState = Pick< - Usager, - "decision" | "entretien" | "ayantsDroits" | "etapeDemande" | "rdv" | "typeDom" -> & { - uuid: string; - createdAt: Date; - createdBy: UserStructureResume; - createdEvent: UsagerHistoryStateCreationEvent; - historyBeginDate: Date; // début de la période historisée, correspond à l'attribut "historyEndDate" du UsagerHistoryState précédent si il existe (sans rapport avec decision.dateDebut) - historyEndDate?: Date; // fin de la période historisée, correspond à l'attribut "historyBeginDate" du UsagerHistoryState suivant - isActive: boolean; // usager actif si VALIDE ou en cours de renouvellement -}; diff --git a/packages/frontend/src/_common/model/usager/history/UsagerHistoryStateCreationEvent.type.ts b/packages/frontend/src/_common/model/usager/history/UsagerHistoryStateCreationEvent.type.ts deleted file mode 100644 index 5b6fa42a39..0000000000 --- a/packages/frontend/src/_common/model/usager/history/UsagerHistoryStateCreationEvent.type.ts +++ /dev/null @@ -1,5 +0,0 @@ -export type UsagerHistoryStateCreationEvent = - | "new-decision" - | "delete-decision" - | "update-entretien" - | "update-usager"; diff --git a/packages/frontend/src/_common/model/usager/history/index.ts b/packages/frontend/src/_common/model/usager/history/index.ts deleted file mode 100644 index 4a9952a807..0000000000 --- a/packages/frontend/src/_common/model/usager/history/index.ts +++ /dev/null @@ -1,5 +0,0 @@ -//@index('./*', f => `export * from '${f.path}'`) -export * from "./UsagerHistory.type"; -export * from "./UsagerHistoryImport.type"; -export * from "./UsagerHistoryState.type"; -export * from "./UsagerHistoryStateCreationEvent.type"; diff --git a/packages/frontend/src/_common/model/usager/index.ts b/packages/frontend/src/_common/model/usager/index.ts index 232ae24ba1..14103e92ea 100644 --- a/packages/frontend/src/_common/model/usager/index.ts +++ b/packages/frontend/src/_common/model/usager/index.ts @@ -3,7 +3,6 @@ export * from "./decision"; export * from "./dossier"; export * from "./entretien"; export * from "./form"; -export * from "./history"; export * from "./HISTORY_ACTIONS.const"; export * from "./options"; export * from "./rdv"; @@ -11,7 +10,6 @@ export * from "./Usager.type"; export * from "./UsagerDoc.type"; export * from "./UsagerEcheanceInfos.type"; export * from "./UsagerImport.type"; -export * from "./UsagerLastInteractions.type"; export * from "./UsagerLight.type"; export * from "./UsagerNote.type"; export * from "./UsagersImportMode.type"; diff --git a/packages/frontend/src/_common/model/user-structure/UserStructure.type.ts b/packages/frontend/src/_common/model/user-structure/UserStructure.type.ts index 802fa6f175..00a0df0c57 100644 --- a/packages/frontend/src/_common/model/user-structure/UserStructure.type.ts +++ b/packages/frontend/src/_common/model/user-structure/UserStructure.type.ts @@ -1,7 +1,6 @@ +import { UserStructureRole, UserStructureMails } from "@domifa/common"; import { StructureCommon } from "../../../app/modules/structures/types"; import { AppEntity } from "../_core/AppEntity.type"; -import { UserStructureMails } from "./UserStructureMails.type"; -import { UserStructureRole } from "./UserStructureRole.type"; export type UserStructure = AppEntity & { id: number | null; diff --git a/packages/frontend/src/_common/model/user-structure/UserStructureMails.type.ts b/packages/frontend/src/_common/model/user-structure/UserStructureMails.type.ts deleted file mode 100644 index 33ea80a441..0000000000 --- a/packages/frontend/src/_common/model/user-structure/UserStructureMails.type.ts +++ /dev/null @@ -1,4 +0,0 @@ -export type UserStructureMails = { - guide: boolean; - import: boolean; -}; diff --git a/packages/frontend/src/_common/model/user-structure/UserStructureRole.type.ts b/packages/frontend/src/_common/model/user-structure/UserStructureRole.type.ts deleted file mode 100644 index 04e3fa9472..0000000000 --- a/packages/frontend/src/_common/model/user-structure/UserStructureRole.type.ts +++ /dev/null @@ -1 +0,0 @@ -export type UserStructureRole = "simple" | "admin" | "facteur" | "responsable"; diff --git a/packages/frontend/src/_common/model/user-structure/UserStructureTokens.type.ts b/packages/frontend/src/_common/model/user-structure/UserStructureTokens.type.ts deleted file mode 100644 index 3d001979ca..0000000000 --- a/packages/frontend/src/_common/model/user-structure/UserStructureTokens.type.ts +++ /dev/null @@ -1,5 +0,0 @@ -export type UserStructureTokens = { - creation?: string; - password?: string; - passwordValidity?: Date; -}; diff --git a/packages/frontend/src/_common/model/user-structure/index.ts b/packages/frontend/src/_common/model/user-structure/index.ts index 9f1e972296..1016cf89ee 100644 --- a/packages/frontend/src/_common/model/user-structure/index.ts +++ b/packages/frontend/src/_common/model/user-structure/index.ts @@ -1,8 +1,4 @@ export * from "./UserStructure.type"; export * from "./UserStructureCreatedBy.type"; export * from "./UserStructureEditProfile.type"; -export * from "./UserStructureMails.type"; export * from "./UserStructureProfile.type"; -export * from "./UserStructureResume.type"; -export * from "./UserStructureRole.type"; -export * from "./UserStructureTokens.type"; diff --git a/packages/frontend/src/app/modules/usager-profil/components/pages/profil-historique/profil-historique.component.ts b/packages/frontend/src/app/modules/usager-profil/components/pages/profil-historique/profil-historique.component.ts index a5823ecbd0..92e82912be 100644 --- a/packages/frontend/src/app/modules/usager-profil/components/pages/profil-historique/profil-historique.component.ts +++ b/packages/frontend/src/app/modules/usager-profil/components/pages/profil-historique/profil-historique.component.ts @@ -3,11 +3,7 @@ import { Title } from "@angular/platform-browser"; import { ActivatedRoute, Router } from "@angular/router"; import { CustomToastService } from "src/app/modules/shared/services/custom-toast.service"; -import { - UsagerDecision, - UsagerHistoryStateCreationEvent, - HISTORY_ACTIONS, -} from "../../../../../../_common/model"; +import { HISTORY_ACTIONS } from "../../../../../../_common/model"; import { AuthService } from "../../../../shared/services/auth.service"; import { UsagerProfilService } from "../../../services/usager-profil.service"; import { BaseUsagerProfilPageComponent } from "../base-usager-profil-page/base-usager-profil-page.component"; @@ -19,11 +15,6 @@ import { USAGER_DECISION_STATUT_LABELS_PROFIL } from "@domifa/common"; templateUrl: "./profil-historique.component.html", }) export class ProfilHistoriqueComponent extends BaseUsagerProfilPageComponent { - public newHistorique: { - decision: UsagerDecision; - createdEvent: UsagerHistoryStateCreationEvent; - }[]; - public readonly HISTORY_ACTIONS = HISTORY_ACTIONS; public readonly USAGER_DECISION_STATUT_LABELS_PROFIL = @@ -48,7 +39,6 @@ export class ProfilHistoriqueComponent extends BaseUsagerProfilPageComponent { store ); - this.newHistorique = []; this.titlePrefix = "Historique"; } } diff --git a/packages/frontend/src/app/modules/usager-profil/services/usager-profil.service.ts b/packages/frontend/src/app/modules/usager-profil/services/usager-profil.service.ts index c63a5499bc..825004facc 100644 --- a/packages/frontend/src/app/modules/usager-profil/services/usager-profil.service.ts +++ b/packages/frontend/src/app/modules/usager-profil/services/usager-profil.service.ts @@ -2,9 +2,10 @@ import { HttpClient } from "@angular/common/http"; import { Injectable } from "@angular/core"; import { Observable, tap } from "rxjs"; import { environment } from "../../../../environments/environment"; -import { ApiMessage, MessageSms, UsagerLight } from "../../../../_common/model"; +import { MessageSms, UsagerLight } from "../../../../_common/model"; import { Store } from "@ngrx/store"; import { cacheManager } from "../../../shared"; +import { ApiMessage } from "@domifa/common"; @Injectable({ providedIn: "root", diff --git a/packages/frontend/src/app/modules/usager-shared/services/usager-decision.service.ts b/packages/frontend/src/app/modules/usager-shared/services/usager-decision.service.ts index b661595b09..2c996b1d2e 100644 --- a/packages/frontend/src/app/modules/usager-shared/services/usager-decision.service.ts +++ b/packages/frontend/src/app/modules/usager-shared/services/usager-decision.service.ts @@ -7,7 +7,6 @@ import { UsagerDecisionRadiationForm, UsagerDecisionRefusForm, UsagerDecisionValideForm, - UsagerHistoryState, UsagerLight, } from "../../../../_common/model"; @@ -78,14 +77,6 @@ export class UsagerDecisionService { ); } - public getHistoriqueDecisions( - usagerRef: number - ): Observable { - return this.http.get( - `${this.endPointDecision}/historique/${usagerRef}` - ); - } - public getLastFiveCustomRef(usagerRef: number): Observable { return this.http .get(this.endPointDecision + "/last-usagers-refs/" + usagerRef) diff --git a/packages/frontend/src/app/modules/users/components/user-profil/user-profil.component.ts b/packages/frontend/src/app/modules/users/components/user-profil/user-profil.component.ts index 9b50b48d12..45369acfc0 100644 --- a/packages/frontend/src/app/modules/users/components/user-profil/user-profil.component.ts +++ b/packages/frontend/src/app/modules/users/components/user-profil/user-profil.component.ts @@ -9,12 +9,12 @@ import { DEFAULT_MODAL_OPTIONS, UserStructure, UserStructureProfile, - UserStructureRole, } from "../../../../../_common/model"; import { AuthService } from "../../../shared/services/auth.service"; import { UsersService } from "../../services/users.service"; import { UsagersFilterCriteriaSortValues } from "../../../manage-usagers/components/usager-filter"; import { differenceInCalendarDays } from "date-fns"; +import { UserStructureRole } from "@domifa/common"; @Component({ selector: "app-user-profil", 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 ba95c29665..07bacc545d 100644 --- a/packages/frontend/src/app/modules/users/services/users.service.ts +++ b/packages/frontend/src/app/modules/users/services/users.service.ts @@ -1,4 +1,3 @@ -import { ApiMessage } from "../../../../_common/model/_general/ApiMessage.type"; import { HttpClient } from "@angular/common/http"; import { Injectable } from "@angular/core"; import { Observable } from "rxjs"; @@ -9,9 +8,9 @@ import { UserStructure, UserStructureEditProfile, UserStructureProfile, - UserStructureRole, } from "../../../../_common/model"; import { userStructureBuilder } from "./userStructureBuilder.service"; +import { ApiMessage, UserStructureRole } from "@domifa/common"; @Injectable({ providedIn: "root", diff --git a/packages/frontend/src/assets/files/news.json b/packages/frontend/src/assets/files/news.json index ac83ee7618..6ed7666467 100644 --- a/packages/frontend/src/assets/files/news.json +++ b/packages/frontend/src/assets/files/news.json @@ -1,4 +1,31 @@ [ + { + "date": "2023-10-30", + "description": "DomiFa fait sa rentrée !", + "content": [ + { + "type": "new", + "categorie": "Consultation du dossier domicilié en attente de décision", + "message": [ + "L’ensemble du dossier domicilié est accessible même lorsqu’une demande est en cours d’instruction ou soumise à décision" + ] + }, + { + "type": "new", + "categorie": "Accès restreint au niveau Facteur", + "message": [ + "Une mention explicite informe les facteurs qu'ils n'ont pas accès aux documents des domiciliés" + ] + }, + { + "type": "new", + "categorie": "Dates de validité des Cerfas provisoires", + "message": [ + "Les dates de début et de fin de domiciliation des cerfas provisoires ont été corrigées" + ] + } + ] + }, { "date": "2023-09-26", "description": "DomiFa fait sa rentrée !",