From 0a4fc375f462d7b8320cfa01e955d2d6f61b6aec Mon Sep 17 00:00:00 2001 From: "Yassine R." Date: Wed, 15 Nov 2023 22:38:16 +0100 Subject: [PATCH 1/5] feat(portail): separate login from interactions --- .../interaction/INTERACTIONS_OK.const.ts | 1 - .../1699910877010-auto-migration.ts | 31 ++++++ .../1699913113875-manual-migration.ts | 59 ++++++++++++ .../services/admin-structures.service.ts | 6 +- .../portail-usagers-login.controller.ts | 36 +++---- .../UserUsagerLoginTable.typeorm.ts | 30 ++++++ .../database/entities/user-usager/index.ts | 3 + .../interactionRepository.service.ts | 4 +- .../database/services/user-usager/index.ts | 1 + .../userUsagerLoginRepository.service.ts | 18 ++++ .../StructureUsagersExportModel.type.ts | 4 +- .../exportListeCourriersWorksheetRenderer.ts | 1 + .../interactions/interactions.controller.ts | 27 +++++- .../interactionsCreator.service.spec.ts | 96 +++++++++---------- .../services/interactionsCreator.service.ts | 7 +- ...sInPeriodInteractionsRepository.service.ts | 8 +- .../export-structure-usagers.controller.ts | 4 +- packages/common/src/index.ts | 1 + .../constants/INTERACTIONS_LABELS.const.ts | 4 +- .../src/interactions/constants/index.ts | 1 + .../types/InteractionType.type.ts | 3 +- .../user-usager/UserUsagerLogin.interface.ts | 6 ++ packages/common/src/user-usager/index.ts | 2 + .../model/interaction/constants/index.ts | 2 - .../src/_common/model/interaction/index.ts | 1 - .../message-sms/MESSAGE_SMS_STATUS.const.ts | 1 - .../column-interactions.component.ts | 3 +- .../structure-stats.component.ts | 6 ++ ...il-historique-login-portail.component.html | 83 ++++++++++++++++ ...historique-login-portail.component.spec.ts | 22 +++++ ...ofil-historique-login-portail.component.ts | 80 ++++++++++++++++ .../profil-general-section.component.ts | 7 +- .../profil-historique.component.html | 17 ++++ .../profil-historique.component.ts | 10 ++ .../usager-profil/usager-profil.module.ts | 2 + .../usager-shared/interfaces/interaction.ts | 5 +- .../services/interaction.service.ts | 11 +++ .../src/_common/_core/ApiMessage.type.ts | 1 - .../portail-admins/src/_common/_core/index.ts | 1 - packages/portail-admins/src/_common/index.ts | 1 - .../interaction/InteractionEvent.type.ts | 1 - .../_common/interaction/InteractionIn.type.ts | 1 - .../interaction/InteractionOut.type.ts | 1 - .../interaction/InteractionType.type.ts | 11 --- .../_common/interaction/Interactions.type.ts | 20 ---- .../INTERACTIONS_IN_AVAILABLE.const.ts | 7 -- .../constants/INTERACTIONS_LABELS.const.ts | 31 ------ .../INTERACTIONS_OUT_AVAILABLE.const.ts | 7 -- .../_common/interaction/constants/index.ts | 4 - .../src/_common/interaction/index.ts | 7 -- .../stats/AdminStructureStatsData.type.ts | 8 +- .../src/_common/stats/MessageSmsId.type.ts | 4 - .../_common/stats/MessageSmsReminders.type.ts | 4 - .../src/_common/stats/StatsPeriod.type.ts | 1 - .../_common/stats/StatsSmsApiDatas.type.ts | 4 - .../_common/stats/StatsSmsChartsDatas.type.ts | 7 -- .../portail-admins/src/_common/stats/index.ts | 5 - .../usager/AyantDroitLienParente.type.ts | 1 - .../_common/usager/UsagerAyantDroit.type.ts | 2 +- .../src/_common/usager/UsagerDecision.type.ts | 3 +- .../usager/UsagerDecisionStatut.type.ts | 6 -- .../src/_common/usager/UsagerSexe.type.ts | 1 - .../src/_common/usager/UsagerTypeDom.type.ts | 1 - .../constants/LIEN_PARENTE_LABELS.const.ts | 2 +- .../USAGER_DECISION_STATUT_COLORS.const.ts | 2 +- .../USAGER_DECISION_STATUT_LABELS.const.ts | 2 +- ...GER_DECISION_STATUT_LABELS_PROFIL.const.ts | 3 +- .../src/_common/usager/index.ts | 8 +- .../admin-structures-stats.component.ts | 3 +- .../vm/AdminStructuresStatsVM.type.ts | 4 +- .../adminStructuresStatsVmBuilder.service.ts | 6 +- .../admin-structures-api-client.service.ts | 2 +- 72 files changed, 520 insertions(+), 255 deletions(-) create mode 100644 packages/backend/src/_migrations/1699910877010-auto-migration.ts create mode 100644 packages/backend/src/_migrations/1699913113875-manual-migration.ts create mode 100644 packages/backend/src/database/entities/user-usager/UserUsagerLoginTable.typeorm.ts create mode 100644 packages/backend/src/database/services/user-usager/userUsagerLoginRepository.service.ts rename packages/{frontend/src/_common/model/interaction => common/src/interactions}/constants/INTERACTIONS_LABELS.const.ts (85%) create mode 100644 packages/common/src/user-usager/UserUsagerLogin.interface.ts create mode 100644 packages/common/src/user-usager/index.ts delete mode 100644 packages/frontend/src/_common/model/interaction/constants/index.ts create mode 100644 packages/frontend/src/app/modules/usager-profil/components/_historiques/profil-historique-login-portail/profil-historique-login-portail.component.html create mode 100644 packages/frontend/src/app/modules/usager-profil/components/_historiques/profil-historique-login-portail/profil-historique-login-portail.component.spec.ts create mode 100644 packages/frontend/src/app/modules/usager-profil/components/_historiques/profil-historique-login-portail/profil-historique-login-portail.component.ts delete mode 100644 packages/portail-admins/src/_common/_core/ApiMessage.type.ts delete mode 100644 packages/portail-admins/src/_common/interaction/InteractionEvent.type.ts delete mode 100644 packages/portail-admins/src/_common/interaction/InteractionIn.type.ts delete mode 100644 packages/portail-admins/src/_common/interaction/InteractionOut.type.ts delete mode 100644 packages/portail-admins/src/_common/interaction/InteractionType.type.ts delete mode 100644 packages/portail-admins/src/_common/interaction/Interactions.type.ts delete mode 100644 packages/portail-admins/src/_common/interaction/constants/INTERACTIONS_IN_AVAILABLE.const.ts delete mode 100644 packages/portail-admins/src/_common/interaction/constants/INTERACTIONS_LABELS.const.ts delete mode 100644 packages/portail-admins/src/_common/interaction/constants/INTERACTIONS_OUT_AVAILABLE.const.ts delete mode 100644 packages/portail-admins/src/_common/interaction/constants/index.ts delete mode 100644 packages/portail-admins/src/_common/interaction/index.ts delete mode 100644 packages/portail-admins/src/_common/stats/MessageSmsId.type.ts delete mode 100644 packages/portail-admins/src/_common/stats/MessageSmsReminders.type.ts delete mode 100644 packages/portail-admins/src/_common/stats/StatsPeriod.type.ts delete mode 100644 packages/portail-admins/src/_common/stats/StatsSmsApiDatas.type.ts delete mode 100644 packages/portail-admins/src/_common/stats/StatsSmsChartsDatas.type.ts delete mode 100644 packages/portail-admins/src/_common/usager/AyantDroitLienParente.type.ts delete mode 100644 packages/portail-admins/src/_common/usager/UsagerDecisionStatut.type.ts delete mode 100644 packages/portail-admins/src/_common/usager/UsagerSexe.type.ts delete mode 100644 packages/portail-admins/src/_common/usager/UsagerTypeDom.type.ts diff --git a/packages/backend/src/_common/model/interaction/INTERACTIONS_OK.const.ts b/packages/backend/src/_common/model/interaction/INTERACTIONS_OK.const.ts index e8a2322c0e..116bc209c3 100644 --- a/packages/backend/src/_common/model/interaction/INTERACTIONS_OK.const.ts +++ b/packages/backend/src/_common/model/interaction/INTERACTIONS_OK.const.ts @@ -10,7 +10,6 @@ export const ALL_INTERACTION_TYPES: InteractionType[] = [ "appel", "visite", "npai", - "loginPortail", ]; export const INTERACTION_OK_LIST: InteractionType[] = [ diff --git a/packages/backend/src/_migrations/1699910877010-auto-migration.ts b/packages/backend/src/_migrations/1699910877010-auto-migration.ts new file mode 100644 index 0000000000..405cf0bec3 --- /dev/null +++ b/packages/backend/src/_migrations/1699910877010-auto-migration.ts @@ -0,0 +1,31 @@ +import { MigrationInterface, QueryRunner } from "typeorm"; + +export class AutoMigration1699910877010 implements MigrationInterface { + name = "AutoMigration1699910877010"; + public async up(queryRunner: QueryRunner): Promise { + await queryRunner.query( + `CREATE TABLE "user_usager_login" ("uuid" uuid NOT NULL DEFAULT uuid_generate_v4(), "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "updatedAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "version" integer NOT NULL, "usagerUUID" uuid NOT NULL, "structureId" integer NOT NULL, CONSTRAINT "PK_cfb7dc4a81d1db054ab5b4d50bf" PRIMARY KEY ("uuid"))` + ); + await queryRunner.query( + `CREATE INDEX "idx_user_usager_login" ON "user_usager_login" ("structureId", "usagerUUID") ` + ); + await queryRunner.query( + `ALTER TABLE "user_usager_login" ADD CONSTRAINT "FK_4bf76763fec5203f945338a0377" FOREIGN KEY ("usagerUUID") REFERENCES "usager"("uuid") ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE "user_usager_login" ADD CONSTRAINT "FK_8722e56ff917692645abcd29e7c" FOREIGN KEY ("structureId") REFERENCES "structure"("id") ON DELETE CASCADE ON UPDATE NO ACTION` + ); + } + + public async down(queryRunner: QueryRunner): Promise { + await queryRunner.query( + `ALTER TABLE "user_usager_login" DROP CONSTRAINT "FK_8722e56ff917692645abcd29e7c"` + ); + await queryRunner.query( + `ALTER TABLE "user_usager_login" DROP CONSTRAINT "FK_4bf76763fec5203f945338a0377"` + ); + + await queryRunner.query(`DROP INDEX "public"."idx_user_usager_login"`); + await queryRunner.query(`DROP TABLE "user_usager_login"`); + } +} diff --git a/packages/backend/src/_migrations/1699913113875-manual-migration.ts b/packages/backend/src/_migrations/1699913113875-manual-migration.ts new file mode 100644 index 0000000000..cdfaf1fa47 --- /dev/null +++ b/packages/backend/src/_migrations/1699913113875-manual-migration.ts @@ -0,0 +1,59 @@ +/* eslint-disable @typescript-eslint/no-unused-vars */ +import { In, MigrationInterface, QueryRunner } from "typeorm"; +import { + UserUsagerLoginTable, + interactionRepository, + userUsagerLoginRepository, +} from "../database"; + +export class ManualMigration1699913113875 implements MigrationInterface { + public async up(queryRunner: QueryRunner): Promise { + let i = 0; + const total = await interactionRepository.countBy({ + type: "loginPortail" as any, + }); + + const batch = 25000; + while ( + (await interactionRepository.countBy({ type: "loginPortail" as any })) > 0 + ) { + const uuidsToDelete = []; + const interactions = await interactionRepository.find({ + where: { type: "loginPortail" as any }, + take: batch, + select: { + dateInteraction: true, + uuid: true, + usagerUUID: true, + structureId: true, + updatedAt: true, + }, + }); + + await queryRunner.startTransaction(); + try { + for (const interaction of interactions) { + const userUsagerLogin = new UserUsagerLoginTable(); + userUsagerLogin.usagerUUID = interaction.usagerUUID; + userUsagerLogin.structureId = interaction.structureId; + userUsagerLogin.createdAt = interaction.dateInteraction; + userUsagerLogin.updatedAt = interaction.updatedAt; + await userUsagerLoginRepository.save(userUsagerLogin); + uuidsToDelete.push(interaction.uuid); + } + + await interactionRepository.delete({ uuid: In(uuidsToDelete) }); + await queryRunner.commitTransaction(); + i = i + batch; + console.log(`${i}/${total} interactions migrated`); + } catch (err) { + await queryRunner.rollbackTransaction(); + throw err; + } + } + } + + public async down(_queryRunner: QueryRunner): Promise { + // + } +} 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 8ce1bb1c6b..970f5c2633 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 @@ -10,6 +10,7 @@ import { typeOrmSearch, usagerRepository, UsagerTable, + userUsagerLoginRepository, } from "../../../database"; import { usagerDocsRepository } from "../../../database/services/usager/usagerDocsRepository.service"; import { StatsDeploiementExportModel } from "../../../excel/export-stats-deploiement"; @@ -140,7 +141,7 @@ export class AdminStructuresService { } public async getInteractionsCountByTypeMap(): Promise<{ - [statut in InteractionType]: number; + [statut in InteractionType | "loginPortail"]: number; }> { return { courrierIn: await this.totalInteractions("courrierIn"), @@ -152,7 +153,7 @@ export class AdminStructuresService { appel: await this.totalInteractions("appel"), visite: await this.totalInteractions("visite"), npai: await this.totalInteractions("npai"), - loginPortail: await this.totalInteractions("loginPortail"), + loginPortail: await userUsagerLoginRepository.count(), }; } @@ -370,7 +371,6 @@ export class AdminStructuresService { if ( interactionType === "appel" || interactionType === "visite" || - interactionType === "loginPortail" || interactionType === "npai" ) { return interactionRepository.count({ diff --git a/packages/backend/src/_portail-usager/portail-usager-login/portail-usagers-login.controller.ts b/packages/backend/src/_portail-usager/portail-usager-login/portail-usagers-login.controller.ts index 61dceee071..8878c8911e 100644 --- a/packages/backend/src/_portail-usager/portail-usager-login/portail-usagers-login.controller.ts +++ b/packages/backend/src/_portail-usager/portail-usager-login/portail-usagers-login.controller.ts @@ -9,7 +9,9 @@ import { } from "@nestjs/common"; import { ApiTags } from "@nestjs/swagger"; import { + UserUsagerLoginTable, usagerRepository, + userUsagerLoginRepository, userUsagerSecurityPasswordChecker, } from "../../database"; import { UsagerLoginDto } from "../../users/dto"; @@ -17,11 +19,9 @@ import { ExpressResponse } from "../../util/express"; import { PortailUsagerAuthApiResponse, PortailUsagerProfile, - UserStructure, } from "../../_common/model"; import { portailUsagerProfilBuilder } from "../portail-usager-profil/services/portail-usager-profil-builder.service"; import { UsagersAuthService } from "./services/usagers-auth.service"; -import { interactionsCreator } from "../../interactions/services"; @Controller("portail-usagers/auth") @ApiTags("auth") @@ -60,26 +60,20 @@ export class PortailUsagersLoginController { id: user.structureId, }); - const userStructure: Pick< - UserStructure, - "id" | "structureId" | "nom" | "prenom" | "structure" - > = { - id: 0, - nom: usager.nom, - prenom: usager.prenom, - structureId: user.structureId, - structure, - }; + await userUsagerLoginRepository.save( + new UserUsagerLoginTable({ + usagerUUID: usager.uuid, + structureId: usager.structureId, + }) + ); - // Création d'une interaction avec la date de connexion - await interactionsCreator.createInteraction({ - interaction: { - type: "loginPortail", - nbCourrier: 0, - }, - usager, - user: userStructure, - }); + if (structure.portailUsager.usagerLoginUpdateLastInteraction) { + usager.lastInteraction.dateInteraction = new Date(); + await usagerRepository.update( + { uuid: usager.uuid }, + { lastInteraction: usager.lastInteraction } + ); + } const response: PortailUsagerAuthApiResponse = { token: access_token, diff --git a/packages/backend/src/database/entities/user-usager/UserUsagerLoginTable.typeorm.ts b/packages/backend/src/database/entities/user-usager/UserUsagerLoginTable.typeorm.ts new file mode 100644 index 0000000000..a8c80569d8 --- /dev/null +++ b/packages/backend/src/database/entities/user-usager/UserUsagerLoginTable.typeorm.ts @@ -0,0 +1,30 @@ +import { Column, Entity, Index, JoinColumn, ManyToOne } from "typeorm"; +import { StructureTable, UsagerTable } from ".."; +import { AppTypeormTable } from "../_core/AppTypeormTable.typeorm"; +import { UserUsagerLogin } from "@domifa/common"; + +@Entity({ name: "user_usager_login" }) +@Index("idx_user_usager_login", ["structureId", "usagerUUID"]) +export class UserUsagerLoginTable + extends AppTypeormTable + implements UserUsagerLogin +{ + @Column({ type: "uuid", nullable: false }) + @ManyToOne(() => UsagerTable, (usager) => usager.uuid, { + onDelete: "CASCADE", + }) + @JoinColumn({ name: "usagerUUID", referencedColumnName: "uuid" }) + public usagerUUID: string; + + @ManyToOne(() => StructureTable, (structure) => structure.id, { + onDelete: "CASCADE", + }) + @Column({ type: "integer", nullable: false }) + @JoinColumn({ name: "structureId", referencedColumnName: "id" }) + public structureId: number; + + public constructor(entity?: Partial) { + super(entity); + Object.assign(this, entity); + } +} diff --git a/packages/backend/src/database/entities/user-usager/index.ts b/packages/backend/src/database/entities/user-usager/index.ts index 53c0f11936..17898b70b2 100644 --- a/packages/backend/src/database/entities/user-usager/index.ts +++ b/packages/backend/src/database/entities/user-usager/index.ts @@ -1 +1,4 @@ +// @index('./*', f => `export * from '${f.path}'`) +export * from "./UserUsagerLoginTable.typeorm"; +export * from "./UserUsagerSecurityTable.typeorm"; export * from "./UserUsagerTable.typeorm"; diff --git a/packages/backend/src/database/services/interaction/interactionRepository.service.ts b/packages/backend/src/database/services/interaction/interactionRepository.service.ts index 292728f9b5..b732b90819 100644 --- a/packages/backend/src/database/services/interaction/interactionRepository.service.ts +++ b/packages/backend/src/database/services/interaction/interactionRepository.service.ts @@ -251,7 +251,6 @@ async function totalInteractionAllUsagersStructure({ coalesce (COUNT(CASE WHEN i.type = 'appel' THEN 1 END), 0) AS "appel", coalesce (COUNT(CASE WHEN i.type = 'visite' THEN 1 END), 0) AS "visite", coalesce (COUNT(CASE WHEN i.type = 'npai' THEN 1 END), 0) AS "npai", - coalesce (COUNT(CASE WHEN i.type = 'loginPortail' THEN 1 END), 0) AS "loginPortail", coalesce (SUM(CASE WHEN i.type = 'courrierIn' THEN "nbCourrier" END), 0) AS "courrierIn", coalesce (SUM(CASE WHEN i.type = 'courrierOut' THEN "nbCourrier" END), 0) AS "courrierOut", coalesce (SUM(CASE WHEN i.type = 'recommandeIn' THEN "nbCourrier" END), 0) AS "recommandeIn", @@ -264,6 +263,7 @@ async function totalInteractionAllUsagersStructure({ const results = await interactionRepository.query(query, [structureId]); + // TODO: add loginPortail return results.map((x: any) => ({ usagerRef: x.usagerRef, courrierIn: parseInt(x.courrierIn, 10), @@ -274,7 +274,7 @@ async function totalInteractionAllUsagersStructure({ colisOut: parseInt(x.colisOut, 10), appel: parseInt(x.appel, 10), visite: parseInt(x.visite, 10), - loginPortail: parseInt(x.loginPortail, 10), + loginPortail: 0, npai: parseInt(x.npai, 10), })); } diff --git a/packages/backend/src/database/services/user-usager/index.ts b/packages/backend/src/database/services/user-usager/index.ts index 803c7acd5f..3f8606b87a 100644 --- a/packages/backend/src/database/services/user-usager/index.ts +++ b/packages/backend/src/database/services/user-usager/index.ts @@ -1,2 +1,3 @@ export * from "./user-usager-security"; +export * from "./userUsagerLoginRepository.service"; export * from "./userUsagerRepository.service"; diff --git a/packages/backend/src/database/services/user-usager/userUsagerLoginRepository.service.ts b/packages/backend/src/database/services/user-usager/userUsagerLoginRepository.service.ts new file mode 100644 index 0000000000..a89bd32aef --- /dev/null +++ b/packages/backend/src/database/services/user-usager/userUsagerLoginRepository.service.ts @@ -0,0 +1,18 @@ +import { Between } from "typeorm"; +import { UserUsagerLoginTable } from "../../entities"; +import { myDataSource } from "../_postgres"; + +export const userUsagerLoginRepository = myDataSource + .getRepository(UserUsagerLoginTable) + .extend({ + countBetween( + dateInteractionBefore: Date, + dateInteractionAfter: Date, + structureId: number + ) { + return userUsagerLoginRepository.countBy({ + structureId, + createdAt: Between(dateInteractionAfter, dateInteractionBefore), + }); + }, + }); 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 87f59a5cd3..e79147166c 100644 --- a/packages/backend/src/excel/export-structure-usagers/StructureUsagersExportModel.type.ts +++ b/packages/backend/src/excel/export-structure-usagers/StructureUsagersExportModel.type.ts @@ -5,6 +5,8 @@ export type StructureUsagersExportModel = { exportDate: Date; usagers: Usager[]; usagersInteractionsCountByType: { - [usagerRef: number]: { [interactionType in InteractionType]: number }; + [usagerRef: number]: { + [interactionType in InteractionType | "loginPortail"]: number; + }; }; }; diff --git a/packages/backend/src/excel/export-structure-usagers/worksheet-renderer/exportListeCourriersWorksheetRenderer.ts b/packages/backend/src/excel/export-structure-usagers/worksheet-renderer/exportListeCourriersWorksheetRenderer.ts index ed152a30a1..236c9f1e98 100644 --- a/packages/backend/src/excel/export-structure-usagers/worksheet-renderer/exportListeCourriersWorksheetRenderer.ts +++ b/packages/backend/src/excel/export-structure-usagers/worksheet-renderer/exportListeCourriersWorksheetRenderer.ts @@ -87,6 +87,7 @@ function renderWorksheet({ appel: usagersInteractionsCounts.appel, visite: usagersInteractionsCounts.visite, npai: usagersInteractionsCounts.npai, + // TODO: check loginPOrtail loginPortail: usagersInteractionsCounts.loginPortail, }, }; diff --git a/packages/backend/src/interactions/interactions.controller.ts b/packages/backend/src/interactions/interactions.controller.ts index 5a62a3cf73..bc0778b078 100644 --- a/packages/backend/src/interactions/interactions.controller.ts +++ b/packages/backend/src/interactions/interactions.controller.ts @@ -23,7 +23,7 @@ import { UsagerAccessGuard, InteractionsGuard, } from "../auth/guards"; -import { interactionRepository } from "../database"; +import { interactionRepository, userUsagerLoginRepository } from "../database"; import { UserStructureAuthenticated, Interactions, @@ -105,6 +105,31 @@ export class InteractionsController { return new PageResultsDto(entities, pageMetaDto); } + @Post("search-login-portail/:usagerRef") + @AllowUserProfiles("structure") + public async getLoginPortailHistory( + @Param("usagerRef", new ParseIntPipe()) _usagerRef: number, + @CurrentUser() user: UserStructureAuthenticated, + @CurrentUsager() currentUsager: Usager, + @Body() pageOptionsDto: PageOptionsDto + ) { + const queryBuilder = userUsagerLoginRepository + .createQueryBuilder("user_usager_login") + .select([`"createdAt"`]) + .where({ + structureId: user.structureId, + usagerUUID: currentUsager.uuid, + }) + .orderBy(`"createdAt"`, pageOptionsDto.order) + .skip((pageOptionsDto.page - 1) * pageOptionsDto.take) + .take(pageOptionsDto.take); + + const itemCount = await queryBuilder.getCount(); + const entities = await queryBuilder.getRawMany(); + const pageMetaDto = new PageMetaDto({ itemCount, pageOptionsDto }); + return new PageResultsDto(entities, pageMetaDto); + } + @UseGuards(InteractionsGuard) @AllowUserProfiles("structure") @Delete(":usagerRef/:interactionUuid") diff --git a/packages/backend/src/interactions/services/interactionsCreator.service.spec.ts b/packages/backend/src/interactions/services/interactionsCreator.service.spec.ts index 1d147e81bc..686946e9c0 100644 --- a/packages/backend/src/interactions/services/interactionsCreator.service.spec.ts +++ b/packages/backend/src/interactions/services/interactionsCreator.service.spec.ts @@ -435,52 +435,52 @@ describe("interactionsCreator", () => { }); }); - describe("5. Création d'une interaction à la suite d'une connexion au portail", () => { - it("Sans mise à jour de la date de dernier passage", async () => { - const interaction: InteractionDto = { - type: "loginPortail", - nbCourrier: 0, - }; - - const resultat = await interactionsCreator.createInteraction({ - usager, - user, - interaction, - }); - - expect(resultat.usager.lastInteraction.dateInteraction).toEqual( - usager.lastInteraction.dateInteraction - ); - expect(resultat.interaction.nbCourrier).toEqual(0); - }); - - it("Avec mise à jour de la date de dernier passage", async () => { - const interaction: InteractionDto = { - type: "loginPortail", - nbCourrier: 1111, // Test avec un faux numéro, on vérifie que c'est bien 0 qui est enregistré - }; - - user.structure.portailUsager.usagerLoginUpdateLastInteraction = true; - - const resultat = await interactionsCreator.createInteraction({ - usager, - user, - interaction, - }); - - expect(resultat.usager.lastInteraction.dateInteraction).toEqual( - MOCKED_NEW_DATE - ); - - expect(resultat.interaction.nbCourrier).toEqual(0); - - // Suppression de l'interaction sortante - await interactionsDeletor.deleteInteraction({ - interaction: resultat.interaction, - structure: user.structure, - usager, - user, - }); - }); - }); + // describe("5. Création d'une interaction à la suite d'une connexion au portail", () => { + // it("Sans mise à jour de la date de dernier passage", async () => { + // const interaction: InteractionDto = { + // type: "loginPortail", + // nbCourrier: 0, + // }; + + // const resultat = await interactionsCreator.createInteraction({ + // usager, + // user, + // interaction, + // }); + + // expect(resultat.usager.lastInteraction.dateInteraction).toEqual( + // usager.lastInteraction.dateInteraction + // ); + // expect(resultat.interaction.nbCourrier).toEqual(0); + // }); + + // it("Avec mise à jour de la date de dernier passage", async () => { + // const interaction: InteractionDto = { + // type: "loginPortail", + // nbCourrier: 1111, // Test avec un faux numéro, on vérifie que c'est bien 0 qui est enregistré + // }; + + // user.structure.portailUsager.usagerLoginUpdateLastInteraction = true; + + // const resultat = await interactionsCreator.createInteraction({ + // usager, + // user, + // interaction, + // }); + + // expect(resultat.usager.lastInteraction.dateInteraction).toEqual( + // MOCKED_NEW_DATE + // ); + + // expect(resultat.interaction.nbCourrier).toEqual(0); + + // // Suppression de l'interaction sortante + // await interactionsDeletor.deleteInteraction({ + // interaction: resultat.interaction, + // structure: user.structure, + // usager, + // user, + // }); + // }); + // }); }); diff --git a/packages/backend/src/interactions/services/interactionsCreator.service.ts b/packages/backend/src/interactions/services/interactionsCreator.service.ts index 94143433d8..eab1704ae0 100644 --- a/packages/backend/src/interactions/services/interactionsCreator.service.ts +++ b/packages/backend/src/interactions/services/interactionsCreator.service.ts @@ -88,12 +88,7 @@ async function createInteraction({ interaction.nbCourrier = interaction.nbCourrier ?? 1; } else { interaction.nbCourrier = 0; - if ( - interaction.type === "appel" || - interaction.type === "visite" || - (interaction.type === "loginPortail" && - user.structure.portailUsager.usagerLoginUpdateLastInteraction) - ) { + if (interaction.type === "appel" || interaction.type === "visite") { usager.lastInteraction.dateInteraction = now; } } diff --git a/packages/backend/src/stats/services/structureStatsQuestionsInPeriodInteractionsRepository.service.ts b/packages/backend/src/stats/services/structureStatsQuestionsInPeriodInteractionsRepository.service.ts index 3b89d99044..7d5dd32f48 100644 --- a/packages/backend/src/stats/services/structureStatsQuestionsInPeriodInteractionsRepository.service.ts +++ b/packages/backend/src/stats/services/structureStatsQuestionsInPeriodInteractionsRepository.service.ts @@ -84,12 +84,7 @@ async function getStats({ structureId, interactionType: "npai", }), - loginPortail: await countInteractions({ - dateInteractionBefore: endDateUTCExclusive, - dateInteractionAfter: startDateUTC, - structureId, - interactionType: "loginPortail", - }), + loginPortail: 0, }; return stats; } @@ -108,7 +103,6 @@ async function countInteractions({ if ( interactionType === "appel" || interactionType === "visite" || - interactionType === "loginPortail" || interactionType === "npai" ) { return interactionRepository.count({ 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 f153c68b15..118ff8c7bc 100644 --- a/packages/backend/src/usagers/controllers/export-structure-usagers.controller.ts +++ b/packages/backend/src/usagers/controllers/export-structure-usagers.controller.ts @@ -59,7 +59,9 @@ export class ExportStructureUsagersController { const usagers = await this.usagersService.export(user.structureId); const usagersInteractionsCountByType: { - [usagerRef: number]: { [interactionType in InteractionType]: number }; + [usagerRef: number]: { + [interactionType in InteractionType | "loginPortail"]: number; + }; } = {}; const interactionsByUsagerMap = diff --git a/packages/common/src/index.ts b/packages/common/src/index.ts index bb7a30419b..1ea7ec8c86 100644 --- a/packages/common/src/index.ts +++ b/packages/common/src/index.ts @@ -5,3 +5,4 @@ export * from "./message-sms"; export * from "./structure"; export * from "./usager"; export * from "./user-structure"; +export * from "./user-usager"; diff --git a/packages/frontend/src/_common/model/interaction/constants/INTERACTIONS_LABELS.const.ts b/packages/common/src/interactions/constants/INTERACTIONS_LABELS.const.ts similarity index 85% rename from packages/frontend/src/_common/model/interaction/constants/INTERACTIONS_LABELS.const.ts rename to packages/common/src/interactions/constants/INTERACTIONS_LABELS.const.ts index 3ad0129901..b2a23785d7 100644 --- a/packages/frontend/src/_common/model/interaction/constants/INTERACTIONS_LABELS.const.ts +++ b/packages/common/src/interactions/constants/INTERACTIONS_LABELS.const.ts @@ -1,4 +1,4 @@ -import { InteractionType } from "@domifa/common"; +import { type InteractionType } from "../types"; export const INTERACTIONS_LABELS_SINGULIER: { [key in InteractionType]: string; @@ -12,7 +12,6 @@ export const INTERACTIONS_LABELS_SINGULIER: { recommandeOut: "Avis de passage remis", visite: "Passage enregistré", npai: "Le courrier ne sera plus enregistré", - loginPortail: "Connexion au portail usager", }; export const INTERACTIONS_LABELS_PLURIEL: { @@ -27,5 +26,4 @@ export const INTERACTIONS_LABELS_PLURIEL: { recommandeOut: "Avis de passage remis", visite: "Passages enregistrés", npai: "Pli non distribuable enregistré", - loginPortail: "Connexion au portail usager", }; diff --git a/packages/common/src/interactions/constants/index.ts b/packages/common/src/interactions/constants/index.ts index c9b6570824..c4e66ff413 100644 --- a/packages/common/src/interactions/constants/index.ts +++ b/packages/common/src/interactions/constants/index.ts @@ -1,3 +1,4 @@ // @index('./*', f => `export * from '${f.path}'`) export * from "./INTERACTIONS_IN.const"; +export * from "./INTERACTIONS_LABELS.const"; export * from "./INTERACTIONS_OUT.const"; diff --git a/packages/common/src/interactions/types/InteractionType.type.ts b/packages/common/src/interactions/types/InteractionType.type.ts index afa5321fbd..e0f80b336d 100644 --- a/packages/common/src/interactions/types/InteractionType.type.ts +++ b/packages/common/src/interactions/types/InteractionType.type.ts @@ -7,5 +7,4 @@ export type InteractionType = | "colisOut" | "appel" | "visite" - | "npai" - | "loginPortail"; + | "npai"; diff --git a/packages/common/src/user-usager/UserUsagerLogin.interface.ts b/packages/common/src/user-usager/UserUsagerLogin.interface.ts new file mode 100644 index 0000000000..8cc584b8cd --- /dev/null +++ b/packages/common/src/user-usager/UserUsagerLogin.interface.ts @@ -0,0 +1,6 @@ +import { type AppEntity } from "../_core/AppEntity.type"; + +export interface UserUsagerLogin extends AppEntity { + usagerUUID: string; + structureId: number; +} diff --git a/packages/common/src/user-usager/index.ts b/packages/common/src/user-usager/index.ts new file mode 100644 index 0000000000..035b579ab0 --- /dev/null +++ b/packages/common/src/user-usager/index.ts @@ -0,0 +1,2 @@ +// @index('./*', f => `export * from '${f.path}'`) +export * from "./UserUsagerLogin.interface"; diff --git a/packages/frontend/src/_common/model/interaction/constants/index.ts b/packages/frontend/src/_common/model/interaction/constants/index.ts deleted file mode 100644 index 807c428b43..0000000000 --- a/packages/frontend/src/_common/model/interaction/constants/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -//@index('./*', f => `export * from '${f.path}'`) -export * from "./INTERACTIONS_LABELS.const"; diff --git a/packages/frontend/src/_common/model/interaction/index.ts b/packages/frontend/src/_common/model/interaction/index.ts index 7110aa8f58..cdd126ec4a 100644 --- a/packages/frontend/src/_common/model/interaction/index.ts +++ b/packages/frontend/src/_common/model/interaction/index.ts @@ -1,4 +1,3 @@ //@index('./*', f => `export * from '${f.path}'`) -export * from "./constants"; export * from "./InteractionForApi.interface"; export * from "./InteractionForms.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 9fa63614fa..69748004f9 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 @@ -15,5 +15,4 @@ export const SMS_LABELS: { echeanceDeuxMois: "Sms rappel de renouvellement", dernierPassageTroisMois: "Avertissement dernier passage plus de 3 mois", decision: "Nouvelle décision", - loginPortail: "Connexion au portail usager", }; 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 bc7e37aa91..02124d01b5 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 @@ -10,13 +10,12 @@ import { NgbModalRef, NgbModal } from "@ng-bootstrap/ng-bootstrap"; import { Subscription } from "rxjs"; import { InteractionInForApi, - INTERACTIONS_LABELS_SINGULIER, DEFAULT_MODAL_OPTIONS, } from "../../../../../_common/model"; import { CustomToastService } from "../../../shared/services"; import { UsagerFormModel } from "../../../usager-shared/interfaces"; import { InteractionService } from "../../../usager-shared/services"; -import { InteractionType } from "@domifa/common"; +import { INTERACTIONS_LABELS_SINGULIER, InteractionType } from "@domifa/common"; @Component({ selector: "app-manage-usagers-interactions", diff --git a/packages/frontend/src/app/modules/stats/components/structure-stats/structure-stats.component.ts b/packages/frontend/src/app/modules/stats/components/structure-stats/structure-stats.component.ts index 0cd49d6ae6..165e887021 100644 --- a/packages/frontend/src/app/modules/stats/components/structure-stats/structure-stats.component.ts +++ b/packages/frontend/src/app/modules/stats/components/structure-stats/structure-stats.component.ts @@ -137,7 +137,13 @@ export class StatsComponent implements OnInit, AfterViewInit, OnDestroy { if (year) { period.start = new Date(year.toString() + "-01-01"); period.end = new Date(year.toString() + "-12-31"); + } else { + this.end = + this.toDate !== null + ? new Date(this.formatter.formatEn(this.toDate)) + : null; } + const structureId = this.me?.structureId as number; this.subscription.add( diff --git a/packages/frontend/src/app/modules/usager-profil/components/_historiques/profil-historique-login-portail/profil-historique-login-portail.component.html b/packages/frontend/src/app/modules/usager-profil/components/_historiques/profil-historique-login-portail/profil-historique-login-portail.component.html new file mode 100644 index 0000000000..884fadbe0c --- /dev/null +++ b/packages/frontend/src/app/modules/usager-profil/components/_historiques/profil-historique-login-portail/profil-historique-login-portail.component.html @@ -0,0 +1,83 @@ +

+ Historique des connexions à Mon DomiFa: + {{ searchResults.meta.itemCount }} connexions +

+ + + +
+ + + + + + + + + + + + + + +
+ Historique des connexions au portail "Mon DomiFa" +
Date
+ {{ interaction.createdAt | date : "dd MMMM yyyy à HH:mm" }} +
+
+
+

Aucune connexion enregistrée sur Mon DomiFa

+
+
+ +
+
+ + +
+ + +
diff --git a/packages/frontend/src/app/modules/usager-profil/components/_historiques/profil-historique-login-portail/profil-historique-login-portail.component.spec.ts b/packages/frontend/src/app/modules/usager-profil/components/_historiques/profil-historique-login-portail/profil-historique-login-portail.component.spec.ts new file mode 100644 index 0000000000..6b1258bcc2 --- /dev/null +++ b/packages/frontend/src/app/modules/usager-profil/components/_historiques/profil-historique-login-portail/profil-historique-login-portail.component.spec.ts @@ -0,0 +1,22 @@ +import { ComponentFixture, TestBed } from "@angular/core/testing"; + +import { ProfilHistoriqueLoginPortailComponent } from "./profil-historique-login-portail.component"; + +describe("ProfilHistoriqueLoginPortailComponent", () => { + let component: ProfilHistoriqueLoginPortailComponent; + let fixture: ComponentFixture; + + beforeEach(async () => { + await TestBed.configureTestingModule({ + declarations: [ProfilHistoriqueLoginPortailComponent], + }).compileComponents(); + + fixture = TestBed.createComponent(ProfilHistoriqueLoginPortailComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it("should create", () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/packages/frontend/src/app/modules/usager-profil/components/_historiques/profil-historique-login-portail/profil-historique-login-portail.component.ts b/packages/frontend/src/app/modules/usager-profil/components/_historiques/profil-historique-login-portail/profil-historique-login-portail.component.ts new file mode 100644 index 0000000000..907b6fc7d4 --- /dev/null +++ b/packages/frontend/src/app/modules/usager-profil/components/_historiques/profil-historique-login-portail/profil-historique-login-portail.component.ts @@ -0,0 +1,80 @@ +import { Component, Input, OnDestroy, OnInit } from "@angular/core"; +import { UserUsagerLogin } from "@domifa/common"; +import { Subscription } from "rxjs"; +import { + UserStructure, + PageOptions, + Order, + PageResults, +} from "../../../../../../_common/model"; +import { UsagerFormModel } from "../../../../usager-shared/interfaces"; +import { InteractionService } from "../../../../usager-shared/services"; +import { fadeIn } from "../../../../../shared"; + +@Component({ + animations: [fadeIn], + selector: "app-profil-historique-login-portail", + templateUrl: "./profil-historique-login-portail.component.html", + styleUrls: ["../historique-table.scss"], +}) +export class ProfilHistoriqueLoginPortailComponent + implements OnInit, OnDestroy +{ + @Input() public usager!: UsagerFormModel; + @Input() public me!: UserStructure; + + public interactions: UserUsagerLogin[]; + private subscription = new Subscription(); + + public loading: boolean; + + public params: PageOptions = { + order: Order.DESC, + page: 1, + take: 10, + }; + + public searchResults: PageResults = { + data: [], + meta: { + page: 0, + take: 0, + itemCount: 0, + pageCount: 0, + hasPreviousPage: false, + hasNextPage: false, + }, + }; + + constructor(private readonly interactionService: InteractionService) { + this.loading = true; + this.interactions = []; + } + + public ngOnInit(): void { + this.getInteractions(); + } + + public getInteractions() { + this.loading = true; + this.subscription.add( + this.interactionService + .getLoginPortail(this.usager.ref, this.params) + .subscribe((searchResults: PageResults) => { + console.log(searchResults); + this.loading = false; + this.interactions = searchResults.data; + this.searchResults = searchResults; + window.scroll({ + behavior: "smooth", + left: 0, + top: 0, + }); + }) + ); + } + + public ngOnDestroy(): void { + this.subscription.unsubscribe(); + } +} 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 ae60e21b86..e6df2825e2 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 @@ -12,7 +12,6 @@ import { BaseUsagerProfilPageComponent } from "../base-usager-profil-page/base-u import { ETAPES_DEMANDE_URL, InteractionInForApi, - INTERACTIONS_LABELS_SINGULIER, DEFAULT_MODAL_OPTIONS, } from "../../../../../../_common/model"; import { minDateNaissance, formatDateToNgb } from "../../../../../shared"; @@ -21,7 +20,11 @@ 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, InteractionType } from "@domifa/common"; +import { + INTERACTIONS_LABELS_SINGULIER, + USAGER_DECISION_STATUT_LABELS, + InteractionType, +} from "@domifa/common"; @Component({ selector: "app-profil-general-section", diff --git a/packages/frontend/src/app/modules/usager-profil/components/pages/profil-historique/profil-historique.component.html b/packages/frontend/src/app/modules/usager-profil/components/pages/profil-historique/profil-historique.component.html index 9635190827..de306398da 100644 --- a/packages/frontend/src/app/modules/usager-profil/components/pages/profil-historique/profil-historique.component.html +++ b/packages/frontend/src/app/modules/usager-profil/components/pages/profil-historique/profil-historique.component.html @@ -111,6 +111,7 @@

Historique du dossier

[usager]="usager" > +
Historique du dossier [usager]="usager" >
+
+ +
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 9a57ef64f0..437db32070 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 @@ -14,6 +14,7 @@ type HistorySections = | "notes" | "sms" | "procurations" + | "login-portail" | "transferts"; @Component({ selector: "app-profil-historique", @@ -86,5 +87,14 @@ export class ProfilHistoriqueComponent name: "SMS envoyés", }); } + if ( + this.me.structure.portailUsager.enabledByDomifa && + this.me.structure.portailUsager.enabledByStructure + ) { + this.sections.push({ + id: "login-portail", + name: "Connexions à Mon DomiFa", + }); + } } } diff --git a/packages/frontend/src/app/modules/usager-profil/usager-profil.module.ts b/packages/frontend/src/app/modules/usager-profil/usager-profil.module.ts index c199e3aebb..ac99bb618b 100644 --- a/packages/frontend/src/app/modules/usager-profil/usager-profil.module.ts +++ b/packages/frontend/src/app/modules/usager-profil/usager-profil.module.ts @@ -36,6 +36,7 @@ import { NgbDateCustomParserFormatter, CustomDatepickerI18n, } from "../shared/services"; +import { ProfilHistoriqueLoginPortailComponent } from "./components/_historiques/profil-historique-login-portail/profil-historique-login-portail.component"; @NgModule({ declarations: [ @@ -58,6 +59,7 @@ import { ProfilHistoriqueProcurationsComponent, ProfilHistoriqueTransfertsComponent, ProfilHistoriqueDecisionsComponent, + ProfilHistoriqueLoginPortailComponent, ], imports: [ CommonModule, 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 3490e2c00d..5239026aea 100644 --- a/packages/frontend/src/app/modules/usager-shared/interfaces/interaction.ts +++ b/packages/frontend/src/app/modules/usager-shared/interfaces/interaction.ts @@ -1,8 +1,9 @@ -import { InteractionType, CommonInteraction } from "@domifa/common"; import { INTERACTIONS_LABELS_PLURIEL, INTERACTIONS_LABELS_SINGULIER, -} from "../../../../_common/model/interaction"; + InteractionType, + CommonInteraction, +} from "@domifa/common"; export class Interaction implements CommonInteraction { public type: InteractionType; diff --git a/packages/frontend/src/app/modules/usager-shared/services/interaction.service.ts b/packages/frontend/src/app/modules/usager-shared/services/interaction.service.ts index 485971d385..a35666f52f 100644 --- a/packages/frontend/src/app/modules/usager-shared/services/interaction.service.ts +++ b/packages/frontend/src/app/modules/usager-shared/services/interaction.service.ts @@ -14,6 +14,7 @@ import { import { Interaction } from "../interfaces"; import { Store } from "@ngrx/store"; import { cacheManager } from "../../../shared"; +import { UserUsagerLogin } from "@domifa/common"; @Injectable({ providedIn: "root", @@ -59,6 +60,16 @@ export class InteractionService { ); } + public getLoginPortail( + usagerRef: number, + pageOptions: PageOptions + ): Observable> { + return this.http.post>( + `${this.endPoint}search-login-portail/${usagerRef}`, + pageOptions + ); + } + public delete( usagerRef: number, interactionUuid: string diff --git a/packages/portail-admins/src/_common/_core/ApiMessage.type.ts b/packages/portail-admins/src/_common/_core/ApiMessage.type.ts deleted file mode 100644 index e110311c12..0000000000 --- a/packages/portail-admins/src/_common/_core/ApiMessage.type.ts +++ /dev/null @@ -1 +0,0 @@ -export type ApiMessage = { message: string }; diff --git a/packages/portail-admins/src/_common/_core/index.ts b/packages/portail-admins/src/_common/_core/index.ts index 077e42eed1..64fdd18590 100644 --- a/packages/portail-admins/src/_common/_core/index.ts +++ b/packages/portail-admins/src/_common/_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/portail-admins/src/_common/index.ts b/packages/portail-admins/src/_common/index.ts index b00da00468..b223ccf38b 100644 --- a/packages/portail-admins/src/_common/index.ts +++ b/packages/portail-admins/src/_common/index.ts @@ -1,7 +1,6 @@ // @index('./*', f => `export * from '${f.path}'`) export * from "./_core"; export * from "./_portail-admin"; -export * from "./interaction"; export * from "./stats"; export * from "./structure"; export * from "./structure-doc"; diff --git a/packages/portail-admins/src/_common/interaction/InteractionEvent.type.ts b/packages/portail-admins/src/_common/interaction/InteractionEvent.type.ts deleted file mode 100644 index 25ed980f22..0000000000 --- a/packages/portail-admins/src/_common/interaction/InteractionEvent.type.ts +++ /dev/null @@ -1 +0,0 @@ -export type InteractionEvent = "create" | "delete"; diff --git a/packages/portail-admins/src/_common/interaction/InteractionIn.type.ts b/packages/portail-admins/src/_common/interaction/InteractionIn.type.ts deleted file mode 100644 index de4a73971f..0000000000 --- a/packages/portail-admins/src/_common/interaction/InteractionIn.type.ts +++ /dev/null @@ -1 +0,0 @@ -export type InteractionIn = "courrierIn" | "recommandeIn" | "colisIn"; diff --git a/packages/portail-admins/src/_common/interaction/InteractionOut.type.ts b/packages/portail-admins/src/_common/interaction/InteractionOut.type.ts deleted file mode 100644 index 0fb4544c0f..0000000000 --- a/packages/portail-admins/src/_common/interaction/InteractionOut.type.ts +++ /dev/null @@ -1 +0,0 @@ -export type InteractionOut = "courrierOut" | "recommandeOut" | "colisOut"; diff --git a/packages/portail-admins/src/_common/interaction/InteractionType.type.ts b/packages/portail-admins/src/_common/interaction/InteractionType.type.ts deleted file mode 100644 index afa5321fbd..0000000000 --- a/packages/portail-admins/src/_common/interaction/InteractionType.type.ts +++ /dev/null @@ -1,11 +0,0 @@ -export type InteractionType = - | "courrierIn" - | "courrierOut" - | "recommandeIn" - | "recommandeOut" - | "colisIn" - | "colisOut" - | "appel" - | "visite" - | "npai" - | "loginPortail"; diff --git a/packages/portail-admins/src/_common/interaction/Interactions.type.ts b/packages/portail-admins/src/_common/interaction/Interactions.type.ts deleted file mode 100644 index 8e9df6d809..0000000000 --- a/packages/portail-admins/src/_common/interaction/Interactions.type.ts +++ /dev/null @@ -1,20 +0,0 @@ -import { AppEntity } from ".."; -import { InteractionEvent } from "./InteractionEvent.type"; -import { InteractionType } from "./InteractionType.type"; - -export type Interactions = AppEntity & { - id?: number | null; - createdAt?: Date; - content?: string; - dateInteraction: Date | null; - nbCourrier: number; - structureId: number | null; - type: InteractionType; - usagerRef: number | null; - usagerUUID?: string | null; - userId: number | null; - userName: string | null; - uuid: string; - event: InteractionEvent; - previousValue?: Interactions; // if event === 'delete' -}; diff --git a/packages/portail-admins/src/_common/interaction/constants/INTERACTIONS_IN_AVAILABLE.const.ts b/packages/portail-admins/src/_common/interaction/constants/INTERACTIONS_IN_AVAILABLE.const.ts deleted file mode 100644 index f350534300..0000000000 --- a/packages/portail-admins/src/_common/interaction/constants/INTERACTIONS_IN_AVAILABLE.const.ts +++ /dev/null @@ -1,7 +0,0 @@ -import { InteractionIn } from "../InteractionIn.type"; - -export const INTERACTIONS_IN_AVAILABLE: InteractionIn[] = [ - "courrierIn", - "recommandeIn", - "colisIn", -]; diff --git a/packages/portail-admins/src/_common/interaction/constants/INTERACTIONS_LABELS.const.ts b/packages/portail-admins/src/_common/interaction/constants/INTERACTIONS_LABELS.const.ts deleted file mode 100644 index af91bba38b..0000000000 --- a/packages/portail-admins/src/_common/interaction/constants/INTERACTIONS_LABELS.const.ts +++ /dev/null @@ -1,31 +0,0 @@ -import { InteractionType } from "../InteractionType.type"; - -export const INTERACTIONS_LABELS_SINGULIER: { - [key in InteractionType]: string; -} = { - appel: "Appel téléphonique enregistré", - colisIn: "Colis enregistré", - colisOut: "Colis remis", - courrierIn: "Courrier enregistré", - courrierOut: "Courrier remis", - recommandeIn: "Avis de passage enregistré", - recommandeOut: "Avis de passage remis", - visite: "Passage enregistré", - npai: "Le courrier ne sera plus enregistré", - loginPortail: "Connexion au portail usager", -}; - -export const INTERACTIONS_LABELS_PLURIEL: { - [key in InteractionType]: string; -} = { - appel: "Appels téléphoniques", - colisIn: "Colis enregistrés", - colisOut: "Colis remis", - courrierIn: "Courriers enregistrés", - courrierOut: "Courriers remis", - recommandeIn: "Avis de passage enregistrés", - recommandeOut: "Avis de passage remis", - visite: "Passages enregistrés", - npai: "Pli non distribuable enregistré", - loginPortail: "Connexion au portail usager", -}; diff --git a/packages/portail-admins/src/_common/interaction/constants/INTERACTIONS_OUT_AVAILABLE.const.ts b/packages/portail-admins/src/_common/interaction/constants/INTERACTIONS_OUT_AVAILABLE.const.ts deleted file mode 100644 index cda2e8dc26..0000000000 --- a/packages/portail-admins/src/_common/interaction/constants/INTERACTIONS_OUT_AVAILABLE.const.ts +++ /dev/null @@ -1,7 +0,0 @@ -import { InteractionOut } from "../InteractionOut.type"; - -export const INTERACTIONS_OUT_AVAILABLE: InteractionOut[] = [ - "courrierOut", - "recommandeOut", - "colisOut", -]; diff --git a/packages/portail-admins/src/_common/interaction/constants/index.ts b/packages/portail-admins/src/_common/interaction/constants/index.ts deleted file mode 100644 index 113c9b869d..0000000000 --- a/packages/portail-admins/src/_common/interaction/constants/index.ts +++ /dev/null @@ -1,4 +0,0 @@ -//@index('./*', f => `export * from '${f.path}'`) -export * from "./INTERACTIONS_IN_AVAILABLE.const"; -export * from "./INTERACTIONS_LABELS.const"; -export * from "./INTERACTIONS_OUT_AVAILABLE.const"; diff --git a/packages/portail-admins/src/_common/interaction/index.ts b/packages/portail-admins/src/_common/interaction/index.ts deleted file mode 100644 index e5aacfaa17..0000000000 --- a/packages/portail-admins/src/_common/interaction/index.ts +++ /dev/null @@ -1,7 +0,0 @@ -//@index('./*', f => `export * from '${f.path}'`) -export * from "./constants"; -export * from "./InteractionEvent.type"; -export * from "./InteractionIn.type"; -export * from "./InteractionOut.type"; -export * from "./Interactions.type"; -export * from "./InteractionType.type"; diff --git a/packages/portail-admins/src/_common/stats/AdminStructureStatsData.type.ts b/packages/portail-admins/src/_common/stats/AdminStructureStatsData.type.ts index f61c0cddc9..6b0e81599f 100644 --- a/packages/portail-admins/src/_common/stats/AdminStructureStatsData.type.ts +++ b/packages/portail-admins/src/_common/stats/AdminStructureStatsData.type.ts @@ -1,7 +1,9 @@ -import { InteractionType } from "../interaction/InteractionType.type"; +import { + InteractionType, + StructureType, + UsagerDecisionStatut, +} from "@domifa/common"; import { StructureAdmin } from "../structure/StructureAdmin.type"; -import { StructureType } from "../structure/StructureType.type"; -import { UsagerDecisionStatut } from "../usager/UsagerDecisionStatut.type"; import { StatsByRegion } from "./StatsByRegion.type"; export type AdminStructureStatsData = { diff --git a/packages/portail-admins/src/_common/stats/MessageSmsId.type.ts b/packages/portail-admins/src/_common/stats/MessageSmsId.type.ts deleted file mode 100644 index e2a9637d6d..0000000000 --- a/packages/portail-admins/src/_common/stats/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/portail-admins/src/_common/stats/MessageSmsReminders.type.ts b/packages/portail-admins/src/_common/stats/MessageSmsReminders.type.ts deleted file mode 100644 index 55e33f398c..0000000000 --- a/packages/portail-admins/src/_common/stats/MessageSmsReminders.type.ts +++ /dev/null @@ -1,4 +0,0 @@ -export type MessageSmsReminders = - | "echeanceDeuxMois" // Fin de dom à venir - | "dernierPassageTroisMois" // N'est pas passé depuis 3 mois, radiation à venir - | "decision"; // Validation ou non d'une demande diff --git a/packages/portail-admins/src/_common/stats/StatsPeriod.type.ts b/packages/portail-admins/src/_common/stats/StatsPeriod.type.ts deleted file mode 100644 index af0ba0e197..0000000000 --- a/packages/portail-admins/src/_common/stats/StatsPeriod.type.ts +++ /dev/null @@ -1 +0,0 @@ -export type StatsPeriod = "days" | "months"; diff --git a/packages/portail-admins/src/_common/stats/StatsSmsApiDatas.type.ts b/packages/portail-admins/src/_common/stats/StatsSmsApiDatas.type.ts deleted file mode 100644 index af1b934ca9..0000000000 --- a/packages/portail-admins/src/_common/stats/StatsSmsApiDatas.type.ts +++ /dev/null @@ -1,4 +0,0 @@ -export type StatsSmsApiDatas = { - name: string; - value: string; -}[]; diff --git a/packages/portail-admins/src/_common/stats/StatsSmsChartsDatas.type.ts b/packages/portail-admins/src/_common/stats/StatsSmsChartsDatas.type.ts deleted file mode 100644 index 19ffdfdde6..0000000000 --- a/packages/portail-admins/src/_common/stats/StatsSmsChartsDatas.type.ts +++ /dev/null @@ -1,7 +0,0 @@ -export type StatsSmsChartsDatas = { - name: string; - series: { - name: string; - value: string; - }[]; -}[]; diff --git a/packages/portail-admins/src/_common/stats/index.ts b/packages/portail-admins/src/_common/stats/index.ts index e86811c0eb..a554e5682f 100644 --- a/packages/portail-admins/src/_common/stats/index.ts +++ b/packages/portail-admins/src/_common/stats/index.ts @@ -1,13 +1,8 @@ // @index('./*', f => `export * from '${f.path}'`) export * from "./AdminStructureStatsData.type"; export * from "./DEFAULT_PUBLIC_STATS.const"; -export * from "./MessageSmsId.type"; -export * from "./MessageSmsReminders.type"; export * from "./PublicStats.type"; export * from "./STATS_REGIONS_FOR_MAP.const"; export * from "./StatsByMonth.type"; export * from "./StatsByRegion.type"; -export * from "./StatsPeriod.type"; -export * from "./StatsSmsApiDatas.type"; -export * from "./StatsSmsChartsDatas.type"; export * from "./StatsTerritory.type"; diff --git a/packages/portail-admins/src/_common/usager/AyantDroitLienParente.type.ts b/packages/portail-admins/src/_common/usager/AyantDroitLienParente.type.ts deleted file mode 100644 index 736900194d..0000000000 --- a/packages/portail-admins/src/_common/usager/AyantDroitLienParente.type.ts +++ /dev/null @@ -1 +0,0 @@ -export type AyantDroiLienParent = "AUTRE" | "CONJOINT" | "ENFANT" | "PARENT"; diff --git a/packages/portail-admins/src/_common/usager/UsagerAyantDroit.type.ts b/packages/portail-admins/src/_common/usager/UsagerAyantDroit.type.ts index 1c22e70360..b96807aeaf 100644 --- a/packages/portail-admins/src/_common/usager/UsagerAyantDroit.type.ts +++ b/packages/portail-admins/src/_common/usager/UsagerAyantDroit.type.ts @@ -1,4 +1,4 @@ -import { AyantDroiLienParent } from "./AyantDroitLienParente.type"; +import { AyantDroiLienParent } from "@domifa/common"; export type UsagerAyantDroit = { nom: string; diff --git a/packages/portail-admins/src/_common/usager/UsagerDecision.type.ts b/packages/portail-admins/src/_common/usager/UsagerDecision.type.ts index d637ed8a9e..190bd82672 100644 --- a/packages/portail-admins/src/_common/usager/UsagerDecision.type.ts +++ b/packages/portail-admins/src/_common/usager/UsagerDecision.type.ts @@ -1,7 +1,6 @@ +import { UsagerDecisionStatut, UsagerTypeDom } from "@domifa/common"; import { UsagerDecisionMotif } from "./UsagerDecisionMotif.type"; import { UsagerDecisionOrientation } from "./UsagerDecisionOrientation.type"; -import { UsagerDecisionStatut } from "./UsagerDecisionStatut.type"; -import { UsagerTypeDom } from "./UsagerTypeDom.type"; export type UsagerDecision = { uuid?: string; // permet d'identifier une décision en cas de suppression de l'historique diff --git a/packages/portail-admins/src/_common/usager/UsagerDecisionStatut.type.ts b/packages/portail-admins/src/_common/usager/UsagerDecisionStatut.type.ts deleted file mode 100644 index 419b224b9b..0000000000 --- a/packages/portail-admins/src/_common/usager/UsagerDecisionStatut.type.ts +++ /dev/null @@ -1,6 +0,0 @@ -export type UsagerDecisionStatut = - | "VALIDE" - | "INSTRUCTION" - | "ATTENTE_DECISION" - | "REFUS" - | "RADIE"; diff --git a/packages/portail-admins/src/_common/usager/UsagerSexe.type.ts b/packages/portail-admins/src/_common/usager/UsagerSexe.type.ts deleted file mode 100644 index 523cae30f6..0000000000 --- a/packages/portail-admins/src/_common/usager/UsagerSexe.type.ts +++ /dev/null @@ -1 +0,0 @@ -export type UsagerSexe = "homme" | "femme"; diff --git a/packages/portail-admins/src/_common/usager/UsagerTypeDom.type.ts b/packages/portail-admins/src/_common/usager/UsagerTypeDom.type.ts deleted file mode 100644 index 174be3cafe..0000000000 --- a/packages/portail-admins/src/_common/usager/UsagerTypeDom.type.ts +++ /dev/null @@ -1 +0,0 @@ -export type UsagerTypeDom = "PREMIERE_DOM" | "RENOUVELLEMENT"; diff --git a/packages/portail-admins/src/_common/usager/constants/LIEN_PARENTE_LABELS.const.ts b/packages/portail-admins/src/_common/usager/constants/LIEN_PARENTE_LABELS.const.ts index 196edc6fcc..2af8452a1f 100644 --- a/packages/portail-admins/src/_common/usager/constants/LIEN_PARENTE_LABELS.const.ts +++ b/packages/portail-admins/src/_common/usager/constants/LIEN_PARENTE_LABELS.const.ts @@ -1,4 +1,4 @@ -import { AyantDroiLienParent } from "../AyantDroitLienParente.type"; +import { AyantDroiLienParent } from "@domifa/common"; export const LIEN_PARENTE_LABELS: { [key in AyantDroiLienParent]: string } = { AUTRE: "Autre personne à la charge du domicilié", diff --git a/packages/portail-admins/src/_common/usager/constants/USAGER_DECISION_STATUT_COLORS.const.ts b/packages/portail-admins/src/_common/usager/constants/USAGER_DECISION_STATUT_COLORS.const.ts index 553128beae..6ba37e3b34 100644 --- a/packages/portail-admins/src/_common/usager/constants/USAGER_DECISION_STATUT_COLORS.const.ts +++ b/packages/portail-admins/src/_common/usager/constants/USAGER_DECISION_STATUT_COLORS.const.ts @@ -1,4 +1,4 @@ -import { UsagerDecisionStatut } from ".."; +import { UsagerDecisionStatut } from "@domifa/common"; export const USAGER_DECISION_STATUT_COLORS: { [key in UsagerDecisionStatut]: string; diff --git a/packages/portail-admins/src/_common/usager/constants/USAGER_DECISION_STATUT_LABELS.const.ts b/packages/portail-admins/src/_common/usager/constants/USAGER_DECISION_STATUT_LABELS.const.ts index b1e8c91d74..8906a8158b 100644 --- a/packages/portail-admins/src/_common/usager/constants/USAGER_DECISION_STATUT_LABELS.const.ts +++ b/packages/portail-admins/src/_common/usager/constants/USAGER_DECISION_STATUT_LABELS.const.ts @@ -1,4 +1,4 @@ -import { UsagerDecisionStatut } from ".."; +import { UsagerDecisionStatut } from "@domifa/common"; export const USAGER_DECISION_STATUT_LABELS: { [key in UsagerDecisionStatut]: string; diff --git a/packages/portail-admins/src/_common/usager/constants/USAGER_DECISION_STATUT_LABELS_PROFIL.const.ts b/packages/portail-admins/src/_common/usager/constants/USAGER_DECISION_STATUT_LABELS_PROFIL.const.ts index 93a197f7a7..35f4ad6f2b 100644 --- a/packages/portail-admins/src/_common/usager/constants/USAGER_DECISION_STATUT_LABELS_PROFIL.const.ts +++ b/packages/portail-admins/src/_common/usager/constants/USAGER_DECISION_STATUT_LABELS_PROFIL.const.ts @@ -1,6 +1,5 @@ -import { UsagerDecisionStatut } from ".."; +import { UsagerDecisionStatut } from "@domifa/common"; -/* DÉCISIONS */ export const USAGER_DECISION_STATUT_LABELS_PROFIL: { [key in UsagerDecisionStatut]: string; } = { diff --git a/packages/portail-admins/src/_common/usager/index.ts b/packages/portail-admins/src/_common/usager/index.ts index 1c52cc1564..2e15248d1c 100644 --- a/packages/portail-admins/src/_common/usager/index.ts +++ b/packages/portail-admins/src/_common/usager/index.ts @@ -1,8 +1,10 @@ -export * from "./AyantDroitLienParente.type"; +//@index('./*', f => `export * from '${f.path}'`) +export * from "./constants"; export * from "./UsagerAyantDroit.type"; export * from "./UsagerDecision.type"; export * from "./UsagerDecisionMotif.type"; -export * from "./UsagerDecisionStatut.type"; +export * from "./UsagerDecisionOrientation.type"; +export * from "./UsagerDecisionStatusColor.type"; export * from "./UsagerEcheanceInfos.type"; export * from "./UsagerLastInteractions.type"; export * from "./UsagerOptions.type"; @@ -12,5 +14,3 @@ export * from "./UsagerOptionsTransfert.type"; export * from "./UsagerPreferenceContact.type"; export * from "./UsagerRdv.type"; export * from "./UsagerRdvInfos.type"; -export * from "./UsagerSexe.type"; -export * from "./UsagerTypeDom.type"; diff --git a/packages/portail-admins/src/app/modules/admin-structures/components/admin-structures-stats/admin-structures-stats.component.ts b/packages/portail-admins/src/app/modules/admin-structures/components/admin-structures-stats/admin-structures-stats.component.ts index 3b6d474a86..f8ddd1076c 100644 --- a/packages/portail-admins/src/app/modules/admin-structures/components/admin-structures-stats/admin-structures-stats.component.ts +++ b/packages/portail-admins/src/app/modules/admin-structures/components/admin-structures-stats/admin-structures-stats.component.ts @@ -5,7 +5,7 @@ import { AdminStructureStatsData, PortailAdminProfile, } from "../../../../../_common"; -import { INTERACTIONS_LABELS_PLURIEL } from "../../../../../_common/interaction"; + import { DASHBOARD_STATUS_LABELS, STRUCTURE_TYPE_LABELS, @@ -15,6 +15,7 @@ import { AdminAuthService } from "../../../admin-auth/services/admin-auth.servic import { AdminStructuresApiClient } from "../../../shared/services"; import { REGIONS_LISTE } from "../../../shared/territoires"; import { AdminStructuresStatsVM, adminStructuresStatsVmBuilder } from "./vm"; +import { INTERACTIONS_LABELS_PLURIEL } from "@domifa/common"; @Component({ selector: "app-admin-structures-stats", diff --git a/packages/portail-admins/src/app/modules/admin-structures/components/admin-structures-stats/vm/AdminStructuresStatsVM.type.ts b/packages/portail-admins/src/app/modules/admin-structures/components/admin-structures-stats/vm/AdminStructuresStatsVM.type.ts index f9a2e9875d..bd9c2abac9 100644 --- a/packages/portail-admins/src/app/modules/admin-structures/components/admin-structures-stats/vm/AdminStructuresStatsVM.type.ts +++ b/packages/portail-admins/src/app/modules/admin-structures/components/admin-structures-stats/vm/AdminStructuresStatsVM.type.ts @@ -1,9 +1,9 @@ import { InteractionType, - StatsByRegion, StructureType, UsagerDecisionStatut, -} from "../../../../../../_common"; +} from "@domifa/common"; +import { StatsByRegion } from "../../../../../../_common"; export type AdminStructuresStatsVM = { usersCount: number; diff --git a/packages/portail-admins/src/app/modules/admin-structures/components/admin-structures-stats/vm/adminStructuresStatsVmBuilder.service.ts b/packages/portail-admins/src/app/modules/admin-structures/components/admin-structures-stats/vm/adminStructuresStatsVmBuilder.service.ts index 2e0a32ce0a..a9a9f73801 100644 --- a/packages/portail-admins/src/app/modules/admin-structures/components/admin-structures-stats/vm/adminStructuresStatsVmBuilder.service.ts +++ b/packages/portail-admins/src/app/modules/admin-structures/components/admin-structures-stats/vm/adminStructuresStatsVmBuilder.service.ts @@ -1,10 +1,10 @@ import { - AdminStructureStatsData, - INTERACTIONS_LABELS_PLURIEL, InteractionType, StructureType, UsagerDecisionStatut, -} from "../../../../../../_common"; + INTERACTIONS_LABELS_PLURIEL, +} from "@domifa/common"; +import { AdminStructureStatsData } from "../../../../../../_common"; import { DASHBOARD_STATUS_LABELS, STRUCTURE_TYPE_LABELS, diff --git a/packages/portail-admins/src/app/modules/shared/services/api/admin-structures-api-client.service.ts b/packages/portail-admins/src/app/modules/shared/services/api/admin-structures-api-client.service.ts index 57fd2b4601..a0aa1131e7 100644 --- a/packages/portail-admins/src/app/modules/shared/services/api/admin-structures-api-client.service.ts +++ b/packages/portail-admins/src/app/modules/shared/services/api/admin-structures-api-client.service.ts @@ -9,8 +9,8 @@ import { StructureAdmin, UserNewAdmin, } from "../../../../../_common"; -import { ApiMessage } from "../../../../../_common/_core"; import { structuresCache } from "../../store/structuresCache.service"; +import { ApiMessage } from "@domifa/common"; const BASE_URL = environment.apiUrl + "admin/structures"; @Injectable() From 0f03f5c5a6f3c116a192725cb3edfad2d2b7ea1e Mon Sep 17 00:00:00 2001 From: "Yassine R." Date: Wed, 15 Nov 2023 22:40:12 +0100 Subject: [PATCH 2/5] fix(db): update db after migration --- .../db/dumps/domifa_test.postgres.custom.gz | Bin 90359 -> 92086 bytes ...domifa_test.postgres.restore-data-only.sql | 8 ++++++++ ...st.postgres.truncate-restore-data-only.sql | 8 ++++++++ 3 files changed, 16 insertions(+) diff --git a/_scripts/db/dumps/domifa_test.postgres.custom.gz b/_scripts/db/dumps/domifa_test.postgres.custom.gz index 174d0193a0c6c8cf90b8ec54b4f3b650acf35298..782c0ddfa91a0e1fff209ff3f7905ea722a3de70 100644 GIT binary patch delta 6752 zcmai2d3+Pq7S2i2ou+NlHr<%EG%Q7d%$CVewu*qrRvu6m3x!g_BA}G5qLmgA1RtCC z!H5W2WbuKl7ageZ0NE7yvG`Dstssc#uWVA5Qd-`fByFbY%a}is$(iqL-#z!-<&S;!zFI0@G0Io?l9c>_gUVARq7BhY))sgAs8D$0bi#G%MiL4!u+ej>mU3r{@0csq)imWYH7;rLY7-&A-zkN0-}OyxqbqmIQ1O5kYe%e9c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Pu&d5oUGCwv6Plk z2Z)eZ$roP$MGt)no>TX?fqCHb_r1DwWo;Y3eDktGCni;0-HsLuaG1Hx(&X$Z({(kX z1Eq+zdyACjC3{a=2pBFY(RnZpE-TCPAQP^*f3B)q^S~Yo*WAPFuAf=1zj?}O$kUHc z*#Ax34_OHnH6}|%e$|>?|2T8zmpWs|vE5_lZ&>x|g8tQItH!N=DYx--#4}?K%IiLi zPW$=uSLQ7_JD)o}ePQ44;+H&m`t|GyTg!$R&N78P4436|#dD-yYlqn~azlTeB-NZ% z4h)$7wA?9X{gU0)*N0=#VB3H$i*By}s9@M|$KU?f`IF6=5iji>eX?|L+fgGbR^*KR zIc(IlysvuM+RG)e1+!|F+`hAXeS;xu)w4#|6oH|}9m-Aj&n;CH;6$kMMjkN6+C Date: Mon, 20 Nov 2023 16:42:42 +0100 Subject: [PATCH 3/5] fix(mon-domifa): add user usager login in stats --- .talismanrc | 4 ++ .../db/dumps/domifa_test.postgres.custom.gz | Bin 92086 -> 91692 bytes ...domifa_test.postgres.restore-data-only.sql | 10 +-- ...st.postgres.truncate-restore-data-only.sql | 10 +-- .../portail-usagers-login.controller.ts | 4 +- .../interactionRepository.service.test.ts | 21 ++---- .../interactionRepository.service.ts | 64 ++++++++++++------ .../userUsagerLoginRepository.service.test.ts | 17 +++++ .../tests/usagers.controller.spec.ts | 2 +- ...historique-login-portail.component.spec.ts | 13 ++++ 10 files changed, 96 insertions(+), 49 deletions(-) create mode 100644 packages/backend/src/database/services/user-usager/userUsagerLoginRepository.service.test.ts diff --git a/.talismanrc b/.talismanrc index 3faffaac76..e6ee4d3dde 100644 --- a/.talismanrc +++ b/.talismanrc @@ -1,4 +1,8 @@ fileignoreconfig: +- filename: _scripts/db/dumps/domifa_test.postgres.restore-data-only.sql + checksum: 104c8036ca644bc51bb4c797e56b3a5b178a55b1c293a77308844e54ca7c404d +- filename: _scripts/db/dumps/domifa_test.postgres.truncate-restore-data-only.sql + checksum: 9976de417c719ab5c3bec9d4a1bafc40bfa8d4388d2dbd5da7d1ea4a11d2db75 - filename: yarn.lock checksum: 4ac842f95592d194e65b208fdc4b9a78a0bb6470ad2d4950626c2ffcec831a33 version: "1.0" diff --git a/_scripts/db/dumps/domifa_test.postgres.custom.gz b/_scripts/db/dumps/domifa_test.postgres.custom.gz index 782c0ddfa91a0e1fff209ff3f7905ea722a3de70..3d3b2a55ee4855f300038909097a7a888c1c1660 100644 GIT binary patch delta 6652 zcmai22Ut|c7T&pZft5vI1#}g~s6h1YExUI$B8Vjl$ch+6A7CQ{)L3{bDgxH%Lr^p5 z8l%{-#Armvur{p8Ge*R&gak`8Vu?xAXUFj7wjmGlKKVYj{O3Pq&YW{*?v|Z(+EL*Y zWbM~G)(W&5M^~V6)8Ib`@ujo);w8TLEDvh$?}$Gbxh@tB`EXp6P0%i1zJ&T1zxu$l zzzGUq4mDBvw$d<3D{{m?NsBQt8W;S<$eUQ+$ijJ4os;;9gJDklsL7JrD<=g1bo2rj z;N)1>sm^}E-4ttpzqzA%h+WF<7wogt&*`TDrP~Rx;HX* zRl!UG5`5M;i1uK)a{%^g77*34C4e_w#cu+O1pn3mmfzA*Q=}-f0}jH6pXuNZ_W(C6 z=QO@}S#WotFUkwtCK-qKJVjLt3nRw)q49=0GWxq0MoqL4lk$I8Y;@os66VStdYix8iEN`_05+3FoK9! z%y9XBN@UGEQMkq7DQa%~D%1MiT&duca2j?;6bm!W2-^a4mqz z!(F}UMx;lCWI*q@U<5wxqKM#R`i3Bqa>oZ5n5sUN|Sa z1In4S542#E6??o;|GhEh~1PeZHVhc0AZ$2R18qqg-`SR)Bb zfHhN}wP4J0(#8x>2%}U2?%MikA!2{x_4XXDh{vd6vl*60wSpHi4QOdr0DyUm@v68H z3T>=J(~5no5vTan%+x6<@aXtX@X%N zF;WqyDPpmMr)Q4`Em$Q(S4S(1422UDUw2FJc_tRhX9q<`&L$mae4if(d=UFh(Aj zX#^BdpGDmO+*+ceGF6bH;f+#1^v&X40A?5Ks98k7z`Q*^sDF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frXQSC zS@pQ#@ZF5G>YNkx>rzX$HB7&@;Y3Bmx+#Y=j-&B24|uGfuK$5eOg_G@pzYS)g|@eX zx3sP8eA~V<^X7B+zb>rX)Tur!cj_E%_T;Ay&-eDNSeBRY?z$tl4|8$3Uw0m!vq$5T z+V=P{t!{MihJcB??|PSPO!Y{qUiEI6F)Ay)Vu@Ms$V&}+d2OC`*WkGkKOLCo+>Sf+ IP)gN*0p}tIFaQ7m 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 af255d41f1..b61809dbcd 100644 --- a/_scripts/db/dumps/domifa_test.postgres.restore-data-only.sql +++ b/_scripts/db/dumps/domifa_test.postgres.restore-data-only.sql @@ -2,8 +2,8 @@ -- PostgreSQL database dump -- --- Dumped from database version 14.9 (Debian 14.9-1.pgdg110+1) --- Dumped by pg_dump version 14.9 (Debian 14.9-1.pgdg110+1) +-- Dumped from database version 14.9 +-- Dumped by pg_dump version 14.9 SET statement_timeout = 0; SET lock_timeout = 0; @@ -256,8 +256,8 @@ e0bcefc6-f1be-4c83-ac9d-6ea47335a9c3 2021-03-15 16:53:55.740856+01 2023-09-05 23 -- COPY public.user_usager (uuid, "createdAt", "updatedAt", version, id, "usagerUUID", "structureId", login, password, salt, "isTemporaryPassword", "lastLogin", "passwordLastUpdate", "lastPasswordResetDate", "lastPasswordResetStructureUser", enabled) FROM stdin; -a03a9a49-ae31-4160-9879-bab02dc46361 2021-11-30 14:50:26.278073+01 2021-11-30 15:01:39.89434+01 10 2 97b7e840-0e93-4bf4-ba7d-0a406aa898f2 1 LNQIFFBK $2a$10$u..ofvcb5t5a44N0Oriwbew6oz600aoOFzll9yl92Lx1VOb0E8o0a $2a$10$zmuPXxUOuQJ7nE6ag4.x6e f 2021-11-30 15:01:39.893+01 2021-11-30 15:01:39.675+01 2021-11-30 14:50:26.275+01 {"userId": 1, "userName": "Patrick Roméro"} t a657f4bd-e4d1-4c38-bdd0-ffd268b356df 2021-10-05 11:34:41.369505+02 2021-11-30 15:02:07.705535+01 18 1 b2c26e55-ab37-457d-b307-6fe161050a9b 1 WKYJBDXS $2a$10$cmwXTghEgrGRYTkGIJlj3Owjo8YVVDXOgceAGtkgzcD2M/Tf3Dhb. $2a$10$/uFyiR8hCe8XkRe7x2fYm. t 2021-11-30 15:02:07.69+01 \N 2021-10-05 11:34:41.365+02 {"userId": 1, "userName": "Patrick Roméro"} t +a03a9a49-ae31-4160-9879-bab02dc46361 2021-11-30 14:50:26.278073+01 2023-11-20 16:40:58.362384+01 17 2 97b7e840-0e93-4bf4-ba7d-0a406aa898f2 1 LNQIFFBK $2a$10$u..ofvcb5t5a44N0Oriwbew6oz600aoOFzll9yl92Lx1VOb0E8o0a $2a$10$zmuPXxUOuQJ7nE6ag4.x6e f 2023-11-20 16:40:58.36+01 2021-11-30 15:01:39.675+01 2021-11-30 14:50:26.275+01 {"userId": 1, "userName": "Patrick Roméro"} t \. @@ -266,6 +266,8 @@ a657f4bd-e4d1-4c38-bdd0-ffd268b356df 2021-10-05 11:34:41.369505+02 2021-11-30 15 -- COPY public.user_usager_login (uuid, "createdAt", "updatedAt", version, "usagerUUID", "structureId") FROM stdin; +3927beaf-04d8-4cbb-9be7-c7c9086434b3 2023-11-20 16:40:44.4121+01 2023-11-20 16:40:44.4121+01 1 97b7e840-0e93-4bf4-ba7d-0a406aa898f2 1 +e80dafea-8fe4-4792-92b9-3608c723aa1b 2023-11-20 16:40:58.289642+01 2023-11-20 16:40:58.289642+01 1 97b7e840-0e93-4bf4-ba7d-0a406aa898f2 1 \. @@ -274,8 +276,8 @@ COPY public.user_usager_login (uuid, "createdAt", "updatedAt", version, "usagerU -- COPY public.user_usager_security (uuid, "createdAt", "updatedAt", version, "userId", "structureId", "eventsHistory") FROM stdin; -fadd55b6-ca41-48d4-bd56-238b1a3c6f7b 2021-11-30 14:50:26.290488+01 2021-11-30 15:01:39.66811+01 8 2 1 [{"date": "2021-11-30T13:50:38.357Z", "type": "login-success"}, {"date": "2021-11-30T13:51:20.351Z", "type": "login-success"}, {"date": "2021-11-30T13:51:20.608Z", "type": "change-password-success"}, {"date": "2021-11-30T14:00:55.533Z", "type": "login-error"}, {"date": "2021-11-30T14:01:21.310Z", "type": "login-success"}, {"date": "2021-11-30T14:01:39.398Z", "type": "login-success"}, {"date": "2021-11-30T14:01:39.667Z", "type": "change-password-success"}] 9bc8decb-5f78-48de-8c1b-9f61ea5acfba 2021-10-05 11:34:41.388922+02 2021-11-30 15:02:07.682311+01 3 1 1 [{"date": "2021-11-30T14:02:07.680Z", "type": "login-success"}] +fadd55b6-ca41-48d4-bd56-238b1a3c6f7b 2021-11-30 14:50:26.290488+01 2023-11-20 16:40:58.2674+01 10 2 1 [{"date": "2023-11-20T15:40:44.378Z", "type": "login-success"}, {"date": "2023-11-20T15:40:58.265Z", "type": "login-success"}] \. 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 2bc1486707..dc93ba61ab 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 @@ -28,8 +28,8 @@ TRUNCATE TABLE public.usager_options_history RESTART IDENTITY CASCADE; -- PostgreSQL database dump -- --- Dumped from database version 14.9 (Debian 14.9-1.pgdg110+1) --- Dumped by pg_dump version 14.9 (Debian 14.9-1.pgdg110+1) +-- Dumped from database version 14.9 +-- Dumped by pg_dump version 14.9 SET statement_timeout = 0; SET lock_timeout = 0; @@ -282,8 +282,8 @@ e0bcefc6-f1be-4c83-ac9d-6ea47335a9c3 2021-03-15 16:53:55.740856+01 2023-09-05 23 -- COPY public.user_usager (uuid, "createdAt", "updatedAt", version, id, "usagerUUID", "structureId", login, password, salt, "isTemporaryPassword", "lastLogin", "passwordLastUpdate", "lastPasswordResetDate", "lastPasswordResetStructureUser", enabled) FROM stdin; -a03a9a49-ae31-4160-9879-bab02dc46361 2021-11-30 14:50:26.278073+01 2021-11-30 15:01:39.89434+01 10 2 97b7e840-0e93-4bf4-ba7d-0a406aa898f2 1 LNQIFFBK $2a$10$u..ofvcb5t5a44N0Oriwbew6oz600aoOFzll9yl92Lx1VOb0E8o0a $2a$10$zmuPXxUOuQJ7nE6ag4.x6e f 2021-11-30 15:01:39.893+01 2021-11-30 15:01:39.675+01 2021-11-30 14:50:26.275+01 {"userId": 1, "userName": "Patrick Roméro"} t a657f4bd-e4d1-4c38-bdd0-ffd268b356df 2021-10-05 11:34:41.369505+02 2021-11-30 15:02:07.705535+01 18 1 b2c26e55-ab37-457d-b307-6fe161050a9b 1 WKYJBDXS $2a$10$cmwXTghEgrGRYTkGIJlj3Owjo8YVVDXOgceAGtkgzcD2M/Tf3Dhb. $2a$10$/uFyiR8hCe8XkRe7x2fYm. t 2021-11-30 15:02:07.69+01 \N 2021-10-05 11:34:41.365+02 {"userId": 1, "userName": "Patrick Roméro"} t +a03a9a49-ae31-4160-9879-bab02dc46361 2021-11-30 14:50:26.278073+01 2023-11-20 16:40:58.362384+01 17 2 97b7e840-0e93-4bf4-ba7d-0a406aa898f2 1 LNQIFFBK $2a$10$u..ofvcb5t5a44N0Oriwbew6oz600aoOFzll9yl92Lx1VOb0E8o0a $2a$10$zmuPXxUOuQJ7nE6ag4.x6e f 2023-11-20 16:40:58.36+01 2021-11-30 15:01:39.675+01 2021-11-30 14:50:26.275+01 {"userId": 1, "userName": "Patrick Roméro"} t \. @@ -292,6 +292,8 @@ a657f4bd-e4d1-4c38-bdd0-ffd268b356df 2021-10-05 11:34:41.369505+02 2021-11-30 15 -- COPY public.user_usager_login (uuid, "createdAt", "updatedAt", version, "usagerUUID", "structureId") FROM stdin; +3927beaf-04d8-4cbb-9be7-c7c9086434b3 2023-11-20 16:40:44.4121+01 2023-11-20 16:40:44.4121+01 1 97b7e840-0e93-4bf4-ba7d-0a406aa898f2 1 +e80dafea-8fe4-4792-92b9-3608c723aa1b 2023-11-20 16:40:58.289642+01 2023-11-20 16:40:58.289642+01 1 97b7e840-0e93-4bf4-ba7d-0a406aa898f2 1 \. @@ -300,8 +302,8 @@ COPY public.user_usager_login (uuid, "createdAt", "updatedAt", version, "usagerU -- COPY public.user_usager_security (uuid, "createdAt", "updatedAt", version, "userId", "structureId", "eventsHistory") FROM stdin; -fadd55b6-ca41-48d4-bd56-238b1a3c6f7b 2021-11-30 14:50:26.290488+01 2021-11-30 15:01:39.66811+01 8 2 1 [{"date": "2021-11-30T13:50:38.357Z", "type": "login-success"}, {"date": "2021-11-30T13:51:20.351Z", "type": "login-success"}, {"date": "2021-11-30T13:51:20.608Z", "type": "change-password-success"}, {"date": "2021-11-30T14:00:55.533Z", "type": "login-error"}, {"date": "2021-11-30T14:01:21.310Z", "type": "login-success"}, {"date": "2021-11-30T14:01:39.398Z", "type": "login-success"}, {"date": "2021-11-30T14:01:39.667Z", "type": "change-password-success"}] 9bc8decb-5f78-48de-8c1b-9f61ea5acfba 2021-10-05 11:34:41.388922+02 2021-11-30 15:02:07.682311+01 3 1 1 [{"date": "2021-11-30T14:02:07.680Z", "type": "login-success"}] +fadd55b6-ca41-48d4-bd56-238b1a3c6f7b 2021-11-30 14:50:26.290488+01 2023-11-20 16:40:58.2674+01 10 2 1 [{"date": "2023-11-20T15:40:44.378Z", "type": "login-success"}, {"date": "2023-11-20T15:40:58.265Z", "type": "login-success"}] \. diff --git a/packages/backend/src/_portail-usager/portail-usager-login/portail-usagers-login.controller.ts b/packages/backend/src/_portail-usager/portail-usager-login/portail-usagers-login.controller.ts index 8878c8911e..45de1deedb 100644 --- a/packages/backend/src/_portail-usager/portail-usager-login/portail-usagers-login.controller.ts +++ b/packages/backend/src/_portail-usager/portail-usager-login/portail-usagers-login.controller.ts @@ -60,7 +60,7 @@ export class PortailUsagersLoginController { id: user.structureId, }); - await userUsagerLoginRepository.save( + const lastLogin = await userUsagerLoginRepository.save( new UserUsagerLoginTable({ usagerUUID: usager.uuid, structureId: usager.structureId, @@ -68,7 +68,7 @@ export class PortailUsagersLoginController { ); if (structure.portailUsager.usagerLoginUpdateLastInteraction) { - usager.lastInteraction.dateInteraction = new Date(); + usager.lastInteraction.dateInteraction = lastLogin.createdAt; await usagerRepository.update( { uuid: usager.uuid }, { lastInteraction: usager.lastInteraction } diff --git a/packages/backend/src/database/services/interaction/interactionRepository.service.test.ts b/packages/backend/src/database/services/interaction/interactionRepository.service.test.ts index 5541cc0e16..010a8075e9 100644 --- a/packages/backend/src/database/services/interaction/interactionRepository.service.test.ts +++ b/packages/backend/src/database/services/interaction/interactionRepository.service.test.ts @@ -10,21 +10,10 @@ describe("interactionRepository", () => { }); it("get all interactions", async () => { - { - const interactions = await interactionRepository.findBy({ - structureId: 1, - usagerRef: 7, - }); - - expect(interactions.length).toEqual(9); - } - { - const interactions = await interactionRepository.findBy({ - structureId: 1, - usagerRef: 7, - }); - - expect(interactions.length).toBeGreaterThan(2); - } + const interactions = await interactionRepository.findBy({ + structureId: 1, + usagerRef: 7, + }); + expect(interactions.length).toEqual(8); }); }); diff --git a/packages/backend/src/database/services/interaction/interactionRepository.service.ts b/packages/backend/src/database/services/interaction/interactionRepository.service.ts index b732b90819..c328cbb790 100644 --- a/packages/backend/src/database/services/interaction/interactionRepository.service.ts +++ b/packages/backend/src/database/services/interaction/interactionRepository.service.ts @@ -13,6 +13,8 @@ import { import { InteractionsTable } from "../../entities"; import { myDataSource } from "../_postgres"; import { InteractionType } from "@domifa/common"; +import { userUsagerLoginRepository } from "../user-usager"; +import { differenceInMinutes, parseISO } from "date-fns"; export const interactionRepository = myDataSource .getRepository(InteractionsTable) @@ -122,13 +124,6 @@ async function countPendingInteractionsIn({ lastInteractionOut: Date | null; }> { const INTERACTIONS_TO_CHECK = Object.assign([], INTERACTION_OK_LIST); - - if (structure.portailUsager.usagerLoginUpdateLastInteraction) { - INTERACTIONS_TO_CHECK.push("loginPortail"); - } - - const inArray = INTERACTIONS_TO_CHECK.join(", "); - // NOTE: cette requête ne renvoit pas de résultats pour les usagers de cette structure qui n'ont pas d'interaction const query = `SELECT coalesce (SUM(CASE WHEN i.type = 'courrierIn' THEN "nbCourrier" END), 0) AS "courrierIn", @@ -138,31 +133,52 @@ async function countPendingInteractionsIn({ FROM interactions i WHERE i."usagerUUID" = $2 AND i."interactionOutUUID" is null GROUP BY i."usagerRef"`; + const results = await interactionRepository.query(query, [ - inArray, + INTERACTIONS_TO_CHECK.join(", "), usagerUUID, ]); - const defaultResult = { - courrierIn: 0, - recommandeIn: 0, - colisIn: 0, - lastInteractionOut: null, - }; - - if (typeof results[0] === "undefined") { - return defaultResult; + if ( + typeof results[0] === "undefined" || + results[0] === null || + results[0]?.length === 0 + ) { + return { + courrierIn: 0, + recommandeIn: 0, + colisIn: 0, + lastInteractionOut: null, + }; } - if (results[0] === null || results[0].length === 0) { - return defaultResult; + let lastInteractionOut: Date | null = + results[0].lastInteractionOut !== null + ? results[0].lastInteractionOut === "string" + ? parseISO(results[0].lastInteractionOut) + : results[0].lastInteractionOut + : null; + + if (structure.portailUsager.usagerLoginUpdateLastInteraction) { + const lastUserUsagerLogin = await userUsagerLoginRepository.findOne({ + where: { + usagerUUID, + }, + order: { createdAt: "DESC" }, + }); + + if ( + differenceInMinutes(lastInteractionOut, lastUserUsagerLogin.createdAt) > 0 + ) { + lastInteractionOut = lastUserUsagerLogin.createdAt; + } } return { courrierIn: parseInt(results[0].courrierIn, 10), recommandeIn: parseInt(results[0].recommandeIn, 10), colisIn: parseInt(results[0].colisIn, 10), - lastInteractionOut: results[0].lastInteractionOut, + lastInteractionOut, }; } @@ -263,7 +279,11 @@ async function totalInteractionAllUsagersStructure({ const results = await interactionRepository.query(query, [structureId]); - // TODO: add loginPortail + const loginPortailStats = await userUsagerLoginRepository.query( + `SELECT u."usagerRef", coalesce (COUNT(uuid THEN 1 END), 0) AS "loginPortail" FROM user_usager_login u WHERE u."structureId" = $1 GROUP BY u."usagerRef"`, + [structureId] + ); + return results.map((x: any) => ({ usagerRef: x.usagerRef, courrierIn: parseInt(x.courrierIn, 10), @@ -274,7 +294,7 @@ async function totalInteractionAllUsagersStructure({ colisOut: parseInt(x.colisOut, 10), appel: parseInt(x.appel, 10), visite: parseInt(x.visite, 10), - loginPortail: 0, + loginPortail: loginPortailStats, npai: parseInt(x.npai, 10), })); } diff --git a/packages/backend/src/database/services/user-usager/userUsagerLoginRepository.service.test.ts b/packages/backend/src/database/services/user-usager/userUsagerLoginRepository.service.test.ts new file mode 100644 index 0000000000..cc95e332fb --- /dev/null +++ b/packages/backend/src/database/services/user-usager/userUsagerLoginRepository.service.test.ts @@ -0,0 +1,17 @@ +import { AppTestHelper } from "../../../util/test"; +import { userUsagerLoginRepository } from "./userUsagerLoginRepository.service"; + +describe("userUsagerLoginRepository", () => { + beforeAll(async () => { + await AppTestHelper.bootstrapTestConnection(); + }); + + afterAll(async () => { + await AppTestHelper.tearDownTestConnection(); + }); + + it("Count all logins made", async () => { + const users = await userUsagerLoginRepository.count(); + expect(users).toBeGreaterThan(2); + }); +}); 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 84c569d3b1..69a700468e 100644 --- a/packages/backend/src/usagers/controllers/tests/usagers.controller.spec.ts +++ b/packages/backend/src/usagers/controllers/tests/usagers.controller.spec.ts @@ -84,7 +84,7 @@ describe("Usagers Controller", () => { expect(usager.ayantsDroits[0].nom).toEqual( exceptedResponse.ayantsDroits[0].nom ); - console.log("XXX"); + expect(usager.ayantsDroits[0].prenom).toEqual( exceptedResponse.ayantsDroits[0].prenom ); diff --git a/packages/frontend/src/app/modules/usager-profil/components/_historiques/profil-historique-login-portail/profil-historique-login-portail.component.spec.ts b/packages/frontend/src/app/modules/usager-profil/components/_historiques/profil-historique-login-portail/profil-historique-login-portail.component.spec.ts index 6b1258bcc2..1fb9367cce 100644 --- a/packages/frontend/src/app/modules/usager-profil/components/_historiques/profil-historique-login-portail/profil-historique-login-portail.component.spec.ts +++ b/packages/frontend/src/app/modules/usager-profil/components/_historiques/profil-historique-login-portail/profil-historique-login-portail.component.spec.ts @@ -1,6 +1,12 @@ import { ComponentFixture, TestBed } from "@angular/core/testing"; import { ProfilHistoriqueLoginPortailComponent } from "./profil-historique-login-portail.component"; +import { HttpClientTestingModule } from "@angular/common/http/testing"; +import { NoopAnimationsModule } from "@angular/platform-browser/animations"; +import { StoreModule } from "@ngrx/store"; +import { _usagerReducer } from "../../../../../shared"; +import { UsagerFormModel } from "../../../../usager-shared/interfaces"; +import { SharedModule } from "../../../../shared/shared.module"; describe("ProfilHistoriqueLoginPortailComponent", () => { let component: ProfilHistoriqueLoginPortailComponent; @@ -9,10 +15,17 @@ describe("ProfilHistoriqueLoginPortailComponent", () => { beforeEach(async () => { await TestBed.configureTestingModule({ declarations: [ProfilHistoriqueLoginPortailComponent], + imports: [ + HttpClientTestingModule, + StoreModule.forRoot({ app: _usagerReducer }), + NoopAnimationsModule, + SharedModule, + ], }).compileComponents(); fixture = TestBed.createComponent(ProfilHistoriqueLoginPortailComponent); component = fixture.componentInstance; + component.usager = new UsagerFormModel(); fixture.detectChanges(); }); From 3d4f9a2fa38bad18123ea957109aaa167cb0b8c4 Mon Sep 17 00:00:00 2001 From: "Yassine R." Date: Mon, 20 Nov 2023 22:33:28 +0100 Subject: [PATCH 4/5] fix(stats): update stats functions --- .talismanrc | 2 + .../1603812391580-pr-env-create-database.ts | 18 ++++++ .../interactionRepository.service.ts | 42 ++++++++------ .../userUsagerLoginRepository.service.ts | 21 +++---- ...sInPeriodInteractionsRepository.service.ts | 16 +++++- .../export-structure-usagers.controller.ts | 55 +++++++++---------- 6 files changed, 96 insertions(+), 58 deletions(-) diff --git a/.talismanrc b/.talismanrc index e6ee4d3dde..af4dfb99c8 100644 --- a/.talismanrc +++ b/.talismanrc @@ -3,6 +3,8 @@ fileignoreconfig: checksum: 104c8036ca644bc51bb4c797e56b3a5b178a55b1c293a77308844e54ca7c404d - filename: _scripts/db/dumps/domifa_test.postgres.truncate-restore-data-only.sql checksum: 9976de417c719ab5c3bec9d4a1bafc40bfa8d4388d2dbd5da7d1ea4a11d2db75 +- filename: packages/backend/src/_migrations/_init-db/1603812391580-pr-env-create-database.ts + checksum: 586e3b26481d71256a1b7626956aaf9e68211dfbda527dd862a2aad075b5cc04 - filename: yarn.lock checksum: 4ac842f95592d194e65b208fdc4b9a78a0bb6470ad2d4950626c2ffcec831a33 version: "1.0" 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 44636779bd..c026387263 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 @@ -237,6 +237,24 @@ async function createTables(queryRunner: QueryRunner) { CREATE INDEX "IDX_fa4dea9a1ff8deb8fcf47c451e" ON public.structure USING btree (departement); + -- public.user_usager_login definition + + -- Drop table + + -- DROP TABLE public.user_usager_login; + + CREATE UNLOGGED TABLE public.user_usager_login ( + uuid uuid NOT NULL DEFAULT uuid_generate_v4(), + "createdAt" timestamptz NOT NULL DEFAULT now(), + "updatedAt" timestamptz NOT NULL DEFAULT now(), + "version" int4 NOT NULL, + "usagerUUID" uuid NOT NULL, + "structureId" int4 NOT NULL, + CONSTRAINT "PK_cfb7dc4a81d1db054ab5b4d50bf" PRIMARY KEY (uuid) + ); + CREATE INDEX idx_user_usager_login ON public.user_usager_login USING btree ("structureId", "usagerUUID"); + + -- public.message_sms definition -- Drop table diff --git a/packages/backend/src/database/services/interaction/interactionRepository.service.ts b/packages/backend/src/database/services/interaction/interactionRepository.service.ts index c328cbb790..547831daff 100644 --- a/packages/backend/src/database/services/interaction/interactionRepository.service.ts +++ b/packages/backend/src/database/services/interaction/interactionRepository.service.ts @@ -258,7 +258,6 @@ async function totalInteractionAllUsagersStructure({ colisIn: number; colisOut: number; npai: number; - loginPortail: number; }[] > { // NOTE: cette requête ne renvoit pas de résultats pour les usagers de cette structure qui n'ont pas d'interaction @@ -279,22 +278,29 @@ async function totalInteractionAllUsagersStructure({ const results = await interactionRepository.query(query, [structureId]); - const loginPortailStats = await userUsagerLoginRepository.query( - `SELECT u."usagerRef", coalesce (COUNT(uuid THEN 1 END), 0) AS "loginPortail" FROM user_usager_login u WHERE u."structureId" = $1 GROUP BY u."usagerRef"`, - [structureId] + return results.map( + (x: { + usagerRef: string; + appel: string; + visite: string; + courrierIn: string; + courrierOut: string; + recommandeIn: string; + recommandeOut: string; + colisIn: string; + colisOut: string; + npai: string; + }) => ({ + usagerRef: parseInt(x.usagerRef, 10), + courrierIn: parseInt(x.courrierIn, 10), + courrierOut: parseInt(x.courrierOut, 10), + recommandeIn: parseInt(x.recommandeIn, 10), + recommandeOut: parseInt(x.recommandeOut, 10), + colisIn: parseInt(x.colisIn, 10), + colisOut: parseInt(x.colisOut, 10), + appel: parseInt(x.appel, 10), + visite: parseInt(x.visite, 10), + npai: parseInt(x.npai, 10), + }) ); - - return results.map((x: any) => ({ - usagerRef: x.usagerRef, - courrierIn: parseInt(x.courrierIn, 10), - courrierOut: parseInt(x.courrierOut, 10), - recommandeIn: parseInt(x.recommandeIn, 10), - recommandeOut: parseInt(x.recommandeOut, 10), - colisIn: parseInt(x.colisIn, 10), - colisOut: parseInt(x.colisOut, 10), - appel: parseInt(x.appel, 10), - visite: parseInt(x.visite, 10), - loginPortail: loginPortailStats, - npai: parseInt(x.npai, 10), - })); } diff --git a/packages/backend/src/database/services/user-usager/userUsagerLoginRepository.service.ts b/packages/backend/src/database/services/user-usager/userUsagerLoginRepository.service.ts index a89bd32aef..d162281ee7 100644 --- a/packages/backend/src/database/services/user-usager/userUsagerLoginRepository.service.ts +++ b/packages/backend/src/database/services/user-usager/userUsagerLoginRepository.service.ts @@ -1,18 +1,19 @@ -import { Between } from "typeorm"; import { UserUsagerLoginTable } from "../../entities"; import { myDataSource } from "../_postgres"; export const userUsagerLoginRepository = myDataSource .getRepository(UserUsagerLoginTable) .extend({ - countBetween( - dateInteractionBefore: Date, - dateInteractionAfter: Date, - structureId: number - ) { - return userUsagerLoginRepository.countBy({ - structureId, - createdAt: Between(dateInteractionAfter, dateInteractionBefore), - }); + async totalLoginAllUsagersStructure(structureId: number): Promise< + | { + usagerUUID: string; + total: string; + }[] + | null + > { + return await userUsagerLoginRepository.query( + `SELECT u."usagerUUID", COUNT(uuid) AS "total" FROM user_usager_login u WHERE u."structureId" = $1 GROUP BY u."usagerUUID"`, + [structureId] + ); }, }); diff --git a/packages/backend/src/stats/services/structureStatsQuestionsInPeriodInteractionsRepository.service.ts b/packages/backend/src/stats/services/structureStatsQuestionsInPeriodInteractionsRepository.service.ts index 7d5dd32f48..97e4dea45d 100644 --- a/packages/backend/src/stats/services/structureStatsQuestionsInPeriodInteractionsRepository.service.ts +++ b/packages/backend/src/stats/services/structureStatsQuestionsInPeriodInteractionsRepository.service.ts @@ -1,5 +1,8 @@ import { Between } from "typeorm"; -import { interactionRepository } from "../../database"; +import { + interactionRepository, + userUsagerLoginRepository, +} from "../../database"; import { StructureStatsQuestionsInPeriodInteractions } from "../../_common/model/structure-stats"; import { InteractionType } from "@domifa/common"; @@ -84,8 +87,17 @@ async function getStats({ structureId, interactionType: "npai", }), - loginPortail: 0, + loginPortail: await userUsagerLoginRepository.count({ + where: { + structureId, + createdAt: Between( + startDateUTC, + endDateUTCExclusive + ) as unknown as Date, + }, + }), }; + return stats; } 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 118ff8c7bc..c13524d091 100644 --- a/packages/backend/src/usagers/controllers/export-structure-usagers.controller.ts +++ b/packages/backend/src/usagers/controllers/export-structure-usagers.controller.ts @@ -22,6 +22,7 @@ import { UsagersService } from "../services/usagers.service"; import { format } from "date-fns"; import { InteractionType } from "@domifa/common"; +import { userUsagerLoginRepository } from "../../database"; @UseGuards(AuthGuard("jwt"), AppUserGuard) @ApiTags("export") @@ -69,6 +70,11 @@ export class ExportStructureUsagersController { structureId: user.structureId, }); + const userUsagerLoginByUsagerMap = + await userUsagerLoginRepository.totalLoginAllUsagersStructure( + user.structureId + ); + for (const element of usagers) { const usager: Usager = element; const data = interactionsByUsagerMap.find( @@ -83,37 +89,30 @@ export class ExportStructureUsagersController { colisIn: number; colisOut: number; npai: number; - loginPortail: number; }) => x.usagerRef === usager.ref ); - if (data) { - usagersInteractionsCountByType[usager.ref] = { - courrierIn: data.courrierIn, - courrierOut: data.courrierOut, - recommandeIn: data.recommandeIn, - recommandeOut: data.recommandeOut, - colisIn: data.colisIn, - colisOut: data.colisOut, - appel: data.appel, - visite: data.visite, - loginPortail: data.loginPortail, - npai: data.npai, - }; - } else { - usagersInteractionsCountByType[usager.ref] = { - courrierIn: 0, - courrierOut: 0, - recommandeIn: 0, - recommandeOut: 0, - colisIn: 0, - colisOut: 0, - appel: 0, - loginPortail: 0, - visite: 0, - npai: 0, - }; - } + const userUsagerLogin = userUsagerLoginByUsagerMap.find( + (x: { usagerUUID: string; total: string }) => + x.usagerUUID === usager.uuid + ); + + const loginPortail = userUsagerLogin + ? parseInt(userUsagerLogin.total, 10) + : 0; + + usagersInteractionsCountByType[usager.ref] = { + courrierIn: data?.courrierIn ?? 0, + courrierOut: data?.courrierOut ?? 0, + recommandeIn: data?.recommandeIn ?? 0, + recommandeOut: data?.recommandeOut ?? 0, + colisIn: data?.colisIn ?? 0, + colisOut: data?.colisOut ?? 0, + appel: data?.appel ?? 0, + loginPortail, + visite: 0, + npai: data?.npai ?? 0, + }; } const model: StructureUsagersExportModel = { From 1518e07f7ad0541fe88351692ce482a281965608 Mon Sep 17 00:00:00 2001 From: "Yassine R." Date: Mon, 20 Nov 2023 23:22:21 +0100 Subject: [PATCH 5/5] fix(common): delete useless types --- .talismanrc | 2 + .../message-sms/MESSAGE_SMS_STATUS.const.ts | 11 ----- .../MESSAGE_SMS_SUIVI_INDEX.const.ts | 7 --- .../model/message-sms/MessageSms.type.ts | 6 +-- .../MessageSmsInteractionMetas.type.ts | 7 --- .../MessageSmsReminderMetas.type.ts | 4 -- .../message-sms/MessageSmsStatus.type.ts | 17 ------- .../src/_common/model/message-sms/index.ts | 5 -- .../1699910877010-auto-migration.ts | 31 +++++++----- .../message-sms/MessageSmsTable.typeorm.ts | 11 +++-- .../exportListeCourriersWorksheetRenderer.ts | 1 - .../interactionsCreator.service.spec.ts | 49 ------------------- .../model/message-sms/MessageSms.type.ts | 3 +- .../MessageSmsReminderMetas.type.ts | 4 -- .../src/_common/model/message-sms/index.ts | 1 - 15 files changed, 32 insertions(+), 127 deletions(-) delete mode 100644 packages/backend/src/_common/model/message-sms/MESSAGE_SMS_STATUS.const.ts delete mode 100644 packages/backend/src/_common/model/message-sms/MESSAGE_SMS_SUIVI_INDEX.const.ts delete mode 100644 packages/backend/src/_common/model/message-sms/MessageSmsInteractionMetas.type.ts delete mode 100644 packages/backend/src/_common/model/message-sms/MessageSmsReminderMetas.type.ts delete mode 100644 packages/backend/src/_common/model/message-sms/MessageSmsStatus.type.ts delete mode 100644 packages/frontend/src/_common/model/message-sms/MessageSmsReminderMetas.type.ts diff --git a/.talismanrc b/.talismanrc index af4dfb99c8..bc5d80e473 100644 --- a/.talismanrc +++ b/.talismanrc @@ -3,6 +3,8 @@ fileignoreconfig: checksum: 104c8036ca644bc51bb4c797e56b3a5b178a55b1c293a77308844e54ca7c404d - filename: _scripts/db/dumps/domifa_test.postgres.truncate-restore-data-only.sql checksum: 9976de417c719ab5c3bec9d4a1bafc40bfa8d4388d2dbd5da7d1ea4a11d2db75 +- filename: packages/backend/src/_migrations/1699910877010-auto-migration.ts + checksum: bd05dd6b68f7fe2ca36ab1180a0449878cf78f4e048d2e5979b3dbe5fba1db53 - filename: packages/backend/src/_migrations/_init-db/1603812391580-pr-env-create-database.ts checksum: 586e3b26481d71256a1b7626956aaf9e68211dfbda527dd862a2aad075b5cc04 - filename: yarn.lock diff --git a/packages/backend/src/_common/model/message-sms/MESSAGE_SMS_STATUS.const.ts b/packages/backend/src/_common/model/message-sms/MESSAGE_SMS_STATUS.const.ts deleted file mode 100644 index 040cd52ee6..0000000000 --- a/packages/backend/src/_common/model/message-sms/MESSAGE_SMS_STATUS.const.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { MessageSmsStatus } from "."; - -export const MESSAGE_SMS_STATUS: { [key: number]: MessageSmsStatus } = { - 0: "ON_HOLD", - 1: "SENT_AND_RECEIVED", - 2: "SENT_AND_NOT_RECEIVED", - 3: "IN_PROGRESS", - 4: "FAILURE", - 5: "EXPIRED", - 6: "DISABLED", -}; diff --git a/packages/backend/src/_common/model/message-sms/MESSAGE_SMS_SUIVI_INDEX.const.ts b/packages/backend/src/_common/model/message-sms/MESSAGE_SMS_SUIVI_INDEX.const.ts deleted file mode 100644 index ea60958c4e..0000000000 --- a/packages/backend/src/_common/model/message-sms/MESSAGE_SMS_SUIVI_INDEX.const.ts +++ /dev/null @@ -1,7 +0,0 @@ -export const INDEX_NUMERO = 0; // Numéro du destinataire -export const INDEX_STATUT = 1; // Statut du message -export const INDEX_DATE_EMISSION = 2; // Date d'émission du message (UNIX timestamp) -export const INDEX_DATE_MISE_A_JOUR = 3; // Date du dernier changement de statut du message (UNIX timestamp) -export const INDEX_STATUT_DETAILLE = 4; // Statut détaillé du message (disponible auprès de votre gestionnaire de compte). -export const INDEX_ID_MESSAGE = 5; // Identifiant du message. -export const INDEX_OPERATEUR = 6; // Code MCCMNC correspondant à l'opérateur du destinataire. 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 56fc15875f..9eb54a5b78 100644 --- a/packages/backend/src/_common/model/message-sms/MessageSms.type.ts +++ b/packages/backend/src/_common/model/message-sms/MessageSms.type.ts @@ -1,9 +1,9 @@ -import { MessageSmsId } from "@domifa/common"; import { - MessageSmsInteractionMetas, + MessageSmsId, MessageSmsReminderMetas, MessageSmsStatus, -} from "."; + MessageSmsInteractionMetas, +} from "@domifa/common"; import { AppEntity } from "../../../_common/model"; export type MessageSms = AppEntity & { diff --git a/packages/backend/src/_common/model/message-sms/MessageSmsInteractionMetas.type.ts b/packages/backend/src/_common/model/message-sms/MessageSmsInteractionMetas.type.ts deleted file mode 100644 index 14cee5a09a..0000000000 --- a/packages/backend/src/_common/model/message-sms/MessageSmsInteractionMetas.type.ts +++ /dev/null @@ -1,7 +0,0 @@ -import { InteractionType } from "@domifa/common"; - -export type MessageSmsInteractionMetas = { - nbCourrier: number; - interactionType: InteractionType; - date: Date; -}; diff --git a/packages/backend/src/_common/model/message-sms/MessageSmsReminderMetas.type.ts b/packages/backend/src/_common/model/message-sms/MessageSmsReminderMetas.type.ts deleted file mode 100644 index 8d2bac62b0..0000000000 --- a/packages/backend/src/_common/model/message-sms/MessageSmsReminderMetas.type.ts +++ /dev/null @@ -1,4 +0,0 @@ -export type MessageSmsReminderMetas = { - type: string; - date: Date; -}; diff --git a/packages/backend/src/_common/model/message-sms/MessageSmsStatus.type.ts b/packages/backend/src/_common/model/message-sms/MessageSmsStatus.type.ts deleted file mode 100644 index e8a83dc1b8..0000000000 --- a/packages/backend/src/_common/model/message-sms/MessageSmsStatus.type.ts +++ /dev/null @@ -1,17 +0,0 @@ -export type MessageSmsStatus = - | "TO_SEND" - | "ON_HOLD" - | "SENT_AND_RECEIVED" - | "SENT_AND_NOT_RECEIVED" - | "IN_PROGRESS" - | "FAILURE" - | "DISABLED" - | "EXPIRED"; - -export const ON_HOLD = 0; -export const SENT_AND_RECEIVED = 1; -export const SENT_AND_NOT_RECEIVED = 2; -export const IN_PROGRESS = 3; -export const FAILURE = 4; -export const EXPIRED = 5; -export const DISABLED = 6; diff --git a/packages/backend/src/_common/model/message-sms/index.ts b/packages/backend/src/_common/model/message-sms/index.ts index d00b4dee9b..e17627c2f2 100644 --- a/packages/backend/src/_common/model/message-sms/index.ts +++ b/packages/backend/src/_common/model/message-sms/index.ts @@ -1,10 +1,5 @@ //@index('./*', f => `export * from '${f.path}'`) 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 "./MessageSmsInteractionMetas.type"; -export * from "./MessageSmsReminderMetas.type"; export * from "./MessageSmsSendResponse.type"; -export * from "./MessageSmsStatus.type"; export * from "./SuiviSmsErrors.type"; diff --git a/packages/backend/src/_migrations/1699910877010-auto-migration.ts b/packages/backend/src/_migrations/1699910877010-auto-migration.ts index 405cf0bec3..43e92009e6 100644 --- a/packages/backend/src/_migrations/1699910877010-auto-migration.ts +++ b/packages/backend/src/_migrations/1699910877010-auto-migration.ts @@ -1,20 +1,27 @@ import { MigrationInterface, QueryRunner } from "typeorm"; +import { domifaConfig } from "../config"; export class AutoMigration1699910877010 implements MigrationInterface { name = "AutoMigration1699910877010"; public async up(queryRunner: QueryRunner): Promise { - await queryRunner.query( - `CREATE TABLE "user_usager_login" ("uuid" uuid NOT NULL DEFAULT uuid_generate_v4(), "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "updatedAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "version" integer NOT NULL, "usagerUUID" uuid NOT NULL, "structureId" integer NOT NULL, CONSTRAINT "PK_cfb7dc4a81d1db054ab5b4d50bf" PRIMARY KEY ("uuid"))` - ); - await queryRunner.query( - `CREATE INDEX "idx_user_usager_login" ON "user_usager_login" ("structureId", "usagerUUID") ` - ); - await queryRunner.query( - `ALTER TABLE "user_usager_login" ADD CONSTRAINT "FK_4bf76763fec5203f945338a0377" FOREIGN KEY ("usagerUUID") REFERENCES "usager"("uuid") ON DELETE CASCADE ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE "user_usager_login" ADD CONSTRAINT "FK_8722e56ff917692645abcd29e7c" FOREIGN KEY ("structureId") REFERENCES "structure"("id") ON DELETE CASCADE ON UPDATE NO ACTION` - ); + if ( + domifaConfig().envId !== "preprod" && + domifaConfig().envId === "prod" && + domifaConfig().envId === "local" + ) { + await queryRunner.query( + `CREATE TABLE "user_usager_login" ("uuid" uuid NOT NULL DEFAULT uuid_generate_v4(), "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "updatedAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "version" integer NOT NULL, "usagerUUID" uuid NOT NULL, "structureId" integer NOT NULL, CONSTRAINT "PK_cfb7dc4a81d1db054ab5b4d50bf" PRIMARY KEY ("uuid"))` + ); + await queryRunner.query( + `CREATE INDEX "idx_user_usager_login" ON "user_usager_login" ("structureId", "usagerUUID") ` + ); + await queryRunner.query( + `ALTER TABLE "user_usager_login" ADD CONSTRAINT "FK_4bf76763fec5203f945338a0377" FOREIGN KEY ("usagerUUID") REFERENCES "usager"("uuid") ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE "user_usager_login" ADD CONSTRAINT "FK_8722e56ff917692645abcd29e7c" FOREIGN KEY ("structureId") REFERENCES "structure"("id") ON DELETE CASCADE ON UPDATE NO ACTION` + ); + } } public async down(queryRunner: QueryRunner): Promise { 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 e6bdddd03a..31ed034197 100644 --- a/packages/backend/src/database/entities/message-sms/MessageSmsTable.typeorm.ts +++ b/packages/backend/src/database/entities/message-sms/MessageSmsTable.typeorm.ts @@ -1,12 +1,13 @@ import { Column, Entity, Index, JoinColumn, ManyToOne } from "typeorm"; +import { MessageSms } from "../../../_common/model/message-sms"; +import { StructureTable } from "../structure"; +import { AppTypeormTable } from "../_core/AppTypeormTable.typeorm"; import { - MessageSms, + MessageSmsId, + MessageSmsStatus, MessageSmsInteractionMetas, MessageSmsReminderMetas, -} from "../../../_common/model/message-sms"; -import { StructureTable } from "../structure"; -import { AppTypeormTable } from "../_core/AppTypeormTable.typeorm"; -import { MessageSmsId, MessageSmsStatus } from "@domifa/common"; +} from "@domifa/common"; // https://typeorm.io/#/entities/column-types-for-postgres @Entity({ name: "message_sms" }) diff --git a/packages/backend/src/excel/export-structure-usagers/worksheet-renderer/exportListeCourriersWorksheetRenderer.ts b/packages/backend/src/excel/export-structure-usagers/worksheet-renderer/exportListeCourriersWorksheetRenderer.ts index 236c9f1e98..ed152a30a1 100644 --- a/packages/backend/src/excel/export-structure-usagers/worksheet-renderer/exportListeCourriersWorksheetRenderer.ts +++ b/packages/backend/src/excel/export-structure-usagers/worksheet-renderer/exportListeCourriersWorksheetRenderer.ts @@ -87,7 +87,6 @@ function renderWorksheet({ appel: usagersInteractionsCounts.appel, visite: usagersInteractionsCounts.visite, npai: usagersInteractionsCounts.npai, - // TODO: check loginPOrtail loginPortail: usagersInteractionsCounts.loginPortail, }, }; diff --git a/packages/backend/src/interactions/services/interactionsCreator.service.spec.ts b/packages/backend/src/interactions/services/interactionsCreator.service.spec.ts index 686946e9c0..529f1135d4 100644 --- a/packages/backend/src/interactions/services/interactionsCreator.service.spec.ts +++ b/packages/backend/src/interactions/services/interactionsCreator.service.spec.ts @@ -434,53 +434,4 @@ describe("interactionsCreator", () => { }); }); }); - - // describe("5. Création d'une interaction à la suite d'une connexion au portail", () => { - // it("Sans mise à jour de la date de dernier passage", async () => { - // const interaction: InteractionDto = { - // type: "loginPortail", - // nbCourrier: 0, - // }; - - // const resultat = await interactionsCreator.createInteraction({ - // usager, - // user, - // interaction, - // }); - - // expect(resultat.usager.lastInteraction.dateInteraction).toEqual( - // usager.lastInteraction.dateInteraction - // ); - // expect(resultat.interaction.nbCourrier).toEqual(0); - // }); - - // it("Avec mise à jour de la date de dernier passage", async () => { - // const interaction: InteractionDto = { - // type: "loginPortail", - // nbCourrier: 1111, // Test avec un faux numéro, on vérifie que c'est bien 0 qui est enregistré - // }; - - // user.structure.portailUsager.usagerLoginUpdateLastInteraction = true; - - // const resultat = await interactionsCreator.createInteraction({ - // usager, - // user, - // interaction, - // }); - - // expect(resultat.usager.lastInteraction.dateInteraction).toEqual( - // MOCKED_NEW_DATE - // ); - - // expect(resultat.interaction.nbCourrier).toEqual(0); - - // // Suppression de l'interaction sortante - // await interactionsDeletor.deleteInteraction({ - // interaction: resultat.interaction, - // structure: user.structure, - // usager, - // user, - // }); - // }); - // }); }); 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 5abc4bbec7..448756991a 100644 --- a/packages/frontend/src/_common/model/message-sms/MessageSms.type.ts +++ b/packages/frontend/src/_common/model/message-sms/MessageSms.type.ts @@ -2,8 +2,9 @@ import { MessageSmsId, MessageSmsInteractionMetas, MessageSmsStatus, + MessageSmsReminderMetas, } 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/MessageSmsReminderMetas.type.ts b/packages/frontend/src/_common/model/message-sms/MessageSmsReminderMetas.type.ts deleted file mode 100644 index 8d2bac62b0..0000000000 --- a/packages/frontend/src/_common/model/message-sms/MessageSmsReminderMetas.type.ts +++ /dev/null @@ -1,4 +0,0 @@ -export type MessageSmsReminderMetas = { - type: string; - 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 760a6f0b76..4fca211a56 100644 --- a/packages/frontend/src/_common/model/message-sms/index.ts +++ b/packages/frontend/src/_common/model/message-sms/index.ts @@ -1,4 +1,3 @@ // @index('./*', f => `export * from '${f.path}'`) export * from "./MESSAGE_SMS_STATUS.const"; export * from "./MessageSms.type"; -export * from "./MessageSmsReminderMetas.type";