Skip to content

Commit

Permalink
fix(common): delete useless types
Browse files Browse the repository at this point in the history
  • Loading branch information
pYassine committed Nov 20, 2023
1 parent 3d4f9a2 commit 1518e07
Show file tree
Hide file tree
Showing 15 changed files with 32 additions and 127 deletions.
2 changes: 2 additions & 0 deletions .talismanrc
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -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 & {
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

5 changes: 0 additions & 5 deletions packages/backend/src/_common/model/message-sms/index.ts
Original file line number Diff line number Diff line change
@@ -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";
31 changes: 19 additions & 12 deletions packages/backend/src/_migrations/1699910877010-auto-migration.ts
Original file line number Diff line number Diff line change
@@ -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<void> {
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<void> {
Expand Down
Original file line number Diff line number Diff line change
@@ -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" })
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,6 @@ function renderWorksheet({
appel: usagersInteractionsCounts.appel,
visite: usagersInteractionsCounts.visite,
npai: usagersInteractionsCounts.npai,
// TODO: check loginPOrtail
loginPortail: usagersInteractionsCounts.loginPortail,
},
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
// });
// });
// });
});
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@ import {
MessageSmsId,
MessageSmsInteractionMetas,
MessageSmsStatus,
MessageSmsReminderMetas,
} from "@domifa/common";
import { MessageSmsReminderMetas } from ".";

import { AppEntity } from "../../../_common/model";

export type MessageSms = AppEntity & {
Expand Down

This file was deleted.

1 change: 0 additions & 1 deletion packages/frontend/src/_common/model/message-sms/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// @index('./*', f => `export * from '${f.path}'`)
export * from "./MESSAGE_SMS_STATUS.const";
export * from "./MessageSms.type";
export * from "./MessageSmsReminderMetas.type";

0 comments on commit 1518e07

Please sign in to comment.