From 324429c98896272766f575b53e541b255f590f6f Mon Sep 17 00:00:00 2001 From: Maxime Lalo Date: Mon, 10 Jul 2023 16:12:07 +0200 Subject: [PATCH] :sparkles: Fixing getters --- .../DefaultNotaryDashboard/index.tsx | 20 ++++++--------- .../Folder/AddClientToFolder/index.tsx | 25 ++++++++----------- .../Folder/FolderInformation/index.tsx | 18 ++++++------- .../UpdateFolderCollaborators/index.tsx | 10 +++----- .../Folder/UpdateFolderMetadata/index.tsx | 2 +- .../FolderInformation/index.tsx | 2 +- 6 files changed, 29 insertions(+), 48 deletions(-) diff --git a/src/front/Components/LayoutTemplates/DefaultNotaryDashboard/index.tsx b/src/front/Components/LayoutTemplates/DefaultNotaryDashboard/index.tsx index 00ec42dc..bacb0a23 100644 --- a/src/front/Components/LayoutTemplates/DefaultNotaryDashboard/index.tsx +++ b/src/front/Components/LayoutTemplates/DefaultNotaryDashboard/index.tsx @@ -1,4 +1,3 @@ - import ChevronIcon from "@Assets/Icons/chevron.svg"; import Folders, { IGetFoldersParams } from "@Front/Api/LeCoffreApi/SuperAdmin/Folders/Folders"; import Button, { EButtonVariant } from "@Front/Components/DesignSystem/Button"; @@ -9,12 +8,11 @@ import BackArrow from "@Front/Components/Elements/BackArrow"; import WindowStore from "@Front/Stores/WindowStore"; import classNames from "classnames"; import { OfficeFolder } from "le-coffre-resources/dist/Customer"; +import EFolderStatus from "le-coffre-resources/dist/Customer/EFolderStatus"; import Image from "next/image"; import React, { ReactNode } from "react"; import classes from "./classes.module.scss"; -import EFolderStatus from "le-coffre-resources/dist/Customer/EFolderStatus"; - type IProps = { title: string; @@ -118,18 +116,14 @@ export default class DefaultNotaryDashboard extends React.Component { - +
@@ -150,13 +147,9 @@ class AddClientToFolderClass extends BasePage { private async getFolderPreSelectedCustomers(folderUid: string): Promise { const query = { q: { - office_folder_has_customers: { + customers: { include: { - customer: { - include: { - contact: true, - }, - }, + contact: true, }, }, }, @@ -224,9 +217,11 @@ class AddClientToFolderClass extends BasePage { } if (customersToLink) { - const body = OfficeFolder.hydrate({ customers: customersToLink.map((customer) => { - return Customer.hydrate(customer); - }) }); + const body = OfficeFolder.hydrate({ + customers: customersToLink.map((customer) => { + return Customer.hydrate(customer); + }), + }); await Folders.getInstance().put(this.props.selectedFolderUid, body); this.props.router.push(`/folders/${this.props.selectedFolderUid}`); diff --git a/src/front/Components/Layouts/Folder/FolderInformation/index.tsx b/src/front/Components/Layouts/Folder/FolderInformation/index.tsx index a0fafb0e..3e5e4c5a 100644 --- a/src/front/Components/Layouts/Folder/FolderInformation/index.tsx +++ b/src/front/Components/Layouts/Folder/FolderInformation/index.tsx @@ -2,6 +2,7 @@ import ChevronIcon from "@Assets/Icons/chevron.svg"; import Folders from "@Front/Api/LeCoffreApi/SuperAdmin/Folders/Folders"; import Button, { EButtonVariant } from "@Front/Components/DesignSystem/Button"; import FolderBoxInformation, { EFolderBoxInformationType } from "@Front/Components/DesignSystem/FolderBoxInformation"; +import TextAreaField from "@Front/Components/DesignSystem/Form/TextareaField"; import Confirm from "@Front/Components/DesignSystem/Modal/Confirm"; import QuantityProgressBar from "@Front/Components/DesignSystem/QuantityProgressBar"; import Typography, { ITypo, ITypoColor } from "@Front/Components/DesignSystem/Typography"; @@ -16,7 +17,6 @@ import { ChangeEvent } from "react"; import BasePage from "../../Base"; import classes from "./classes.module.scss"; import ClientSection from "./ClientSection"; -import TextAreaField from "@Front/Components/DesignSystem/Form/TextareaField"; type IProps = {}; @@ -189,18 +189,14 @@ class FolderInformationClass extends BasePage { q: { deed: { include: { deed_type: true } }, office: true, - office_folder_has_customers: { + customer: { include: { - customer: { + contact: true, + documents: { include: { - contact: true, - documents: { - include: { - folder: true, - document_type: true, - files: true, - }, - }, + folder: true, + document_type: true, + files: true, }, }, }, diff --git a/src/front/Components/Layouts/Folder/UpdateFolderCollaborators/index.tsx b/src/front/Components/Layouts/Folder/UpdateFolderCollaborators/index.tsx index 8b99c85e..02f600ba 100644 --- a/src/front/Components/Layouts/Folder/UpdateFolderCollaborators/index.tsx +++ b/src/front/Components/Layouts/Folder/UpdateFolderCollaborators/index.tsx @@ -104,13 +104,9 @@ class UpdateFolderCollaboratorsClass extends BasePage { const query = { q: { office: true, - office_folder_has_stakeholder: { + stakeholders: { include: { - user_stakeholder: { - include: { - contact: true, - }, - }, + contact: true, }, }, }, @@ -178,7 +174,7 @@ class UpdateFolderCollaboratorsClass extends BasePage { collaboratorsUid = this.state.selectedCollaborators.map((collaborator) => User.hydrate({ uid: collaborator.value as string }), ); - } + } await Folders.getInstance().put(this.props.selectedFolderUid, { stakeholders: collaboratorsUid }); this.props.router.push( Module.getInstance() diff --git a/src/front/Components/Layouts/Folder/UpdateFolderMetadata/index.tsx b/src/front/Components/Layouts/Folder/UpdateFolderMetadata/index.tsx index 3f480fe7..30124d19 100644 --- a/src/front/Components/Layouts/Folder/UpdateFolderMetadata/index.tsx +++ b/src/front/Components/Layouts/Folder/UpdateFolderMetadata/index.tsx @@ -103,7 +103,7 @@ class UpdateFolderMetadataClass extends BasePage { q: { deed: { include: { deed_type: true } }, office: true, - office_folder_has_customers: { include: { customer: { include: { contact: true } } } }, + customers: { include: { contact: true } }, }, }; const folder = await Folders.getInstance().getByUid(this.props.folderUid, query); diff --git a/src/front/Components/Layouts/FolderArchived/FolderInformation/index.tsx b/src/front/Components/Layouts/FolderArchived/FolderInformation/index.tsx index 44fb416c..127287cd 100644 --- a/src/front/Components/Layouts/FolderArchived/FolderInformation/index.tsx +++ b/src/front/Components/Layouts/FolderArchived/FolderInformation/index.tsx @@ -140,7 +140,7 @@ class FolderInformationClass extends BasePage { q: { deed: { include: { deed_type: "true" } }, office: "true", - office_folder_has_customers: { include: { customer: { include: { contact: true } } } }, + customer: { include: { contact: true } }, }, }; const folder = await Folders.getInstance().getByUid(this.props.selectedFolderUid, query);