From a90d1f3786a9e29b527f4c8953589cd60812effe Mon Sep 17 00:00:00 2001 From: "Yassine R." Date: Tue, 17 Sep 2024 20:52:12 +0200 Subject: [PATCH] fix(backend): fix build & tests --- .../backend/src/database/services/index.ts | 2 +- .../_core/mailRecipientsFilter.service.ts | 11 +++-------- .../usagers.controller.security-tests.ts | 1 - .../usagers/controllers/usagers.controller.ts | 4 +++- .../structure-edit-form.component.html | 18 ++++++++++++++++++ .../step-etat-civil.component.ts | 2 +- 6 files changed, 26 insertions(+), 12 deletions(-) diff --git a/packages/backend/src/database/services/index.ts b/packages/backend/src/database/services/index.ts index 3d4b6119af..0463d7a81c 100644 --- a/packages/backend/src/database/services/index.ts +++ b/packages/backend/src/database/services/index.ts @@ -1,12 +1,12 @@ // @index('./*', f => `export * from '${f.path}'`) export * from "./_postgres"; -export * from "./_scripts"; export * from "./app-log"; export * from "./contact"; export * from "./interaction"; export * from "./message-email"; export * from "./message-sms"; export * from "./monitoring"; +export * from "./place"; export * from "./structure"; export * from "./structure-doc"; export * from "./usager"; diff --git a/packages/backend/src/mails/services/_core/mailRecipientsFilter.service.ts b/packages/backend/src/mails/services/_core/mailRecipientsFilter.service.ts index e0b1753769..0606713ce2 100644 --- a/packages/backend/src/mails/services/_core/mailRecipientsFilter.service.ts +++ b/packages/backend/src/mails/services/_core/mailRecipientsFilter.service.ts @@ -1,9 +1,5 @@ import { domifaConfig } from "../../../config"; -import { - dataEmailAnonymizer, - MessageEmailId, - MessageEmailRecipient, -} from "../../../database"; +import { MessageEmailId, MessageEmailRecipient } from "../../../database"; import { appLogger } from "../../../util"; export const mailRecipientsFilter = { @@ -48,7 +44,7 @@ function filterRecipients( toSkip = toSkip.concat(recipients); } else { recipients.forEach((recipient) => { - if (isRecipientToSkip(recipient)) { + if (isRecipientToSkip()) { toSkip.push(recipient); } else { toSend.push(recipient); @@ -72,10 +68,9 @@ function filterRecipients( return { toSend, toSkip, toSkipString }; } -function isRecipientToSkip(recipient: MessageEmailRecipient) { +function isRecipientToSkip() { return ( !domifaConfig().email.emailsEnabled || - dataEmailAnonymizer.isAnonymizedEmail(recipient.address) || domifaConfig().email.emailAddressRedirectAllTo ); } diff --git a/packages/backend/src/usagers/controllers/security-tests/usagers.controller.security-tests.ts b/packages/backend/src/usagers/controllers/security-tests/usagers.controller.security-tests.ts index 22e244a19c..41798ac9a9 100644 --- a/packages/backend/src/usagers/controllers/security-tests/usagers.controller.security-tests.ts +++ b/packages/backend/src/usagers/controllers/security-tests/usagers.controller.security-tests.ts @@ -43,7 +43,6 @@ export const UsagersControllerSecurityTests: AppTestHttpClientSecurityTestDef[] body: { nom: "nom", prenom: "prenom", - usagerRef: 4, }, } ), diff --git a/packages/backend/src/usagers/controllers/usagers.controller.ts b/packages/backend/src/usagers/controllers/usagers.controller.ts index 6005b92486..985b25096e 100644 --- a/packages/backend/src/usagers/controllers/usagers.controller.ts +++ b/packages/backend/src/usagers/controllers/usagers.controller.ts @@ -329,7 +329,9 @@ export class UsagersController { ): Promise { return usagerRepository .createQueryBuilder() - .select(["nom", "prenom", "ref", "dateNaissance"]) + .select( + joinSelectFields(["nom", "prenom", "ref", "customRef", "dateNaissance"]) + ) .where( `"structureId" = :structureId and LOWER("nom") = :nom and LOWER("prenom") = :prenom`, { diff --git a/packages/frontend/src/app/modules/structures/components/structure-edit-form/structure-edit-form.component.html b/packages/frontend/src/app/modules/structures/components/structure-edit-form/structure-edit-form.component.html index 339accd759..7a3f315c95 100644 --- a/packages/frontend/src/app/modules/structures/components/structure-edit-form/structure-edit-form.component.html +++ b/packages/frontend/src/app/modules/structures/components/structure-edit-form/structure-edit-form.component.html @@ -52,6 +52,24 @@

Modifier les informations de votre structure

/> CCAS / Commune / Mairie +

{ this.duplicates = duplicates ?? []; if (this.usager?.ref && this.duplicates.length) { - this.duplicates.filter( + this.duplicates = this.duplicates.filter( (usager) => this.usager.ref !== usager.ref ); }