Merge pull request 'Fix some issues' (#3) from ajanin into cicd
All checks were successful
Build and Push to Registry / build-and-push (push) Successful in 3m52s

Reviewed-on: #3
This commit is contained in:
ajanin 2025-07-08 15:47:16 +00:00
commit d1af444ed1
6 changed files with 63 additions and 90 deletions

View File

@ -7,7 +7,7 @@ export default class CustomerService {
private static readonly messageBus: MessageBus = MessageBus.getInstance(); private static readonly messageBus: MessageBus = MessageBus.getInstance();
private static readonly CACHE_TTL = 5 * 60 * 1000; // 5 minutes cache TTL private static readonly CACHE_TTL = 45 * 60 * 1000; // 45 minutes cache TTL
private constructor() { } private constructor() { }

View File

@ -7,7 +7,7 @@ export default class DocumentService {
private static readonly messageBus: MessageBus = MessageBus.getInstance(); private static readonly messageBus: MessageBus = MessageBus.getInstance();
private static readonly CACHE_TTL = 5 * 60 * 1000; // 5 minutes cache TTL private static readonly CACHE_TTL = 45 * 60 * 1000; // 45 minutes cache TTL
private constructor() { } private constructor() { }

View File

@ -5,12 +5,16 @@ import User from 'src/sdk/User';
import CustomerService from './CustomerService'; import CustomerService from './CustomerService';
import DeedTypeService from './DeedTypeService'; import DeedTypeService from './DeedTypeService';
import DocumentTypeService from './DocumentTypeService';
import DocumentService from './DocumentService';
import FileService from './FileService';
import NoteService from './NoteService';
export default class FolderService { export default class FolderService {
private static readonly messageBus: MessageBus = MessageBus.getInstance(); private static readonly messageBus: MessageBus = MessageBus.getInstance();
private static readonly CACHE_TTL = 5 * 60 * 1000; // 5 minutes cache TTL private static readonly CACHE_TTL = 45 * 60 * 1000; // 45 minutes cache TTL
private constructor() { } private constructor() { }
@ -182,18 +186,44 @@ export default class FolderService {
} }
resolve(customers); resolve(customers);
}); });
if (process.processData.customers && process.processData.customers.length > 0) {
const documents: any[] = (await DocumentService.getDocuments()).map((process: any) => process.processData);
for (const customer of process.processData.customers) {
customer.documents = documents.filter((document: any) => (document.depositor && document.depositor.uid === customer.uid) || (document.customer && document.customer.uid === customer.uid));
for (const document of customer.documents) {
if (document.document_type) {
document.document_type = (await DocumentTypeService.getDocumentTypeByUid(document.document_type.uid)).processData;
}
if (document.files && document.files.length > 0) {
const files: any[] = [];
for (const file of document.files) {
files.push((await FileService.getFileByUid(file.uid)).processData);
}
document.files = files;
}
}
}
}
} }
if (process.processData.deed && process.processData.deed.deed_type) { if (process.processData.deed && process.processData.deed.deed_type) {
const p: any = await DeedTypeService.getDeedTypeByUid(process.processData.deed.deed_type.uid); const p: any = await DeedTypeService.getDeedTypeByUid(process.processData.deed.deed_type.uid);
process.processData.deed.deed_type = p.processData; process.processData.deed.deed_type = p.processData;
// Remove duplicates // Remove duplicates - TODO: review - see getDeedTypeByUid - completeDeedType
if (p.processData.document_types && p.processData.document_types.length > 0) { if (p.processData.document_types && p.processData.document_types.length > 0) {
process.processData.deed.document_types = p.processData.document_types.filter((item: any, index: number) => p.processData.document_types.findIndex((t: any) => t.uid === item.uid) === index); process.processData.deed.document_types = p.processData.document_types.filter((item: any, index: number) => p.processData.document_types.findIndex((t: any) => t.uid === item.uid) === index);
} }
} }
const notes: any[] = (await NoteService.getNotes()).map((process: any) => process.processData);
if (notes.length > 0) {
process.processData.notes = notes.filter((note: any) => note.folder.uid === process.processData.uid);
}
return process; return process;
} }

