Merge branch 'dev' into staging
This commit is contained in:
commit
59d343e3a7
@ -90,20 +90,20 @@ export default class OfficeFoldersController extends ApiController {
|
|||||||
const sortedHashes = [...folderHashes].sort();
|
const sortedHashes = [...folderHashes].sort();
|
||||||
const anchoringProof = await this.secureService.download(sortedHashes, officeFolder.office!.name);
|
const anchoringProof = await this.secureService.download(sortedHashes, officeFolder.office!.name);
|
||||||
|
|
||||||
const addFileToZip = (zip: Zip) => (uid: string): Promise<void> =>
|
const addFileToZip =
|
||||||
|
(zip: Zip) =>
|
||||||
|
(uid: string): Promise<void> =>
|
||||||
(async () => {
|
(async () => {
|
||||||
const data = await this.filesService.download(uid);
|
const data = await this.filesService.download(uid);
|
||||||
if (!data?.buffer) return;
|
if (!data?.buffer) return;
|
||||||
zip.addFile(`Documents du client/${uid}-${data.file.file_name}`, data.buffer);
|
zip.addFile(`Documents du client/${uid}-${data.file.file_name}`, data.buffer);
|
||||||
})()
|
})();
|
||||||
|
|
||||||
const uids: string[] = folderFilesUid.filter((uid): uid is string => uid !== undefined);
|
const uids: string[] = folderFilesUid.filter((uid): uid is string => uid !== undefined);
|
||||||
|
|
||||||
const zip = new Zip();
|
const zip = new Zip();
|
||||||
zip.addFile("Certificat de dépôt du dossier.pdf", anchoringProof);
|
zip.addFile("Certificat de dépôt du dossier.pdf", anchoringProof);
|
||||||
await Promise.allSettled(
|
await Promise.allSettled(uids.map(addFileToZip(zip)));
|
||||||
uids.map(addFileToZip(zip))
|
|
||||||
)
|
|
||||||
|
|
||||||
response.setHeader("Content-Type", "application/zip");
|
response.setHeader("Content-Type", "application/zip");
|
||||||
this.httpSuccess(response, zip.toBuffer());
|
this.httpSuccess(response, zip.toBuffer());
|
||||||
@ -132,6 +132,11 @@ export default class OfficeFoldersController extends ApiController {
|
|||||||
files: true,
|
files: true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
documents_notary: {
|
||||||
|
include: {
|
||||||
|
files: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
folder_anchor: true,
|
folder_anchor: true,
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -276,7 +281,7 @@ export default class OfficeFoldersController extends ApiController {
|
|||||||
let query: Prisma.OfficeFolderAnchorsFindManyArgs = {};
|
let query: Prisma.OfficeFolderAnchorsFindManyArgs = {};
|
||||||
if (req.query["q"]) {
|
if (req.query["q"]) {
|
||||||
query = JSON.parse(req.query["q"] as string);
|
query = JSON.parse(req.query["q"] as string);
|
||||||
if(query.where?.uid) {
|
if (query.where?.uid) {
|
||||||
this.httpBadRequest(response, "You can't filter by uid");
|
this.httpBadRequest(response, "You can't filter by uid");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user