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);
|
||||
|
||||
@@ -62,7 +62,7 @@ export default class ImportJSONTask extends ImportTask {
|
||||
documents: { [id: string]: DocumentJSONExport },
|
||||
collectionId: string
|
||||
) {
|
||||
Object.values(documents).forEach(async (node) => {
|
||||
Object.values(documents).forEach((node) => {
|
||||
const id = uuidv4();
|
||||
output.documents.push({
|
||||
...node,
|
||||
@@ -89,7 +89,7 @@ export default class ImportJSONTask extends ImportTask {
|
||||
async function mapAttachments(attachments: {
|
||||
[id: string]: AttachmentJSONExport;
|
||||
}) {
|
||||
Object.values(attachments).forEach(async (node) => {
|
||||
Object.values(attachments).forEach((node) => {
|
||||
const id = uuidv4();
|
||||
const zipObject = zip.files[node.key];
|
||||
const mimeType = mime.lookup(node.key) || "application/octet-stream";
|
||||
|
||||
Reference in New Issue
Block a user