extraFile删除时删除远端文件使用rootmode
This commit is contained in:
parent
dcbd7f0936
commit
d06b32fe48
|
|
@ -41,6 +41,7 @@ const triggers = [
|
||||||
entity: 'extraFile',
|
entity: 'extraFile',
|
||||||
action: 'remove',
|
action: 'remove',
|
||||||
fn: async ({ ids }, context) => {
|
fn: async ({ ids }, context) => {
|
||||||
|
const fn = context.openRootMode();
|
||||||
const rows = await context.select('extraFile', {
|
const rows = await context.select('extraFile', {
|
||||||
data: {
|
data: {
|
||||||
id: 1,
|
id: 1,
|
||||||
|
|
@ -50,7 +51,7 @@ const triggers = [
|
||||||
filter: {
|
filter: {
|
||||||
id: { $in: ids },
|
id: { $in: ids },
|
||||||
},
|
},
|
||||||
}, {});
|
}, { includedDeleted: true });
|
||||||
for (const extraFile of rows) {
|
for (const extraFile of rows) {
|
||||||
const { origin, objectId } = extraFile;
|
const { origin, objectId } = extraFile;
|
||||||
// 用objectId来去重,只有当没有还有效的objectId方可删除
|
// 用objectId来去重,只有当没有还有效的objectId方可删除
|
||||||
|
|
@ -65,6 +66,7 @@ const triggers = [
|
||||||
await uploader.removeFile(extraFile, config);
|
await uploader.removeFile(extraFile, config);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
fn();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
|
||||||
|
|
@ -43,6 +43,7 @@ const triggers = [
|
||||||
entity: 'extraFile',
|
entity: 'extraFile',
|
||||||
action: 'remove',
|
action: 'remove',
|
||||||
fn: async ({ ids }, context) => {
|
fn: async ({ ids }, context) => {
|
||||||
|
const fn = context.openRootMode();
|
||||||
const rows = await context.select('extraFile', {
|
const rows = await context.select('extraFile', {
|
||||||
data: {
|
data: {
|
||||||
id: 1,
|
id: 1,
|
||||||
|
|
@ -52,7 +53,7 @@ const triggers = [
|
||||||
filter: {
|
filter: {
|
||||||
id: { $in: ids },
|
id: { $in: ids },
|
||||||
},
|
},
|
||||||
}, {});
|
}, { includedDeleted: true });
|
||||||
for (const extraFile of rows) {
|
for (const extraFile of rows) {
|
||||||
const { origin, objectId } = extraFile;
|
const { origin, objectId } = extraFile;
|
||||||
// 用objectId来去重,只有当没有还有效的objectId方可删除
|
// 用objectId来去重,只有当没有还有效的objectId方可删除
|
||||||
|
|
@ -67,6 +68,7 @@ const triggers = [
|
||||||
await uploader.removeFile(extraFile, config);
|
await uploader.removeFile(extraFile, config);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
fn();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
|
||||||
|
|
@ -50,6 +50,7 @@ const triggers: Trigger<EntityDict, 'extraFile', BRC<EntityDict>>[] = [
|
||||||
entity: 'extraFile',
|
entity: 'extraFile',
|
||||||
action: 'remove',
|
action: 'remove',
|
||||||
fn: async ({ ids }, context) => {
|
fn: async ({ ids }, context) => {
|
||||||
|
const fn = context.openRootMode();
|
||||||
const rows = await context.select('extraFile', {
|
const rows = await context.select('extraFile', {
|
||||||
data: {
|
data: {
|
||||||
id: 1,
|
id: 1,
|
||||||
|
|
@ -59,7 +60,7 @@ const triggers: Trigger<EntityDict, 'extraFile', BRC<EntityDict>>[] = [
|
||||||
filter: {
|
filter: {
|
||||||
id: { $in: ids },
|
id: { $in: ids },
|
||||||
},
|
},
|
||||||
}, {});
|
}, { includedDeleted: true });
|
||||||
for (const extraFile of rows) {
|
for (const extraFile of rows) {
|
||||||
const { origin, objectId } = extraFile;
|
const { origin, objectId } = extraFile;
|
||||||
|
|
||||||
|
|
@ -75,6 +76,7 @@ const triggers: Trigger<EntityDict, 'extraFile', BRC<EntityDict>>[] = [
|
||||||
await uploader.removeFile(extraFile as EntityDict['extraFile']['OpSchema'], config);
|
await uploader.removeFile(extraFile as EntityDict['extraFile']['OpSchema'], config);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
fn();
|
||||||
}
|
}
|
||||||
} as RemoveTrigger<EntityDict, 'extraFile', BRC<EntityDict>>,
|
} as RemoveTrigger<EntityDict, 'extraFile', BRC<EntityDict>>,
|
||||||
];
|
];
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue