diff --git a/docker-compose.local.yml b/docker-compose.local.yml index 928de4f662..4568642744 100644 --- a/docker-compose.local.yml +++ b/docker-compose.local.yml @@ -19,20 +19,6 @@ services: MINIO_REGION: xxx command: server /data --console-address ":9001" - # MinIO Console (facultatif, pour la gestion via une interface web) - minio-console: - image: minio/console - ports: - - "9001:9001" - environment: - CONSOLE_MINIO_SERVER: http://minio:9000 - CONSOLE_PBKDF_PASSPHRASE: minioadmin - CONSOLE_PBKDF_SALT: minioadmin - CONSOLE_SECRET_KEY: minioadmin - CONSOLE_ACCESS_KEY: minioadmin - depends_on: - - minio - postgres: image: postgis/postgis:15-3.4-alpine container_name: domifa-postgres diff --git a/packages/backend/src/database/services/usager/usagerDocsRepository.service.ts b/packages/backend/src/database/services/usager/usagerDocsRepository.service.ts index 6695483153..c280876104 100644 --- a/packages/backend/src/database/services/usager/usagerDocsRepository.service.ts +++ b/packages/backend/src/database/services/usager/usagerDocsRepository.service.ts @@ -6,7 +6,7 @@ export const usagerDocsRepository = myDataSource .getRepository(UsagerDocsTable) .extend({ async getUsagerDocs(usagerRef: number, structureId: number) { - return this.find({ + return await this.find({ where: { usagerRef, structureId, @@ -18,6 +18,9 @@ export const usagerDocsRepository = myDataSource createdAt: true, createdBy: true, }, + order: { + createdAt: "DESC", + }, }); }, }); diff --git a/packages/backend/src/mails/services/templates-renderers/guide-import/guideImportEmailSender.service.ts b/packages/backend/src/mails/services/templates-renderers/guide-import/guideImportEmailSender.service.ts index 9e80f7e0d2..a12c829428 100644 --- a/packages/backend/src/mails/services/templates-renderers/guide-import/guideImportEmailSender.service.ts +++ b/packages/backend/src/mails/services/templates-renderers/guide-import/guideImportEmailSender.service.ts @@ -23,7 +23,7 @@ async function sendMail({ const to = [ { address: user.email, - personalName: user.prenom + " " + user.nom, + personalName: `${user.prenom} ${user.nom}`, }, ]; diff --git a/packages/backend/src/mails/services/templates-renderers/guide-utilisateur/guideUtilisateurEmailSender.service.ts b/packages/backend/src/mails/services/templates-renderers/guide-utilisateur/guideUtilisateurEmailSender.service.ts index d4f03249db..9b52c637d4 100644 --- a/packages/backend/src/mails/services/templates-renderers/guide-utilisateur/guideUtilisateurEmailSender.service.ts +++ b/packages/backend/src/mails/services/templates-renderers/guide-utilisateur/guideUtilisateurEmailSender.service.ts @@ -21,7 +21,7 @@ async function sendMail({ const to = [ { address: user.email, - personalName: user.prenom + " " + user.nom, + personalName: `${user.prenom} ${user.nom}`, }, ]; const recipients = mailRecipientsFilter.filterRecipients(to, { diff --git a/packages/backend/src/mails/services/templates-renderers/hard-reset/hardResetEmailSender.service.ts b/packages/backend/src/mails/services/templates-renderers/hard-reset/hardResetEmailSender.service.ts index 128a32b803..788bc68fc2 100644 --- a/packages/backend/src/mails/services/templates-renderers/hard-reset/hardResetEmailSender.service.ts +++ b/packages/backend/src/mails/services/templates-renderers/hard-reset/hardResetEmailSender.service.ts @@ -19,7 +19,7 @@ async function sendMail({ const to = [ { address: user.email, - personalName: user.prenom + " " + user.nom, + personalName: `${user.prenom} ${user.nom}`, }, ]; diff --git a/packages/backend/src/mails/services/templates-renderers/usager-appointment-created/usagerAppointmentCreatedEmailSender.service.ts b/packages/backend/src/mails/services/templates-renderers/usager-appointment-created/usagerAppointmentCreatedEmailSender.service.ts index efb1302d1f..140fcf8258 100644 --- a/packages/backend/src/mails/services/templates-renderers/usager-appointment-created/usagerAppointmentCreatedEmailSender.service.ts +++ b/packages/backend/src/mails/services/templates-renderers/usager-appointment-created/usagerAppointmentCreatedEmailSender.service.ts @@ -37,7 +37,7 @@ async function sendMail({ const to = [ { address: user.email, - personalName: user.prenom + " " + user.nom, + personalName: `${user.prenom} ${user.nom}`, }, ]; const recipients = mailRecipientsFilter.filterRecipients(to, { diff --git a/packages/backend/src/mails/services/templates-renderers/user-account-activated/userAccountActivatedEmailSender.service.ts b/packages/backend/src/mails/services/templates-renderers/user-account-activated/userAccountActivatedEmailSender.service.ts index d9ea39fd4c..e2b6f76f80 100644 --- a/packages/backend/src/mails/services/templates-renderers/user-account-activated/userAccountActivatedEmailSender.service.ts +++ b/packages/backend/src/mails/services/templates-renderers/user-account-activated/userAccountActivatedEmailSender.service.ts @@ -22,7 +22,7 @@ async function sendMail({ const to = [ { address: user.email, - personalName: user.prenom + " " + user.nom, + personalName: `${user.prenom} ${user.nom}`, }, ]; diff --git a/packages/backend/src/mails/services/templates-renderers/user-account-created-by-admin/userAccountCreatedByAdminEmailSender.service.ts b/packages/backend/src/mails/services/templates-renderers/user-account-created-by-admin/userAccountCreatedByAdminEmailSender.service.ts index 8e407d7d81..7b6d720c20 100644 --- a/packages/backend/src/mails/services/templates-renderers/user-account-created-by-admin/userAccountCreatedByAdminEmailSender.service.ts +++ b/packages/backend/src/mails/services/templates-renderers/user-account-created-by-admin/userAccountCreatedByAdminEmailSender.service.ts @@ -30,7 +30,7 @@ async function sendMail({ const to = [ { address: user.email, - personalName: user.prenom + " " + user.nom, + personalName: `${user.prenom} ${user.nom}`, }, ]; diff --git a/packages/backend/src/mails/services/templates-renderers/user-reset-password/userResetPasswordEmailSender.service.ts b/packages/backend/src/mails/services/templates-renderers/user-reset-password/userResetPasswordEmailSender.service.ts index 05b36597d8..90fa6d0350 100644 --- a/packages/backend/src/mails/services/templates-renderers/user-reset-password/userResetPasswordEmailSender.service.ts +++ b/packages/backend/src/mails/services/templates-renderers/user-reset-password/userResetPasswordEmailSender.service.ts @@ -29,7 +29,7 @@ async function sendMail({ const to = [ { address: user.email, - personalName: user.prenom + " " + user.nom, + personalName: `${user.prenom} ${user.nom}`, }, ]; diff --git a/packages/backend/src/structures/controllers/structure-doc.controller.ts b/packages/backend/src/structures/controllers/structure-doc.controller.ts index d95627cd1a..c69166ae65 100644 --- a/packages/backend/src/structures/controllers/structure-doc.controller.ts +++ b/packages/backend/src/structures/controllers/structure-doc.controller.ts @@ -153,7 +153,10 @@ export class StructureDocController { public async getStructureDocs( @CurrentUser() user: UserStructureAuthenticated ) { - return structureDocRepository.findBy({ structureId: user.structureId }); + return structureDocRepository.find({ + where: { structureId: user.structureId }, + order: { createdAt: "DESC" }, + }); } @Delete(":uuid") diff --git a/packages/backend/src/usagers/controllers/agenda.controller.ts b/packages/backend/src/usagers/controllers/agenda.controller.ts index dbc608fb37..468107c8bd 100644 --- a/packages/backend/src/usagers/controllers/agenda.controller.ts +++ b/packages/backend/src/usagers/controllers/agenda.controller.ts @@ -115,7 +115,7 @@ export class AgendaController { description: "Entretien demande de domiciliation", start: [annee, mois, jour, heure, minutes], organizer: { - name: user.prenom + " " + user.nom, + name: `${user.prenom} ${user.nom}`, email: user.email, }, startInputType: "local", diff --git a/packages/backend/src/usagers/controllers/import/step3-create/usagersImportBuilder.service.ts b/packages/backend/src/usagers/controllers/import/step3-create/usagersImportBuilder.service.ts index f1e369cd77..ec2daaf61d 100644 --- a/packages/backend/src/usagers/controllers/import/step3-create/usagersImportBuilder.service.ts +++ b/packages/backend/src/usagers/controllers/import/step3-create/usagersImportBuilder.service.ts @@ -24,7 +24,7 @@ function buildUsagers({ user: Pick; }): Partial[] { const now = new Date(); - const agent = user.prenom + " " + user.nom; + const agent = `${user.prenom} ${user.nom}`; return usagersRows.map((usagerRow) => buildUsager({ diff --git a/packages/backend/src/usagers/controllers/usager-docs.controller.ts b/packages/backend/src/usagers/controllers/usager-docs.controller.ts index 5cf42c7190..2bbaa22928 100644 --- a/packages/backend/src/usagers/controllers/usager-docs.controller.ts +++ b/packages/backend/src/usagers/controllers/usager-docs.controller.ts @@ -89,7 +89,7 @@ export class UsagerDocsController { @Res() res: Response ) { const encryptionContext = crypto.randomUUID(); - const userName = user.prenom + " " + user.nom; + const userName = `${user.prenom} ${user.nom}`; const path = randomName(file); @@ -183,16 +183,8 @@ export class UsagerDocsController { @AllowUserStructureRoles("simple", "responsable", "admin") public async getUsagerDocuments( @Param("usagerRef", new ParseIntPipe()) usagerRef: number, - @CurrentUsager() currentUsager: Usager, - @CurrentUser() user: UserStructureAuthenticated + @CurrentUsager() currentUsager: Usager ): Promise { - await this.appLogsService.create({ - userId: user.id, - usagerRef, - structureId: user.structureId, - action: "USAGERS_DOCS_DOWNLOAD", - }); - return usagerDocsRepository.getUsagerDocs( usagerRef, currentUsager.structureId @@ -208,6 +200,13 @@ export class UsagerDocsController { @CurrentUser() user: UserStructureAuthenticated, @CurrentUsager() currentUsager: Usager ) { + await this.appLogsService.create({ + userId: user.id, + usagerRef, + structureId: user.structureId, + action: "USAGERS_DOCS_DOWNLOAD", + }); + const doc = await usagerDocsRepository.findOneBy({ uuid: docUuid, usagerRef, diff --git a/packages/backend/src/usagers/controllers/usagers-decision.controller.ts b/packages/backend/src/usagers/controllers/usagers-decision.controller.ts index 05d599dd54..d5044507d5 100644 --- a/packages/backend/src/usagers/controllers/usagers-decision.controller.ts +++ b/packages/backend/src/usagers/controllers/usagers-decision.controller.ts @@ -58,7 +58,7 @@ export class UsagersDecisionController { // eslint-disable-next-line @typescript-eslint/no-unused-vars @Param("usagerRef", new ParseIntPipe()) _usagerRef: number ): Promise { - decision.userName = user.prenom + " " + user.nom; + decision.userName = `${user.prenom} ${user.nom}`; decision.userId = user.id; return this.usagersService.setDecision(usager, decision); } @@ -153,7 +153,7 @@ export class UsagersDecisionController { const createdBy = { userId: user.id, - userName: user.prenom + " " + user.nom, + userName: `${user.prenom} ${user.nom}`, }; const newNote: Partial = { diff --git a/packages/backend/src/usagers/services/usagerHistoryState.service.ts b/packages/backend/src/usagers/services/usagerHistoryState.service.ts index d3ce9f6618..f393fe04ae 100644 --- a/packages/backend/src/usagers/services/usagerHistoryState.service.ts +++ b/packages/backend/src/usagers/services/usagerHistoryState.service.ts @@ -1,7 +1,9 @@ -import { UsagerHistoryStates } from "./../../_common/model/usager/history/UsagerHistoryStates.interface"; import { Usager, UsagerDecision, UsagerEntretien } from "@domifa/common"; import { Injectable } from "@nestjs/common"; -import { UsagerHistoryStateCreationEvent } from "../../_common/model"; +import { + UsagerHistoryStateCreationEvent, + UsagerHistoryStates, +} from "../../_common/model"; import { getDecisionForStats, getEntretienForStats, @@ -140,7 +142,7 @@ export class UsagerHistoryStateService { } private async getLastHistoryState(usager: Pick) { - return usagerHistoryStatesRepository.findOne({ + return await usagerHistoryStatesRepository.findOne({ where: { usagerUUID: usager.uuid, }, diff --git a/packages/backend/src/usagers/services/usagers.service.ts b/packages/backend/src/usagers/services/usagers.service.ts index 9f521460fa..e1bd05b788 100644 --- a/packages/backend/src/usagers/services/usagers.service.ts +++ b/packages/backend/src/usagers/services/usagers.service.ts @@ -1,7 +1,10 @@ -import { usagerEntretienRepository } from "./../../database/services/usager/usagerEntretienRepository.service"; import { Injectable } from "@nestjs/common"; import { v4 as uuidv4 } from "uuid"; -import { usagerRepository, UsagerTable } from "../../database"; +import { + usagerEntretienRepository, + usagerRepository, + UsagerTable, +} from "../../database"; import { UserStructure, UserStructureProfile, @@ -48,7 +51,7 @@ export class UsagersService { uuid: uuidv4(), dateDecision: now, statut: "INSTRUCTION", - userName: user.prenom + " " + user.nom, + userName: `${user.prenom} ${user.nom}`, userId: user.id, dateFin: now, dateDebut: now, @@ -105,7 +108,7 @@ export class UsagersService { dateFin: newDateFin, statut: "INSTRUCTION", userId: user.id, - userName: user.prenom + " " + user.nom, + userName: `${user.prenom} ${user.nom}`, typeDom, motif: null, }; @@ -223,7 +226,7 @@ export class UsagersService { ): Promise { usager.rdv = { userId: rdv.userId, - userName: user.prenom + " " + user.nom, + userName: `${user.prenom} ${user.nom}`, dateRdv: rdv.dateRdv, }; @@ -245,7 +248,7 @@ export class UsagersService { } public async export(structureId: number): Promise { - return usagerRepository.find({ + return await usagerRepository.find({ where: { structureId }, relations: { entretien: true, diff --git a/packages/backend/src/util/getCreatedByUserStructure.ts b/packages/backend/src/util/getCreatedByUserStructure.ts index 2200c3bdc5..3b3d3511c3 100644 --- a/packages/backend/src/util/getCreatedByUserStructure.ts +++ b/packages/backend/src/util/getCreatedByUserStructure.ts @@ -6,6 +6,6 @@ export function getCreatedByUserStructure( ): UserStructureResume { return { userId: user.id, - userName: user.prenom + " " + user.nom, + userName: `${user.prenom} ${user.nom}`, }; } diff --git a/packages/frontend/src/_common/model/_core/AppEntity.type.ts b/packages/frontend/src/_common/model/_core/AppEntity.type.ts deleted file mode 100644 index aa42c401a3..0000000000 --- a/packages/frontend/src/_common/model/_core/AppEntity.type.ts +++ /dev/null @@ -1,6 +0,0 @@ -export type AppEntity = { - uuid?: string; // postgres id - createdAt?: Date; - updatedAt?: Date; - version?: number; -}; diff --git a/packages/frontend/src/_common/model/_core/index.ts b/packages/frontend/src/_common/model/_core/index.ts deleted file mode 100644 index 21f19398c7..0000000000 --- a/packages/frontend/src/_common/model/_core/index.ts +++ /dev/null @@ -1,3 +0,0 @@ -//@index('./*', f => `export * from '${f.path}'`) - -export * from "./AppEntity.type"; diff --git a/packages/frontend/src/_common/model/index.ts b/packages/frontend/src/_common/model/index.ts index bea7af5aef..4224e5db64 100644 --- a/packages/frontend/src/_common/model/index.ts +++ b/packages/frontend/src/_common/model/index.ts @@ -1,5 +1,4 @@ //@index('./*', f => `export * from '${f.path}'`) -export * from "./_core"; export * from "./_general"; export * from "./interaction"; export * from "./stats"; diff --git a/packages/frontend/src/_common/model/structure-doc/types/StructureDoc.type.ts b/packages/frontend/src/_common/model/structure-doc/types/StructureDoc.type.ts index 4c12d52d7f..964124870a 100644 --- a/packages/frontend/src/_common/model/structure-doc/types/StructureDoc.type.ts +++ b/packages/frontend/src/_common/model/structure-doc/types/StructureDoc.type.ts @@ -1,5 +1,4 @@ -import { UserStructureCreatedBy } from "@domifa/common"; -import { AppEntity } from "../../_core"; +import { UserStructureCreatedBy, AppEntity } from "@domifa/common"; import { StructureCustomDocType } from "./StructureCustomDocType.type"; export type StructureDoc = AppEntity & { diff --git a/packages/frontend/src/_common/model/structure-doc/types/StructureDocKeys.type.ts b/packages/frontend/src/_common/model/structure-doc/types/StructureDocKeys.type.ts deleted file mode 100644 index e5f12c7b87..0000000000 --- a/packages/frontend/src/_common/model/structure-doc/types/StructureDocKeys.type.ts +++ /dev/null @@ -1,55 +0,0 @@ -export type StructureDocKeys = - // DATES UTILES - | "DATE_JOUR" - | "DATE_JOUR_HEURE" - | "DATE_JOUR_LONG" - // RESPONSABLE STRUCTURE - | "RESPONSABLE_NOM" - | "RESPONSABLE_PRENOM" - | "RESPONSABLE_FONCTION" - - // INFOS STRUCTURE - | "STRUCTURE_NOM" - | "STRUCTURE_TYPE" - | "STRUCTURE_ADRESSE" - | "STRUCTURE_COMPLEMENT_ADRESSE" - | "STRUCTURE_VILLE" - | "STRUCTURE_CODE_POSTAL" - - // SI ADRESSE COURRIER DIFFERENTE - | "STRUCTURE_COURRIER_ADRESSE" - | "STRUCTURE_COURRIER_VILLE" - | "STRUCTURE_COURRIER_CODE_POSTAL" - // - | "USAGER_REF" - | "USAGER_CUSTOM_REF" - | "USAGER_CIVILITE" - | "USAGER_NOM" - | "USAGER_PRENOM" - | "USAGER_SURNOM" - | "USAGER_DATE_NAISSANCE" - | "USAGER_LIEU_NAISSANCE" - | "USAGER_PHONE" - | "USAGER_EMAIL" - // - | "STATUT_DOM" - | "TYPE_DOM" - | "DATE_DEBUT_DOM" - | "DATE_FIN_DOM" - | "DATE_PREMIERE_DOM" - | "DATE_DERNIER_PASSAGE" - - // RADIATIONS - | "DATE_RADIATION" - | "MOTIF_RADIATION" - - // ENTRETIEN - | "ENTRETIEN_ORIENTE_PAR" - | "ENTRETIEN_DOMICILIATION_EXISTANTE" - | "ENTRETIEN_REVENUS" - | "ENTRETIEN_LIEN_COMMUNE" - | "ENTRETIEN_COMPOSITION_MENAGE" - | "ENTRETIEN_SITUATION_RESIDENTIELLE" - | "ENTRETIEN_CAUSE_INSTABILITE" - | "ENTRETIEN_RAISON_DEMANDE" - | "ENTRETIEN_ACCOMPAGNEMENT"; diff --git a/packages/frontend/src/_common/model/structure-doc/types/index.ts b/packages/frontend/src/_common/model/structure-doc/types/index.ts index 37c90103aa..8cb1e8f5fe 100644 --- a/packages/frontend/src/_common/model/structure-doc/types/index.ts +++ b/packages/frontend/src/_common/model/structure-doc/types/index.ts @@ -1,5 +1,4 @@ //@index('./*', f => `export * from '${f.path}'`) export * from "./StructureCustomDocType.type"; export * from "./StructureDoc.type"; -export * from "./StructureDocKeys.type"; export * from "./StructureDocTypesAvailable.type"; diff --git a/packages/frontend/src/_common/model/usager/UsagerDoc.type.ts b/packages/frontend/src/_common/model/usager/UsagerDoc.type.ts deleted file mode 100644 index 2701217154..0000000000 --- a/packages/frontend/src/_common/model/usager/UsagerDoc.type.ts +++ /dev/null @@ -1,10 +0,0 @@ -export type UsagerDoc = { - createdAt: Date; - createdBy: string; - filetype: string; - label: string; - path?: string; - updatedAt?: Date; - uuid: string; // postgres id - version?: number; -}; diff --git a/packages/frontend/src/_common/model/usager/UsagerLight.type.ts b/packages/frontend/src/_common/model/usager/UsagerLight.type.ts index cfcfc5d738..29e9e31c11 100644 --- a/packages/frontend/src/_common/model/usager/UsagerLight.type.ts +++ b/packages/frontend/src/_common/model/usager/UsagerLight.type.ts @@ -1,5 +1,4 @@ -import { Usager } from "@domifa/common"; -import { AppEntity } from "../_core"; +import { AppEntity, Usager } from "@domifa/common"; export type UsagerLight = AppEntity & Pick< diff --git a/packages/frontend/src/_common/model/usager/index.ts b/packages/frontend/src/_common/model/usager/index.ts index a68efb34e4..fbfbf0e51e 100644 --- a/packages/frontend/src/_common/model/usager/index.ts +++ b/packages/frontend/src/_common/model/usager/index.ts @@ -5,7 +5,6 @@ export * from "./entretien"; export * from "./form"; export * from "./HISTORY_ACTIONS.const"; export * from "./rdv"; -export * from "./UsagerDoc.type"; export * from "./UsagerEcheanceInfos.type"; export * from "./UsagerLight.type"; export * from "./UsagersImportMode.type"; diff --git a/packages/frontend/src/app/modules/shared/components/display-table-image/display-table-image.component.ts b/packages/frontend/src/app/modules/shared/components/display-table-image/display-table-image.component.ts index 2d7d37b912..642e4055c1 100644 --- a/packages/frontend/src/app/modules/shared/components/display-table-image/display-table-image.component.ts +++ b/packages/frontend/src/app/modules/shared/components/display-table-image/display-table-image.component.ts @@ -3,8 +3,8 @@ import { STRUCTURE_DOC_EXTENSIONS_LABELS, STRUCTURE_DOC_ICONS, StructureDoc, - UsagerDoc, } from "../../../../../_common/model"; +import { UsagerDoc } from "@domifa/common"; @Component({ selector: "app-display-table-image", diff --git a/packages/frontend/src/app/modules/shared/components/table-head-sort/table-head-sort.component.ts b/packages/frontend/src/app/modules/shared/components/table-head-sort/table-head-sort.component.ts index 82f0dd07ff..f8b3d88892 100644 --- a/packages/frontend/src/app/modules/shared/components/table-head-sort/table-head-sort.component.ts +++ b/packages/frontend/src/app/modules/shared/components/table-head-sort/table-head-sort.component.ts @@ -24,14 +24,14 @@ export class TableHeadSortComponent { @Input() public columnName: string; @Input() public sortValue: UsagersFilterCriteriaSortValues; - @Output() public sortValueChange = + @Output() public readonly sortValueChange = new EventEmitter(); - @Input() public currentKey: any; - @Output() public currentKeyChange = new EventEmitter(); + @Input() public currentKey: string; + @Output() public readonly currentKeyChange = new EventEmitter(); @Input() public sortKey: string; - @Output() public sortArray = new EventEmitter(); + @Output() public readonly sortArray = new EventEmitter(); public rotate() { const rotation: { diff --git a/packages/frontend/src/app/modules/usager-profil/components/_documents/profil-structure-documents/profil-structure-docs.component.html b/packages/frontend/src/app/modules/usager-profil/components/_documents/profil-structure-documents/profil-structure-docs.component.html index 3b19dd789d..694fa8c56a 100644 --- a/packages/frontend/src/app/modules/usager-profil/components/_documents/profil-structure-documents/profil-structure-docs.component.html +++ b/packages/frontend/src/app/modules/usager-profil/components/_documents/profil-structure-documents/profil-structure-docs.component.html @@ -117,7 +117,7 @@ > {{ document.label }} diff --git a/packages/frontend/src/app/modules/usager-profil/components/_documents/profil-structure-documents/profil-structure-docs.component.ts b/packages/frontend/src/app/modules/usager-profil/components/_documents/profil-structure-documents/profil-structure-docs.component.ts index 430da5ac41..9ec0cbcb03 100644 --- a/packages/frontend/src/app/modules/usager-profil/components/_documents/profil-structure-documents/profil-structure-docs.component.ts +++ b/packages/frontend/src/app/modules/usager-profil/components/_documents/profil-structure-documents/profil-structure-docs.component.ts @@ -92,7 +92,7 @@ export class ProfilStructureDocsComponent implements OnInit, OnDestroy { const newBlob = new Blob([blob], { type: "application/vnd.openxmlformats-officedocument.wordprocessingml.document", }); - saveAs(newBlob, docType + ".docx"); + saveAs(newBlob, `${docType}.docx`); this.stopLoading(docType); }, error: () => { diff --git a/packages/frontend/src/app/modules/usager-shared/components/display-usager-docs/display-usager-docs.component.html b/packages/frontend/src/app/modules/usager-shared/components/display-usager-docs/display-usager-docs.component.html index e9edc5ff69..b42a773811 100644 --- a/packages/frontend/src/app/modules/usager-shared/components/display-usager-docs/display-usager-docs.component.html +++ b/packages/frontend/src/app/modules/usager-shared/components/display-usager-docs/display-usager-docs.component.html @@ -18,13 +18,41 @@ Type - Nom du document - Ajouté par - Ajouté le + + + + + + + + + + + + + Actions diff --git a/packages/frontend/src/app/modules/usager-shared/components/display-usager-docs/display-usager-docs.component.ts b/packages/frontend/src/app/modules/usager-shared/components/display-usager-docs/display-usager-docs.component.ts index c0d8e4adb8..6446c64fae 100644 --- a/packages/frontend/src/app/modules/usager-shared/components/display-usager-docs/display-usager-docs.component.ts +++ b/packages/frontend/src/app/modules/usager-shared/components/display-usager-docs/display-usager-docs.component.ts @@ -1,4 +1,4 @@ -import { STRUCTURE_DOC_EXTENSIONS, UsagerDoc } from "src/_common/model"; +import { STRUCTURE_DOC_EXTENSIONS } from "src/_common/model"; import { Component, Input, OnDestroy, OnInit } from "@angular/core"; import { CustomToastService } from "src/app/modules/shared/services/custom-toast.service"; @@ -6,7 +6,8 @@ import { UsagerFormModel } from "../../interfaces"; import { DocumentService } from "../../services/document.service"; import { saveAs } from "file-saver"; import { Subscription } from "rxjs"; -import { UserStructure } from "@domifa/common"; +import { UsagerDoc, UserStructure } from "@domifa/common"; +import { UsagersFilterCriteriaSortValues } from "../../../manage-usagers/components/usager-filter"; @Component({ selector: "app-display-usager-docs", @@ -25,6 +26,9 @@ export class DisplayUsagerDocsComponent implements OnInit, OnDestroy { delete: number[]; }; + public sortValue: UsagersFilterCriteriaSortValues = "desc"; + public currentKey: keyof UsagerDoc = "createdAt"; + constructor( private readonly documentService: DocumentService, private readonly toastService: CustomToastService diff --git a/packages/frontend/src/app/modules/usager-shared/services/document.service.ts b/packages/frontend/src/app/modules/usager-shared/services/document.service.ts index 8d4348f5f8..f1174ac9ae 100644 --- a/packages/frontend/src/app/modules/usager-shared/services/document.service.ts +++ b/packages/frontend/src/app/modules/usager-shared/services/document.service.ts @@ -5,26 +5,26 @@ import { CustomToastService } from "src/app/modules/shared/services/custom-toast import { Observable } from "rxjs"; import { map } from "rxjs/operators"; import { environment } from "src/environments/environment"; -import { UsagerDoc } from "../../../../_common/model"; import { StructureDoc, StructureDocTypesAvailable, } from "../../../../_common/model/structure-doc"; import { LoadingService } from "../../shared/services/loading.service"; +import { UsagerDoc } from "@domifa/common"; @Injectable({ providedIn: "root", }) export class DocumentService { public endPoint: string; - public endPointUsagers = environment.apiUrl + "usagers"; + public endPointUsagers = `${environment.apiUrl}usagers`; constructor( private readonly http: HttpClient, private readonly loadingService: LoadingService, private readonly toastService: CustomToastService ) { - this.endPoint = environment.apiUrl + "docs/"; + this.endPoint = `${environment.apiUrl}docs/`; } public upload(data: FormData, usagerRef: number) { @@ -131,7 +131,7 @@ export class DocumentService { // Liste des documents public getAllStructureDocs(): Observable { return this.http.get( - environment.apiUrl + "structure-docs/" + `${environment.apiUrl}structure-docs/` ); } } diff --git a/packages/frontend/src/app/modules/usager-shared/usager-shared.module.ts b/packages/frontend/src/app/modules/usager-shared/usager-shared.module.ts index 315b5f5a8e..decc413bb1 100644 --- a/packages/frontend/src/app/modules/usager-shared/usager-shared.module.ts +++ b/packages/frontend/src/app/modules/usager-shared/usager-shared.module.ts @@ -32,6 +32,7 @@ import { import { DisplayAyantsDroitsComponent } from "./components/display-ayants-droits/display-ayants-droits.component"; import { FormContactDetailsComponent } from "./components/form-contact-details/form-contact-details.component"; import { InputNationalityComponent } from "./components/input-nationality/input-nationality.component"; +import { TableHeadSortComponent } from "../shared/components/table-head-sort/table-head-sort.component"; @NgModule({ declarations: [ @@ -62,6 +63,7 @@ import { InputNationalityComponent } from "./components/input-nationality/input- UsersModule, ReactiveFormsModule, NgxIntlTelInputModule, + TableHeadSortComponent, ], exports: [ DisplayAyantsDroitsComponent, diff --git a/packages/frontend/src/app/shared/validators/upload-validator.ts b/packages/frontend/src/app/shared/validators/upload-validator.ts index 08da728f2d..6fca649739 100644 --- a/packages/frontend/src/app/shared/validators/upload-validator.ts +++ b/packages/frontend/src/app/shared/validators/upload-validator.ts @@ -1,5 +1,6 @@ import { AbstractControl, ValidationErrors, ValidatorFn } from "@angular/forms"; -import { UsagerDoc } from "../../../_common/model"; +import { UsagerDoc } from "@domifa/common"; + export type UploadResponseType = { success?: boolean; status?: string;