preprod #5

Merged
Omar merged 5 commits from preprod into main 2025-07-21 23:39:59 +00:00
Showing only changes of commit 86725b53fe - Show all commits

View File

@ -240,7 +240,24 @@ export default class OfficeFoldersController extends ApiController {
}
const officeFolder = OfficeFolder.hydrate<OfficeFolder>(officeFolderFound, { strategy: "excludeAll" });
const folderHashes = getFolderHashes(officeFolder);
const documents = officeFolder.documents ?? [];
if (documents.length === 0) {
this.httpNotFoundRequest(response, "Office folder has no documents");
return;
}
const folderHashes: string[] = [];
documents.forEach((document: any) => {
const documentHydrated = Document.hydrate<Document>(document, { strategy: "excludeAll" });
if (documentHydrated.document_status === "VALIDATED") {
documentHydrated.files?.forEach((file: any) => {
const fileHydrated = File.hydrate<File>(file, { strategy: "excludeAll" });
folderHashes.push(fileHydrated.hash);
});
}
});
if (folderHashes.length === 0) {
this.httpNotFoundRequest(response, "No file hash to anchor");