Only take VALIDATED documents hash in get
All checks were successful
All checks were successful
This commit is contained in:
parent
b70dee2afe
commit
86725b53fe
@ -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");
|
||||
|
Loading…
x
Reference in New Issue
Block a user