View File

@ -58,13 +58,12 @@ export default function Tabs<T>({ onSelect, tabs: propsTabs }: IProps<T>) {
useEffect(() => { useEffect(() => {
tabs.current = propsTabs; tabs.current = propsTabs;
// TODO: review if (tabs.current && tabs.current.length > 0 && tabs.current[0]) {
setTimeout(() => { setSelectedTab(tabs.current[0].value);
calculateVisibleElements(); onSelect(tabs.current[0].value);
if (tabs.current && tabs.current.length > 0 && tabs.current[0]) {
setSelectedTab(tabs.current[0].value); setTimeout(() => calculateVisibleElements(), 100);
} }
}, 150);
}, [propsTabs]); }, [propsTabs]);
useEffect(() => { useEffect(() => {

View File

@ -18,11 +18,10 @@ import classes from "./classes.module.scss";
import DeleteAskedDocumentModal from "./DeleteAskedDocumentModal"; import DeleteAskedDocumentModal from "./DeleteAskedDocumentModal";
import DeleteSentDocumentModal from "./DeleteSentDocumentModal"; import DeleteSentDocumentModal from "./DeleteSentDocumentModal";
import DocumentService from "src/common/Api/LeCoffreApi/sdk/DocumentService";
import DocumentTypeService from "src/common/Api/LeCoffreApi/sdk/DocumentTypeService";
import FileService from "src/common/Api/LeCoffreApi/sdk/FileService";
import LoaderService from "src/common/Api/LeCoffreApi/sdk/Loader/LoaderService";
import FolderService from "src/common/Api/LeCoffreApi/sdk/FolderService"; import FolderService from "src/common/Api/LeCoffreApi/sdk/FolderService";
import DocumentService from "src/common/Api/LeCoffreApi/sdk/DocumentService";
import FileService from "src/common/Api/LeCoffreApi/sdk/FileService";
import PdfService, { CertificateData, Metadata } from "@Front/Services/PdfService"; import PdfService, { CertificateData, Metadata } from "@Front/Services/PdfService";
import MessageBus from "src/sdk/MessageBus"; import MessageBus from "src/sdk/MessageBus";
@ -56,33 +55,20 @@ export default function DocumentTables(props: IProps) {
const fetchDocuments = useCallback( const fetchDocuments = useCallback(
() => { () => {
LoaderService.getInstance().show(); setDocuments([]);
DocumentService.getDocuments().then(async (processes: any[]) => { FolderService.getFolderByUid(folderUid).then((process: any) => {
if (processes.length > 0) { if (process) {
let documents: any[] = processes.map((process: any) => process.processData); const folder: any = process.processData;
const customer: any = folder.customers.find((customer: any) => customer.uid === customerUid);
// FilterBy folder.uid & depositor.uid if (customer && customer.documents) {
documents = documents.filter((document: any) => document.folder.uid === folderUid && document.depositor && document.depositor.uid === customerUid); const documents: any[] = customer.documents.filter((document: any) => document.depositor);
setDocuments(documents);
for (const document of documents) { } else {
if (document.document_type) { setDocuments([]);
document.document_type = (await DocumentTypeService.getDocumentTypeByUid(document.document_type.uid)).processData;
}
if (document.files && document.files.length > 0) {
const files: any[] = [];
for (const file of document.files) {
files.push((await FileService.getFileByUid(file.uid)).processData);
}
document.files = files;
}
} }
setDocuments(documents);
} else { } else {
setDocuments([]); setDocuments([]);
} }
LoaderService.getInstance().hide();
}); });
}, },
[customerUid, folderUid], [customerUid, folderUid],
@ -90,29 +76,20 @@ export default function DocumentTables(props: IProps) {
const fetchDocumentsNotary = useCallback( const fetchDocumentsNotary = useCallback(
() => { () => {
LoaderService.getInstance().show(); setDocumentsNotary([]);
DocumentService.getDocuments().then(async (processes: any[]) => { FolderService.getFolderByUid(folderUid).then((process: any) => {
if (processes.length > 0) { if (process) {
let documents: any[] = processes.map((process: any) => process.processData); const folder: any = process.processData;
const customer: any = folder.customers.find((customer: any) => customer.uid === customerUid);
// FilterBy folder.uid & customer.uid if (customer && customer.documents) {
documents = documents.filter((document: any) => document.folder.uid === folderUid && document.customer && document.customer.uid === customerUid); const documents: any[] = customer.documents.filter((document: any) => document.customer);
setDocumentsNotary(documents);
for (const document of documents) { } else {
if (document.files && document.files.length > 0) { setDocumentsNotary([]);
const files: any[] = [];
for (const file of document.files) {
files.push((await FileService.getFileByUid(file.uid)).processData);
}
document.files = files;
}
} }
setDocumentsNotary(documents);
} else { } else {
setDocumentsNotary([]); setDocumentsNotary([]);
} }
LoaderService.getInstance().hide();
}); });
}, },
[customerUid, folderUid], [customerUid, folderUid],

View File

@ -1,4 +1,3 @@
import Folders from "@Front/Api/LeCoffreApi/Notary/Folders/Folders";
import OfficeFolderAnchors from "@Front/Api/LeCoffreApi/Notary/OfficeFolderAnchors/OfficeFolderAnchors"; import OfficeFolderAnchors from "@Front/Api/LeCoffreApi/Notary/OfficeFolderAnchors/OfficeFolderAnchors";
import Loader from "@Front/Components/DesignSystem/Loader"; import Loader from "@Front/Components/DesignSystem/Loader";
import DefaultNotaryDashboard from "@Front/Components/LayoutTemplates/DefaultNotaryDashboard"; import DefaultNotaryDashboard from "@Front/Components/LayoutTemplates/DefaultNotaryDashboard";
@ -22,9 +21,6 @@ import NoClientView from "./NoClientView";
import AnchoringProcessingInfo from "./elements/AnchoringProcessingInfo"; import AnchoringProcessingInfo from "./elements/AnchoringProcessingInfo";
import FolderService from "src/common/Api/LeCoffreApi/sdk/FolderService"; import FolderService from "src/common/Api/LeCoffreApi/sdk/FolderService";
import NoteService from "src/common/Api/LeCoffreApi/sdk/NoteService";
import DocumentService from "src/common/Api/LeCoffreApi/sdk/DocumentService";
import LoaderService from "src/common/Api/LeCoffreApi/sdk/Loader/LoaderService";
export enum AnchorStatus { export enum AnchorStatus {
"VERIFIED_ON_CHAIN" = "VERIFIED_ON_CHAIN", "VERIFIED_ON_CHAIN" = "VERIFIED_ON_CHAIN",
@ -112,35 +108,6 @@ export default function FolderInformation(props: IProps) {
return FolderService.getFolderByUid(folderUid).then(async (process: any) => { return FolderService.getFolderByUid(folderUid).then(async (process: any) => {
if (process) { if (process) {
const folder: any = process.processData; const folder: any = process.processData;
await new Promise<void>((resolve: () => void) => {
NoteService.getNotes().then((processes: any) => {
if (processes.length > 0) {
let notes: any[] = processes.map((process: any) => process.processData);
// FilterBy folder.uid
notes = notes.filter((note: any) => note.folder.uid === folderUid);
if (notes.length > 0) {
folder.notes = notes;
}
}
resolve();
});
});
await new Promise<void>((resolve: () => void) => {
DocumentService.getDocuments().then((processes: any[]) => {
if (processes.length > 0) {
const documents: any[] = processes.map((process: any) => process.processData);
for (const customer of folder.customers) {
customer.documents = documents.filter((document: any) => document.depositor && document.depositor.uid === customer.uid);
}
}
resolve();
});
});
setFolder(folder); setFolder(folder);
} }
}); });