🐛 Fixing every missing uid

This commit is contained in:
Maxime Lalo 2023-05-03 12:50:51 +02:00
parent f9cacdb2c1
commit d8cbeb1178
16 changed files with 579 additions and 244 deletions

778
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -21,7 +21,7 @@
"dotenv": "^16.0.3",
"eslint": "8.36.0",
"eslint-config-next": "13.2.4",
"le-coffre-resources": "git@github.com:smart-chain-fr/leCoffre-resources.git#v2.18",
"le-coffre-resources": "git@github.com:smart-chain-fr/leCoffre-resources.git#v2.27",
"next": "13.2.4",
"prettier": "^2.8.7",
"react": "18.2.0",

View File

@ -1,5 +1,5 @@
import { Service } from "typedi";
import { Deed, DeedType } from "le-coffre-resources/dist/Notary";
import { DeedType } from "le-coffre-resources/dist/Notary";
import BaseSuperAdmin from "../BaseSuperAdmin";
// TODO Type get query params -> Where + inclue + orderby

View File

@ -2,7 +2,6 @@ import { Service } from "typedi";
import { OfficeFolder } from "le-coffre-resources/dist/Notary";
import BaseSuperAdmin from "../BaseSuperAdmin";
import { EFolderStatus } from "le-coffre-resources/dist/Customer/OfficeFolder";
import { IDashBoardFolder } from "@Front/Components/LayoutTemplates/DefaultNotaryDashboard";
// TODO Type get query params -> Where + inclue + orderby
export interface IGetFoldersParams {
@ -69,11 +68,11 @@ export default class Folders extends BaseSuperAdmin {
/**
* @description : Get a folder by uid
*/
public async getByUid(uid: string, q?: any): Promise<IDashBoardFolder> {
public async getByUid(uid: string, q?: any): Promise<OfficeFolder> {
const url = new URL(this.baseURl.concat(`/${uid}`));
if (q) Object.entries(q).forEach(([key, value]) => url.searchParams.set(key, JSON.stringify(value)));
try {
return await this.getRequest<IDashBoardFolder>(url);
return await this.getRequest<OfficeFolder>(url);
} catch (err) {
this.onError(err);
return Promise.reject(err);

View File

@ -12,7 +12,7 @@ import classes from "./classes.module.scss";
type IProps = {
document: {
uid: Document["uid"];
uid?: Document["uid"];
document_type: Document["document_type"];
document_status: Document["document_status"];
folder: Document["folder"];

View File

@ -25,10 +25,10 @@ export default function FolderBoxInformation(props: IProps) {
const { isArchived = false, type } = props;
const editDescriptionPath = Module.getInstance()
.get()
.modules.pages.Folder.pages.EditDescription.props.path.replace("[folderUid]", props.folder.uid);
.modules.pages.Folder.pages.EditDescription.props.path.replace("[folderUid]", props.folder.uid ?? "");
const editInformationsPath = Module.getInstance()
.get()
.modules.pages.Folder.pages.EditInformations.props.path.replace("[folderUid]", props.folder.uid);
.modules.pages.Folder.pages.EditInformations.props.path.replace("[folderUid]", props.folder.uid ?? "");
const path = type === EFolderBoxInformationType.DESCRIPTION ? editDescriptionPath : editInformationsPath;
return (

View File

@ -36,7 +36,7 @@ class FolderListClass extends React.Component<IPropsClass, IState> {
onClick={this.props.onCloseLeftSide}
key={folder.uid}
className={folder.uid === this.props.selectedFolder ? classes["active"] : ""}>
<Link href={redirectPath.replace("[folderUid]", folder.uid)}>
<Link href={redirectPath.replace("[folderUid]", folder.uid ?? "")}>
<FolderContainer folder={folder} onSelectedFolder={this.props.onSelectedFolder} />;
</Link>
</div>

View File

@ -9,7 +9,7 @@ type IProps = {
subtitle?: string;
documents:
| {
uid: Document["uid"];
uid?: Document["uid"];
document_type: Document["document_type"];
document_status: Document["document_status"];
folder: Document["folder"];

View File

@ -11,10 +11,10 @@ import { IDashBoardFolder } from "@Front/Components/LayoutTemplates/DefaultNotar
type IProps = {
contact: {
uid: Contact["uid"];
uid?: Contact["uid"];
first_name: Contact["first_name"];
last_name: Contact["last_name"];
phone_number: Contact["phone_number"];
phone_number?: Contact["phone_number"];
cell_phone_number: Contact["cell_phone_number"];
email: Contact["email"];
};
@ -30,8 +30,8 @@ export default class UserFolderHeader extends React.Component<IProps, IState> {
public override render(): JSX.Element {
const redirectPath = Module.getInstance()
.get()
.modules.pages.Folder.pages.EditClient.props.path.replace("[folderUid]", this.props.folder.uid)
.replace("[clientUid]", this.props.contact.uid);
.modules.pages.Folder.pages.EditClient.props.path.replace("[folderUid]", this.props.folder.uid ?? "")
.replace("[clientUid]", this.props.contact.uid ?? "");
return (
<div className={classes["root"]}>
<div className={classes["content"]}>
@ -48,7 +48,7 @@ export default class UserFolderHeader extends React.Component<IProps, IState> {
<div className={classes["container"]}>
<Typography typo={ITypo.NAV_INPUT_16}>Numéro de téléphone</Typography>
<Typography typo={ITypo.P_18}>
{this.formatPhoneNumber(this.props.contact.phone_number) ??
{this.formatPhoneNumber(this.props.contact.phone_number ?? "") ??
this.formatPhoneNumber(this.props.contact.cell_phone_number)}
</Typography>
</div>

View File

@ -52,7 +52,7 @@ export default class UserFolder extends React.Component<IProps, IState> {
const otherDocuments: Document[] | null = this.getValidatedAndPendindDocuments();
const redirectPath = Module.getInstance()
.get()
.modules.pages.Folder.pages.AskDocument.props.path.replace("[folderUid]", this.props.folder.uid);
.modules.pages.Folder.pages.AskDocument.props.path.replace("[folderUid]", this.props.folder.uid ?? "");
return (
<div className={classes["root"]}>
<Confirm
@ -179,7 +179,7 @@ export default class UserFolder extends React.Component<IProps, IState> {
}, this.props.animationDelay);
}
private openDeletionModal(uid: string): void {
private openDeletionModal(uid?: string): void {
// TODO: call API to delete document
this.setState({
isOpenDeletionModal: true,

View File

@ -32,7 +32,7 @@ type IState = {
};
export type IDashBoardFolder = {
uid: OfficeFolder["uid"];
uid?: OfficeFolder["uid"];
name: OfficeFolder["name"];
folder_number: OfficeFolder["folder_number"];
documents?: OfficeFolder["documents"];

View File

@ -72,6 +72,7 @@ export const docType: DocumentType = {
public_description: "Acte de naissance public description",
private_description: "Acte de naissance private description",
archived_at: new Date(),
office: office,
};
export const identityDocType: DocumentType = {
@ -82,6 +83,7 @@ export const identityDocType: DocumentType = {
public_description: "Carte d'identité public description",
private_description: "Carte d'identité private description",
archived_at: new Date(),
office: office,
};
export const customer: Customer = {

View File

@ -17,7 +17,7 @@ import { Deed, DeedType, OfficeFolder, OfficeFolderHasStakeholder } from "le-cof
import DeedTypes from "@Front/Api/LeCoffreApi/SuperAdmin/DeedTypes/DeedTypes";
import Users from "@Front/Api/LeCoffreApi/SuperAdmin/Users/Users";
import User from "le-coffre-resources/dist/Notary";
import Folders, { IPostFoldersParams } from "@Front/Api/LeCoffreApi/SuperAdmin/Folders/Folders";
import Folders from "@Front/Api/LeCoffreApi/SuperAdmin/Folders/Folders";
import { EFolderStatus } from "le-coffre-resources/dist/Customer/OfficeFolder";
type IFormValues = {

View File

@ -17,7 +17,7 @@ export default class ClientSection extends React.Component<IProps, IState> {
public override render(): JSX.Element {
const navigatePath = Module.getInstance()
.get()
.modules.pages.Folder.pages.AddClient.props.path.replace("[folderUid]", this.props.folder.uid);
.modules.pages.Folder.pages.AddClient.props.path.replace("[folderUid]", this.props.folder.uid ?? "");
return (
<div className={classes["root"]}>
{this.doesFolderHaveCustomer() ? (

View File

@ -150,7 +150,7 @@ class FolderInformationClass extends BasePage<IPropsClass, IState> {
private async onArchivedModalAccepted() {
if (!this.state.selectedFolder) return;
await Folders.getInstance().archive(this.state.selectedFolder.uid, this.state.selectedFolder);
await Folders.getInstance().archive(this.state.selectedFolder.uid ?? "", this.state.selectedFolder);
this.closeArchivedModal();
this.props.router.push(Module.getInstance().get().modules.pages.Folder.props.path);
}

View File

@ -119,7 +119,7 @@ class FolderInformationClass extends BasePage<IPropsClass, IState> {
private async restoreFolder() {
if (!this.state.selectedFolder) return;
await Folders.getInstance().restore(this.state.selectedFolder.uid, this.state.selectedFolder);
await Folders.getInstance().restore(this.state.selectedFolder.uid ?? "", this.state.selectedFolder);
this.props.router.push(Module.getInstance().get().modules.pages.Folder.pages.FolderArchived.props.path);
}