From 36f2089a57bb234bfa05bef55e84ebd56817db5e Mon Sep 17 00:00:00 2001 From: Yassine R Date: Mon, 30 Oct 2023 13:23:19 +0100 Subject: [PATCH] refactor(common): migrate interaction types --- ...eractionType.type.ts => INTERACTIONS_OK.const.ts} | 12 +----------- .../_common/model/interaction/Interactions.type.ts | 4 ++-- .../backend/src/_common/model/interaction/index.ts | 3 +-- .../src/_common/model/message-sms/MessageSms.type.ts | 2 +- .../_common/model/message-sms/MessageSmsId.type.ts | 4 ---- .../message-sms/MessageSmsInteractionMetas.type.ts | 2 +- .../backend/src/_common/model/message-sms/index.ts | 2 -- .../model/stats/AdminStructureStatsData.type.ts | 3 ++- .../services/admin-structures.service.ts | 7 +++++-- .../interaction/InteractionsTable.typeorm.ts | 8 +++----- .../entities/message-sms/MessageSmsTable.typeorm.ts | 3 +-- .../interaction/interactionRepository.service.ts | 5 ++--- .../message-sms/messageSmsRepository.service.ts | 3 ++- .../exportStatsGlobalesWorksheetRenderer.ts | 3 +-- .../StructureUsagersExportModel.type.ts | 2 +- .../src/interactions/dto/interactions-search.dto.ts | 2 +- .../backend/src/interactions/dto/interactions.dto.ts | 2 +- .../services/InteractionsDeletor.service.ts | 2 +- .../services/interactionsTypeManager.service.ts | 2 +- .../generators/generateSmsInteraction.service.ts | 2 +- ...uestionsInPeriodInteractionsRepository.service.ts | 3 ++- .../export-structure-usagers.controller.ts | 3 ++- packages/common/src/index.ts | 2 ++ packages/common/src/interactions/index.ts | 2 ++ .../src/interactions/types}/InteractionEvent.type.ts | 0 .../src/interactions/types}/InteractionType.type.ts | 0 packages/common/src/interactions/types/index.ts | 3 +++ packages/common/src/message-sms/index.ts | 3 +++ .../MessageSmsInteractionMetas.interface.ts | 7 +++++++ .../interfaces/MessageSmsReminderMetas.interface.ts | 4 ++++ packages/common/src/message-sms/interfaces/index.ts | 3 +++ .../src/message-sms/types/MessageSmsId.type.ts | 4 ++++ .../message-sms/types}/MessageSmsReminders.type.ts | 0 .../src/message-sms/types}/MessageSmsStatus.type.ts | 0 packages/common/src/message-sms/types/index.ts | 4 ++++ .../USAGER_DECISION_STATUT_LABELS_PROFIL.const.ts | 1 - .../model/interaction/InteractionEvent.type.ts | 1 - .../model/interaction/InteractionForApi.type.ts | 2 +- .../_common/model/interaction/Interactions.type.ts | 4 ++-- .../constants/INTERACTIONS_LABELS.const.ts | 2 +- .../frontend/src/_common/model/interaction/index.ts | 2 -- .../model/message-sms/MESSAGE_SMS_STATUS.const.ts | 3 ++- .../src/_common/model/message-sms/MessageSms.type.ts | 4 ++-- .../_common/model/message-sms/MessageSmsId.type.ts | 4 ---- .../message-sms/MessageSmsInteractionMetas.type.ts | 7 ------- .../frontend/src/_common/model/message-sms/index.ts | 3 --- .../column-interactions.component.ts | 2 +- .../profil-historique-courriers.component.ts | 2 +- .../profil-general-section.component.ts | 3 +-- .../modules/usager-shared/interfaces/interaction.ts | 3 +-- 50 files changed, 76 insertions(+), 78 deletions(-) rename packages/backend/src/_common/model/interaction/{InteractionType.type.ts => INTERACTIONS_OK.const.ts} (84%) delete mode 100644 packages/backend/src/_common/model/message-sms/MessageSmsId.type.ts create mode 100644 packages/common/src/interactions/index.ts rename packages/{backend/src/_common/model/interaction => common/src/interactions/types}/InteractionEvent.type.ts (100%) rename packages/{frontend/src/_common/model/interaction => common/src/interactions/types}/InteractionType.type.ts (100%) create mode 100644 packages/common/src/interactions/types/index.ts create mode 100644 packages/common/src/message-sms/index.ts create mode 100644 packages/common/src/message-sms/interfaces/MessageSmsInteractionMetas.interface.ts create mode 100644 packages/common/src/message-sms/interfaces/MessageSmsReminderMetas.interface.ts create mode 100644 packages/common/src/message-sms/interfaces/index.ts create mode 100644 packages/common/src/message-sms/types/MessageSmsId.type.ts rename packages/{backend/src/_common/model/message-sms => common/src/message-sms/types}/MessageSmsReminders.type.ts (100%) rename packages/{frontend/src/_common/model/message-sms => common/src/message-sms/types}/MessageSmsStatus.type.ts (100%) create mode 100644 packages/common/src/message-sms/types/index.ts delete mode 100644 packages/frontend/src/_common/model/interaction/InteractionEvent.type.ts delete mode 100644 packages/frontend/src/_common/model/message-sms/MessageSmsId.type.ts delete mode 100644 packages/frontend/src/_common/model/message-sms/MessageSmsInteractionMetas.type.ts diff --git a/packages/backend/src/_common/model/interaction/InteractionType.type.ts b/packages/backend/src/_common/model/interaction/INTERACTIONS_OK.const.ts similarity index 84% rename from packages/backend/src/_common/model/interaction/InteractionType.type.ts rename to packages/backend/src/_common/model/interaction/INTERACTIONS_OK.const.ts index 05cf7fd392..e7906ae167 100644 --- a/packages/backend/src/_common/model/interaction/InteractionType.type.ts +++ b/packages/backend/src/_common/model/interaction/INTERACTIONS_OK.const.ts @@ -1,14 +1,4 @@ -export type InteractionType = - | "courrierIn" - | "courrierOut" - | "recommandeIn" - | "recommandeOut" - | "colisIn" - | "colisOut" - | "appel" - | "visite" - | "npai" - | "loginPortail"; +import { InteractionType } from "@domifa/common"; export const ALL_INTERACTION_TYPES: InteractionType[] = [ "courrierIn", diff --git a/packages/backend/src/_common/model/interaction/Interactions.type.ts b/packages/backend/src/_common/model/interaction/Interactions.type.ts index 7ba57a490c..4ee115d9ef 100644 --- a/packages/backend/src/_common/model/interaction/Interactions.type.ts +++ b/packages/backend/src/_common/model/interaction/Interactions.type.ts @@ -1,5 +1,5 @@ -import { AppEntity, InteractionEvent } from ".."; -import { InteractionType } from "./InteractionType.type"; +import { InteractionType, InteractionEvent } from "@domifa/common"; +import { AppEntity } from ".."; export type Interactions = AppEntity & { content?: string; diff --git a/packages/backend/src/_common/model/interaction/index.ts b/packages/backend/src/_common/model/interaction/index.ts index 69c15c6fa7..2d426849b4 100644 --- a/packages/backend/src/_common/model/interaction/index.ts +++ b/packages/backend/src/_common/model/interaction/index.ts @@ -1,6 +1,5 @@ // @index('./*', f => `export * from '${f.path}'`) export * from "./InteractionBaseDirectionalType.type"; export * from "./InteractionDirection.type"; -export * from "./InteractionEvent.type"; +export * from "./INTERACTIONS_OK.const"; export * from "./Interactions.type"; -export * from "./InteractionType.type"; diff --git a/packages/backend/src/_common/model/message-sms/MessageSms.type.ts b/packages/backend/src/_common/model/message-sms/MessageSms.type.ts index d656c8d5d6..56fc15875f 100644 --- a/packages/backend/src/_common/model/message-sms/MessageSms.type.ts +++ b/packages/backend/src/_common/model/message-sms/MessageSms.type.ts @@ -1,5 +1,5 @@ +import { MessageSmsId } from "@domifa/common"; import { - MessageSmsId, MessageSmsInteractionMetas, MessageSmsReminderMetas, MessageSmsStatus, diff --git a/packages/backend/src/_common/model/message-sms/MessageSmsId.type.ts b/packages/backend/src/_common/model/message-sms/MessageSmsId.type.ts deleted file mode 100644 index e2a9637d6d..0000000000 --- a/packages/backend/src/_common/model/message-sms/MessageSmsId.type.ts +++ /dev/null @@ -1,4 +0,0 @@ -import { MessageSmsReminders } from "."; -import { InteractionType } from "../interaction"; - -export type MessageSmsId = InteractionType | MessageSmsReminders; diff --git a/packages/backend/src/_common/model/message-sms/MessageSmsInteractionMetas.type.ts b/packages/backend/src/_common/model/message-sms/MessageSmsInteractionMetas.type.ts index 80007265e2..14cee5a09a 100644 --- a/packages/backend/src/_common/model/message-sms/MessageSmsInteractionMetas.type.ts +++ b/packages/backend/src/_common/model/message-sms/MessageSmsInteractionMetas.type.ts @@ -1,4 +1,4 @@ -import { InteractionType } from "../interaction"; +import { InteractionType } from "@domifa/common"; export type MessageSmsInteractionMetas = { nbCourrier: number; diff --git a/packages/backend/src/_common/model/message-sms/index.ts b/packages/backend/src/_common/model/message-sms/index.ts index 4ea25141ba..d00b4dee9b 100644 --- a/packages/backend/src/_common/model/message-sms/index.ts +++ b/packages/backend/src/_common/model/message-sms/index.ts @@ -3,10 +3,8 @@ export * from "./MESSAGE_SMS_RESPONSE_ERRORS.const"; export * from "./MESSAGE_SMS_STATUS.const"; export * from "./MESSAGE_SMS_SUIVI_INDEX.const"; export * from "./MessageSms.type"; -export * from "./MessageSmsId.type"; export * from "./MessageSmsInteractionMetas.type"; export * from "./MessageSmsReminderMetas.type"; -export * from "./MessageSmsReminders.type"; export * from "./MessageSmsSendResponse.type"; export * from "./MessageSmsStatus.type"; export * from "./SuiviSmsErrors.type"; diff --git a/packages/backend/src/_common/model/stats/AdminStructureStatsData.type.ts b/packages/backend/src/_common/model/stats/AdminStructureStatsData.type.ts index 31e1035899..e93df7ba3e 100644 --- a/packages/backend/src/_common/model/stats/AdminStructureStatsData.type.ts +++ b/packages/backend/src/_common/model/stats/AdminStructureStatsData.type.ts @@ -1,4 +1,5 @@ -import { InteractionType } from "./../interaction/InteractionType.type"; +import { InteractionType } from "@domifa/common"; + export type AdminStructureStatsData = { usersCount: number; structuresCount: number; diff --git a/packages/backend/src/_portail-admin/admin-structures/services/admin-structures.service.ts b/packages/backend/src/_portail-admin/admin-structures/services/admin-structures.service.ts index 29432407d0..8e31199d4a 100644 --- a/packages/backend/src/_portail-admin/admin-structures/services/admin-structures.service.ts +++ b/packages/backend/src/_portail-admin/admin-structures/services/admin-structures.service.ts @@ -18,12 +18,15 @@ import { FranceRegion } from "../../../util/territoires"; import { AdminStructureListData, AdminStructureStatsData, - InteractionType, StatsByLocality, StatsByMonth, StructureAdmin, } from "../../../_common/model"; -import { StructureType, UsagerDecisionStatut } from "@domifa/common"; +import { + StructureType, + InteractionType, + UsagerDecisionStatut, +} from "@domifa/common"; @Injectable() export class AdminStructuresService { diff --git a/packages/backend/src/database/entities/interaction/InteractionsTable.typeorm.ts b/packages/backend/src/database/entities/interaction/InteractionsTable.typeorm.ts index e8c3d15bc3..1838fa959e 100644 --- a/packages/backend/src/database/entities/interaction/InteractionsTable.typeorm.ts +++ b/packages/backend/src/database/entities/interaction/InteractionsTable.typeorm.ts @@ -1,9 +1,7 @@ import { Column, Entity, Index, JoinColumn, ManyToOne } from "typeorm"; -import { - InteractionEvent, - Interactions, - InteractionType, -} from "../../../_common/model/interaction"; +import { Interactions } from "../../../_common/model/interaction"; +import { InteractionType, InteractionEvent } from "@domifa/common"; + import { StructureTable } from "../structure/StructureTable.typeorm"; import { UsagerTable } from "../usager"; import { AppTypeormTable } from "../_core/AppTypeormTable.typeorm"; diff --git a/packages/backend/src/database/entities/message-sms/MessageSmsTable.typeorm.ts b/packages/backend/src/database/entities/message-sms/MessageSmsTable.typeorm.ts index 9ca1978097..e6bdddd03a 100644 --- a/packages/backend/src/database/entities/message-sms/MessageSmsTable.typeorm.ts +++ b/packages/backend/src/database/entities/message-sms/MessageSmsTable.typeorm.ts @@ -1,13 +1,12 @@ import { Column, Entity, Index, JoinColumn, ManyToOne } from "typeorm"; import { MessageSms, - MessageSmsId, MessageSmsInteractionMetas, MessageSmsReminderMetas, - MessageSmsStatus, } from "../../../_common/model/message-sms"; import { StructureTable } from "../structure"; import { AppTypeormTable } from "../_core/AppTypeormTable.typeorm"; +import { MessageSmsId, MessageSmsStatus } from "@domifa/common"; // https://typeorm.io/#/entities/column-types-for-postgres @Entity({ name: "message_sms" }) diff --git a/packages/backend/src/database/services/interaction/interactionRepository.service.ts b/packages/backend/src/database/services/interaction/interactionRepository.service.ts index f0f20ed316..f2e71d7a50 100644 --- a/packages/backend/src/database/services/interaction/interactionRepository.service.ts +++ b/packages/backend/src/database/services/interaction/interactionRepository.service.ts @@ -7,13 +7,12 @@ import { UserStructureAuthenticated, } from "../../../_common/model"; import { - InteractionEvent, - Interactions, - InteractionType, INTERACTION_OK_LIST, + Interactions, } from "../../../_common/model/interaction"; import { InteractionsTable } from "../../entities"; import { myDataSource } from "../_postgres"; +import { InteractionType, InteractionEvent } from "@domifa/common"; export const interactionRepository = myDataSource .getRepository(InteractionsTable) diff --git a/packages/backend/src/database/services/message-sms/messageSmsRepository.service.ts b/packages/backend/src/database/services/message-sms/messageSmsRepository.service.ts index c0c8333eac..e042b28b05 100644 --- a/packages/backend/src/database/services/message-sms/messageSmsRepository.service.ts +++ b/packages/backend/src/database/services/message-sms/messageSmsRepository.service.ts @@ -1,5 +1,6 @@ +import { InteractionType } from "@domifa/common"; import { myDataSource } from ".."; -import { MessageSms, InteractionType } from "../../../_common/model"; +import { MessageSms } from "../../../_common/model"; import { MessageSmsTable } from "./../../entities/message-sms/MessageSmsTable.typeorm"; export const messageSmsRepository = myDataSource diff --git a/packages/backend/src/excel/export-stats-deploiement/worksheet-renderer/exportStatsGlobalesWorksheetRenderer.ts b/packages/backend/src/excel/export-stats-deploiement/worksheet-renderer/exportStatsGlobalesWorksheetRenderer.ts index b3c4b5a213..0af17c6867 100644 --- a/packages/backend/src/excel/export-stats-deploiement/worksheet-renderer/exportStatsGlobalesWorksheetRenderer.ts +++ b/packages/backend/src/excel/export-stats-deploiement/worksheet-renderer/exportStatsGlobalesWorksheetRenderer.ts @@ -1,10 +1,9 @@ import { Column, Workbook } from "exceljs"; import { REGIONS_LISTE } from "../../../util/territoires"; -import { InteractionType } from "../../../_common/model/interaction"; import { WorksheetRenderer, xlFormater, xlRenderer } from "../../xlLib"; import { StatsDeploiementExportModel } from "../StatsDeploiementExportModel.type"; -import { StructureType } from "@domifa/common"; +import { InteractionType, StructureType } from "@domifa/common"; export const exportStatsGlobalesWorksheetRenderer = { renderWorksheet, diff --git a/packages/backend/src/excel/export-structure-usagers/StructureUsagersExportModel.type.ts b/packages/backend/src/excel/export-structure-usagers/StructureUsagersExportModel.type.ts index e44494bcc1..87f59a5cd3 100644 --- a/packages/backend/src/excel/export-structure-usagers/StructureUsagersExportModel.type.ts +++ b/packages/backend/src/excel/export-structure-usagers/StructureUsagersExportModel.type.ts @@ -1,4 +1,4 @@ -import { InteractionType } from "./../../_common/model/interaction/InteractionType.type"; +import { InteractionType } from "@domifa/common"; import { Usager } from "../../_common/model"; export type StructureUsagersExportModel = { diff --git a/packages/backend/src/interactions/dto/interactions-search.dto.ts b/packages/backend/src/interactions/dto/interactions-search.dto.ts index a40d4bb217..43781b04af 100644 --- a/packages/backend/src/interactions/dto/interactions-search.dto.ts +++ b/packages/backend/src/interactions/dto/interactions-search.dto.ts @@ -1,5 +1,5 @@ -import { ALL_INTERACTION_TYPES } from "./../../_common/model/interaction/InteractionType.type"; import { IsIn, IsNotEmpty, IsNumber, IsOptional } from "class-validator"; +import { ALL_INTERACTION_TYPES } from "../../_common/model"; export class InteractionSearchDto { @IsIn(ALL_INTERACTION_TYPES) diff --git a/packages/backend/src/interactions/dto/interactions.dto.ts b/packages/backend/src/interactions/dto/interactions.dto.ts index 2eefdf62e4..f6f1b9b5b7 100644 --- a/packages/backend/src/interactions/dto/interactions.dto.ts +++ b/packages/backend/src/interactions/dto/interactions.dto.ts @@ -14,10 +14,10 @@ import { import { TrimOrNullTransform } from "../../_common/decorators"; import { ALL_INTERACTION_TYPES, - InteractionType, INTERACTION_IN_CREATE_SMS, INTERACTION_OUT_REMOVE_SMS, } from "../../_common/model"; +import { InteractionType } from "@domifa/common"; export class InteractionDto { @ApiProperty({ diff --git a/packages/backend/src/interactions/services/InteractionsDeletor.service.ts b/packages/backend/src/interactions/services/InteractionsDeletor.service.ts index be53b206d6..6de216d02a 100644 --- a/packages/backend/src/interactions/services/InteractionsDeletor.service.ts +++ b/packages/backend/src/interactions/services/InteractionsDeletor.service.ts @@ -7,11 +7,11 @@ import { UserStructure, Structure, UsagerLight, - InteractionEvent, INTERACTION_OK_LIST, } from "../../_common/model"; import { interactionsCreator } from "./interactionsCreator.service"; import { interactionsTypeManager } from "./interactionsTypeManager.service"; +import { InteractionEvent } from "@domifa/common"; @Injectable() export class InteractionsDeletor { diff --git a/packages/backend/src/interactions/services/interactionsTypeManager.service.ts b/packages/backend/src/interactions/services/interactionsTypeManager.service.ts index c481eaedb4..4646dcf581 100644 --- a/packages/backend/src/interactions/services/interactionsTypeManager.service.ts +++ b/packages/backend/src/interactions/services/interactionsTypeManager.service.ts @@ -1,7 +1,7 @@ +import { InteractionType } from "@domifa/common"; import { InteractionBaseDirectionalType, InteractionDirection, - InteractionType, } from "../../_common/model/interaction"; export const interactionsTypeManager = { diff --git a/packages/backend/src/sms/services/generators/generateSmsInteraction.service.ts b/packages/backend/src/sms/services/generators/generateSmsInteraction.service.ts index a6d00745af..5832e4b2b1 100644 --- a/packages/backend/src/sms/services/generators/generateSmsInteraction.service.ts +++ b/packages/backend/src/sms/services/generators/generateSmsInteraction.service.ts @@ -1,4 +1,4 @@ -import { InteractionType } from "./../../../_common/model/interaction/InteractionType.type"; +import { InteractionType } from "@domifa/common"; import { InteractionDto } from "../../../interactions/dto"; export function generateSmsInteraction( diff --git a/packages/backend/src/stats/services/structureStatsQuestionsInPeriodInteractionsRepository.service.ts b/packages/backend/src/stats/services/structureStatsQuestionsInPeriodInteractionsRepository.service.ts index d751e1ce4c..9497453e93 100644 --- a/packages/backend/src/stats/services/structureStatsQuestionsInPeriodInteractionsRepository.service.ts +++ b/packages/backend/src/stats/services/structureStatsQuestionsInPeriodInteractionsRepository.service.ts @@ -1,7 +1,8 @@ import { Between } from "typeorm"; import { interactionRepository } from "../../database"; -import { InteractionType } from "../../_common/model"; + import { StructureStatsQuestionsInPeriodInteractions } from "../../_common/model/structure-stats"; +import { InteractionType } from "@domifa/common"; export const structureStatsQuestionsInPeriodInteractionsRepository = { getStats, 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 f39791360f..f153c68b15 100644 --- a/packages/backend/src/usagers/controllers/export-structure-usagers.controller.ts +++ b/packages/backend/src/usagers/controllers/export-structure-usagers.controller.ts @@ -1,5 +1,5 @@ import { interactionRepository } from "./../../database/services/interaction/interactionRepository.service"; -import { InteractionType } from "./../../_common/model/interaction/InteractionType.type"; + import { Controller, Get, Res, UseGuards } from "@nestjs/common"; import { AuthGuard } from "@nestjs/passport"; import { ApiBearerAuth, ApiTags } from "@nestjs/swagger"; @@ -21,6 +21,7 @@ import { import { UsagersService } from "../services/usagers.service"; import { format } from "date-fns"; +import { InteractionType } from "@domifa/common"; @UseGuards(AuthGuard("jwt"), AppUserGuard) @ApiTags("export") diff --git a/packages/common/src/index.ts b/packages/common/src/index.ts index 01cbad8c20..bb7a30419b 100644 --- a/packages/common/src/index.ts +++ b/packages/common/src/index.ts @@ -1,5 +1,7 @@ // @index('./*', f => `export * from '${f.path}'`) export * from "./_core"; +export * from "./interactions"; +export * from "./message-sms"; export * from "./structure"; export * from "./usager"; export * from "./user-structure"; diff --git a/packages/common/src/interactions/index.ts b/packages/common/src/interactions/index.ts new file mode 100644 index 0000000000..7d4a3015fb --- /dev/null +++ b/packages/common/src/interactions/index.ts @@ -0,0 +1,2 @@ +// @index('./*', f => `export * from '${f.path}'`) +export * from "./types"; diff --git a/packages/backend/src/_common/model/interaction/InteractionEvent.type.ts b/packages/common/src/interactions/types/InteractionEvent.type.ts similarity index 100% rename from packages/backend/src/_common/model/interaction/InteractionEvent.type.ts rename to packages/common/src/interactions/types/InteractionEvent.type.ts diff --git a/packages/frontend/src/_common/model/interaction/InteractionType.type.ts b/packages/common/src/interactions/types/InteractionType.type.ts similarity index 100% rename from packages/frontend/src/_common/model/interaction/InteractionType.type.ts rename to packages/common/src/interactions/types/InteractionType.type.ts diff --git a/packages/common/src/interactions/types/index.ts b/packages/common/src/interactions/types/index.ts new file mode 100644 index 0000000000..a0e082dff9 --- /dev/null +++ b/packages/common/src/interactions/types/index.ts @@ -0,0 +1,3 @@ +// @index('./*', f => `export * from '${f.path}'`) +export * from "./InteractionEvent.type"; +export * from "./InteractionType.type"; diff --git a/packages/common/src/message-sms/index.ts b/packages/common/src/message-sms/index.ts new file mode 100644 index 0000000000..67d4c13b24 --- /dev/null +++ b/packages/common/src/message-sms/index.ts @@ -0,0 +1,3 @@ +// @index('./*', f => `export * from '${f.path}'`) +export * from "./interfaces"; +export * from "./types"; diff --git a/packages/common/src/message-sms/interfaces/MessageSmsInteractionMetas.interface.ts b/packages/common/src/message-sms/interfaces/MessageSmsInteractionMetas.interface.ts new file mode 100644 index 0000000000..5862294ad7 --- /dev/null +++ b/packages/common/src/message-sms/interfaces/MessageSmsInteractionMetas.interface.ts @@ -0,0 +1,7 @@ +import { type InteractionType } from "../../interactions"; + +export interface MessageSmsInteractionMetas { + nbCourrier: number; + interactionType: InteractionType; + date: Date; +} diff --git a/packages/common/src/message-sms/interfaces/MessageSmsReminderMetas.interface.ts b/packages/common/src/message-sms/interfaces/MessageSmsReminderMetas.interface.ts new file mode 100644 index 0000000000..a34a3c77dc --- /dev/null +++ b/packages/common/src/message-sms/interfaces/MessageSmsReminderMetas.interface.ts @@ -0,0 +1,4 @@ +export interface MessageSmsReminderMetas { + type: string; + date: Date; +} diff --git a/packages/common/src/message-sms/interfaces/index.ts b/packages/common/src/message-sms/interfaces/index.ts new file mode 100644 index 0000000000..0455769d66 --- /dev/null +++ b/packages/common/src/message-sms/interfaces/index.ts @@ -0,0 +1,3 @@ +// @index('./*', f => `export * from '${f.path}'`) +export * from "./MessageSmsInteractionMetas.interface"; +export * from "./MessageSmsReminderMetas.interface"; diff --git a/packages/common/src/message-sms/types/MessageSmsId.type.ts b/packages/common/src/message-sms/types/MessageSmsId.type.ts new file mode 100644 index 0000000000..c7e5240a92 --- /dev/null +++ b/packages/common/src/message-sms/types/MessageSmsId.type.ts @@ -0,0 +1,4 @@ +import { type InteractionType } from "../../interactions"; +import { type MessageSmsReminders } from "./MessageSmsReminders.type"; + +export type MessageSmsId = InteractionType | MessageSmsReminders; diff --git a/packages/backend/src/_common/model/message-sms/MessageSmsReminders.type.ts b/packages/common/src/message-sms/types/MessageSmsReminders.type.ts similarity index 100% rename from packages/backend/src/_common/model/message-sms/MessageSmsReminders.type.ts rename to packages/common/src/message-sms/types/MessageSmsReminders.type.ts diff --git a/packages/frontend/src/_common/model/message-sms/MessageSmsStatus.type.ts b/packages/common/src/message-sms/types/MessageSmsStatus.type.ts similarity index 100% rename from packages/frontend/src/_common/model/message-sms/MessageSmsStatus.type.ts rename to packages/common/src/message-sms/types/MessageSmsStatus.type.ts diff --git a/packages/common/src/message-sms/types/index.ts b/packages/common/src/message-sms/types/index.ts new file mode 100644 index 0000000000..62e40561cd --- /dev/null +++ b/packages/common/src/message-sms/types/index.ts @@ -0,0 +1,4 @@ +// @index('./*', f => `export * from '${f.path}'`) +export * from "./MessageSmsId.type"; +export * from "./MessageSmsReminders.type"; +export * from "./MessageSmsStatus.type"; diff --git a/packages/common/src/usager/constants/USAGER_DECISION_STATUT_LABELS_PROFIL.const.ts b/packages/common/src/usager/constants/USAGER_DECISION_STATUT_LABELS_PROFIL.const.ts index 08a0bb8a21..51a922d0ac 100644 --- a/packages/common/src/usager/constants/USAGER_DECISION_STATUT_LABELS_PROFIL.const.ts +++ b/packages/common/src/usager/constants/USAGER_DECISION_STATUT_LABELS_PROFIL.const.ts @@ -1,6 +1,5 @@ import { type UsagerDecisionStatut } from ".."; -/* DÉCISIONS */ export const USAGER_DECISION_STATUT_LABELS_PROFIL: { [key in UsagerDecisionStatut]: string; } = { diff --git a/packages/frontend/src/_common/model/interaction/InteractionEvent.type.ts b/packages/frontend/src/_common/model/interaction/InteractionEvent.type.ts deleted file mode 100644 index 25ed980f22..0000000000 --- a/packages/frontend/src/_common/model/interaction/InteractionEvent.type.ts +++ /dev/null @@ -1 +0,0 @@ -export type InteractionEvent = "create" | "delete"; diff --git a/packages/frontend/src/_common/model/interaction/InteractionForApi.type.ts b/packages/frontend/src/_common/model/interaction/InteractionForApi.type.ts index c4132ca8b5..35507d6e43 100644 --- a/packages/frontend/src/_common/model/interaction/InteractionForApi.type.ts +++ b/packages/frontend/src/_common/model/interaction/InteractionForApi.type.ts @@ -1,4 +1,4 @@ -import { InteractionType } from "."; +import { InteractionType } from "@domifa/common"; export type InteractionInForApi = { nbCourrier: number; diff --git a/packages/frontend/src/_common/model/interaction/Interactions.type.ts b/packages/frontend/src/_common/model/interaction/Interactions.type.ts index 8e9df6d809..8c354992d7 100644 --- a/packages/frontend/src/_common/model/interaction/Interactions.type.ts +++ b/packages/frontend/src/_common/model/interaction/Interactions.type.ts @@ -1,6 +1,6 @@ import { AppEntity } from ".."; -import { InteractionEvent } from "./InteractionEvent.type"; -import { InteractionType } from "./InteractionType.type"; + +import { InteractionType, InteractionEvent } from "@domifa/common"; export type Interactions = AppEntity & { id?: number | null; diff --git a/packages/frontend/src/_common/model/interaction/constants/INTERACTIONS_LABELS.const.ts b/packages/frontend/src/_common/model/interaction/constants/INTERACTIONS_LABELS.const.ts index af91bba38b..3ad0129901 100644 --- a/packages/frontend/src/_common/model/interaction/constants/INTERACTIONS_LABELS.const.ts +++ b/packages/frontend/src/_common/model/interaction/constants/INTERACTIONS_LABELS.const.ts @@ -1,4 +1,4 @@ -import { InteractionType } from "../InteractionType.type"; +import { InteractionType } from "@domifa/common"; export const INTERACTIONS_LABELS_SINGULIER: { [key in InteractionType]: string; diff --git a/packages/frontend/src/_common/model/interaction/index.ts b/packages/frontend/src/_common/model/interaction/index.ts index e2f92dcc13..543a9d13d8 100644 --- a/packages/frontend/src/_common/model/interaction/index.ts +++ b/packages/frontend/src/_common/model/interaction/index.ts @@ -1,9 +1,7 @@ //@index('./*', f => `export * from '${f.path}'`) export * from "./constants"; -export * from "./InteractionEvent.type"; export * from "./InteractionForApi.type"; export * from "./InteractionForms.type"; export * from "./InteractionIn.type"; export * from "./InteractionOut.type"; export * from "./Interactions.type"; -export * from "./InteractionType.type"; diff --git a/packages/frontend/src/_common/model/message-sms/MESSAGE_SMS_STATUS.const.ts b/packages/frontend/src/_common/model/message-sms/MESSAGE_SMS_STATUS.const.ts index 5b9017772c..9fa63614fa 100644 --- a/packages/frontend/src/_common/model/message-sms/MESSAGE_SMS_STATUS.const.ts +++ b/packages/frontend/src/_common/model/message-sms/MESSAGE_SMS_STATUS.const.ts @@ -1,4 +1,5 @@ -import { MessageSmsId } from "./MessageSmsId.type"; +import { MessageSmsId } from "@domifa/common"; + export const SMS_LABELS: { [key in MessageSmsId]: string; } = { diff --git a/packages/frontend/src/_common/model/message-sms/MessageSms.type.ts b/packages/frontend/src/_common/model/message-sms/MessageSms.type.ts index 9287704785..5abc4bbec7 100644 --- a/packages/frontend/src/_common/model/message-sms/MessageSms.type.ts +++ b/packages/frontend/src/_common/model/message-sms/MessageSms.type.ts @@ -1,9 +1,9 @@ import { MessageSmsId, MessageSmsInteractionMetas, - MessageSmsReminderMetas, MessageSmsStatus, -} from "."; +} from "@domifa/common"; +import { MessageSmsReminderMetas } from "."; import { AppEntity } from "../../../_common/model"; export type MessageSms = AppEntity & { diff --git a/packages/frontend/src/_common/model/message-sms/MessageSmsId.type.ts b/packages/frontend/src/_common/model/message-sms/MessageSmsId.type.ts deleted file mode 100644 index e2a9637d6d..0000000000 --- a/packages/frontend/src/_common/model/message-sms/MessageSmsId.type.ts +++ /dev/null @@ -1,4 +0,0 @@ -import { MessageSmsReminders } from "."; -import { InteractionType } from "../interaction"; - -export type MessageSmsId = InteractionType | MessageSmsReminders; diff --git a/packages/frontend/src/_common/model/message-sms/MessageSmsInteractionMetas.type.ts b/packages/frontend/src/_common/model/message-sms/MessageSmsInteractionMetas.type.ts deleted file mode 100644 index 80007265e2..0000000000 --- a/packages/frontend/src/_common/model/message-sms/MessageSmsInteractionMetas.type.ts +++ /dev/null @@ -1,7 +0,0 @@ -import { InteractionType } from "../interaction"; - -export type MessageSmsInteractionMetas = { - nbCourrier: number; - interactionType: InteractionType; - date: Date; -}; diff --git a/packages/frontend/src/_common/model/message-sms/index.ts b/packages/frontend/src/_common/model/message-sms/index.ts index 9ed9108e41..6af1733b57 100644 --- a/packages/frontend/src/_common/model/message-sms/index.ts +++ b/packages/frontend/src/_common/model/message-sms/index.ts @@ -1,8 +1,5 @@ // @index('./*', f => `export * from '${f.path}'`) export * from "./MESSAGE_SMS_STATUS.const"; export * from "./MessageSms.type"; -export * from "./MessageSmsId.type"; -export * from "./MessageSmsInteractionMetas.type"; export * from "./MessageSmsReminderMetas.type"; export * from "./MessageSmsReminders.type"; -export * from "./MessageSmsStatus.type"; diff --git a/packages/frontend/src/app/modules/manage-usagers/components/column-interactions/column-interactions.component.ts b/packages/frontend/src/app/modules/manage-usagers/components/column-interactions/column-interactions.component.ts index c60c7028b7..bc7e37aa91 100644 --- a/packages/frontend/src/app/modules/manage-usagers/components/column-interactions/column-interactions.component.ts +++ b/packages/frontend/src/app/modules/manage-usagers/components/column-interactions/column-interactions.component.ts @@ -9,7 +9,6 @@ import { import { NgbModalRef, NgbModal } from "@ng-bootstrap/ng-bootstrap"; import { Subscription } from "rxjs"; import { - InteractionType, InteractionInForApi, INTERACTIONS_LABELS_SINGULIER, DEFAULT_MODAL_OPTIONS, @@ -17,6 +16,7 @@ import { import { CustomToastService } from "../../../shared/services"; import { UsagerFormModel } from "../../../usager-shared/interfaces"; import { InteractionService } from "../../../usager-shared/services"; +import { InteractionType } from "@domifa/common"; @Component({ selector: "app-manage-usagers-interactions", diff --git a/packages/frontend/src/app/modules/usager-profil/components/historiques/profil-historique-courriers/profil-historique-courriers.component.ts b/packages/frontend/src/app/modules/usager-profil/components/historiques/profil-historique-courriers/profil-historique-courriers.component.ts index d7ca88a862..8a827e5786 100644 --- a/packages/frontend/src/app/modules/usager-profil/components/historiques/profil-historique-courriers/profil-historique-courriers.component.ts +++ b/packages/frontend/src/app/modules/usager-profil/components/historiques/profil-historique-courriers/profil-historique-courriers.component.ts @@ -11,7 +11,6 @@ import { import { CustomToastService } from "src/app/modules/shared/services/custom-toast.service"; import { DEFAULT_MODAL_OPTIONS, - InteractionEvent, UserStructure, } from "../../../../../../_common/model"; import { @@ -20,6 +19,7 @@ import { } from "../../../../usager-shared/interfaces"; import { InteractionService } from "../../../../usager-shared/services/interaction.service"; import { Subscription } from "rxjs"; +import { InteractionEvent } from "@domifa/common"; @Component({ selector: "app-profil-historique-courriers", diff --git a/packages/frontend/src/app/modules/usager-profil/components/pages/profil-general-section/profil-general-section.component.ts b/packages/frontend/src/app/modules/usager-profil/components/pages/profil-general-section/profil-general-section.component.ts index 7e4d2084f3..82977f1ede 100644 --- a/packages/frontend/src/app/modules/usager-profil/components/pages/profil-general-section/profil-general-section.component.ts +++ b/packages/frontend/src/app/modules/usager-profil/components/pages/profil-general-section/profil-general-section.component.ts @@ -11,7 +11,6 @@ import { ProfilGeneralHistoriqueCourriersComponent } from "../../profil-general- import { BaseUsagerProfilPageComponent } from "../base-usager-profil-page/base-usager-profil-page.component"; import { ETAPES_DEMANDE_URL, - InteractionType, InteractionInForApi, INTERACTIONS_LABELS_SINGULIER, DEFAULT_MODAL_OPTIONS, @@ -22,7 +21,7 @@ import { Interaction } from "../../../../usager-shared/interfaces"; import { InteractionService } from "../../../../usager-shared/services/interaction.service"; import { UsagerProfilService } from "../../../services/usager-profil.service"; import { Store } from "@ngrx/store"; -import { USAGER_DECISION_STATUT_LABELS } from "@domifa/common"; +import { USAGER_DECISION_STATUT_LABELS, InteractionType } from "@domifa/common"; @Component({ selector: "app-profil-general-section", diff --git a/packages/frontend/src/app/modules/usager-shared/interfaces/interaction.ts b/packages/frontend/src/app/modules/usager-shared/interfaces/interaction.ts index 2528242d0f..98c41b716d 100644 --- a/packages/frontend/src/app/modules/usager-shared/interfaces/interaction.ts +++ b/packages/frontend/src/app/modules/usager-shared/interfaces/interaction.ts @@ -1,7 +1,6 @@ +import { InteractionType, InteractionEvent } from "@domifa/common"; import { - InteractionType, Interactions, - InteractionEvent, INTERACTIONS_LABELS_PLURIEL, INTERACTIONS_LABELS_SINGULIER, } from "../../../../_common/model/interaction";