Conditional hydration of folder_anchor
All checks were successful
Test - Build & Deploy to Scaleway / build-and-push-images-lecoffre (push) Successful in 1m43s
Test - Build & Deploy to Scaleway / deploy-back-lecoffre (push) Successful in 3s
Test - Build & Deploy to Scaleway / deploy-cron-lecoffre (push) Successful in 3s

This commit is contained in:
Sosthene 2025-07-30 13:26:05 +02:00
parent 64918e94f0
commit bac90f003c

View File

@ -170,16 +170,18 @@ export default class OfficeFoldersController extends ApiController {
return;
}
const officeFolderAnchorFound = OfficeFolderAnchor.hydrate<OfficeFolderAnchor>(officeFolderFound.folder_anchor, {
strategy: "excludeAll",
});
if (officeFolderAnchorFound) {
this.httpBadRequest(response, {
error: "Office folder already anchored",
folder_anchor: officeFolderAnchorFound,
if (officeFolderFound.folder_anchor) {
const officeFolderAnchorFound = OfficeFolderAnchor.hydrate<OfficeFolderAnchor>(officeFolderFound.folder_anchor, {
strategy: "excludeAll",
});
return;
if (officeFolderAnchorFound) {
this.httpBadRequest(response, {
error: "Office folder already anchored",
folder_anchor: officeFolderAnchorFound,
});
return;
}
}
const officeFolder = OfficeFolder.hydrate<OfficeFolder>(officeFolderFound, { strategy: "excludeAll" });