fix: Database transaction used after committed
This commit is contained in:
@@ -457,10 +457,11 @@ class Collection extends ParanoidModel {
|
||||
parentDocumentId: documentId,
|
||||
},
|
||||
});
|
||||
childDocuments.forEach(async (child) => {
|
||||
|
||||
for (const child of childDocuments) {
|
||||
await loopChildren(child.id, opts);
|
||||
await child.destroy(opts);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
await loopChildren(document.id, options);
|
||||
|
||||
@@ -568,12 +568,12 @@ class Document extends ParanoidModel {
|
||||
parentDocumentId,
|
||||
},
|
||||
});
|
||||
childDocuments.forEach(async (child) => {
|
||||
for (const child of childDocuments) {
|
||||
await archiveChildren(child.id);
|
||||
child.archivedAt = archivedAt;
|
||||
child.lastModifiedById = userId;
|
||||
await child.save(options);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
await archiveChildren(this.id);
|
||||
|
||||
Reference in New Issue
Block a user