更正了extraFile,修正了backendRuntimeContext
This commit is contained in:
parent
c9484c0fa1
commit
22264e63a3
|
|
@ -29,7 +29,8 @@ const triggers = [
|
|||
},
|
||||
{
|
||||
name: '删除extraFile时远端也进行删除',
|
||||
when: 'before',
|
||||
when: 'commit',
|
||||
strict: 'makeSure',
|
||||
entity: 'extraFile',
|
||||
action: 'remove',
|
||||
fn: async ({ operation }, context) => {
|
||||
|
|
@ -58,12 +59,13 @@ const triggers = [
|
|||
},
|
||||
filter,
|
||||
}, {
|
||||
includedDeleted: true,
|
||||
dontCollect: true,
|
||||
});
|
||||
for (const extraFile of extraFileList) {
|
||||
const { origin } = extraFile;
|
||||
const uploader = getCos(origin);
|
||||
await uploader.checkWhetherSuccess(extraFile, context);
|
||||
await uploader.removeFile(extraFile, context);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,7 +31,8 @@ const triggers = [
|
|||
},
|
||||
{
|
||||
name: '删除extraFile时远端也进行删除',
|
||||
when: 'before',
|
||||
when: 'commit',
|
||||
strict: 'makeSure',
|
||||
entity: 'extraFile',
|
||||
action: 'remove',
|
||||
fn: async ({ operation }, context) => {
|
||||
|
|
@ -60,12 +61,13 @@ const triggers = [
|
|||
},
|
||||
filter,
|
||||
}, {
|
||||
includedDeleted: true,
|
||||
dontCollect: true,
|
||||
});
|
||||
for (const extraFile of extraFileList) {
|
||||
const { origin } = extraFile;
|
||||
const uploader = (0, cos_1.getCos)(origin);
|
||||
await uploader.checkWhetherSuccess(extraFile, context);
|
||||
await uploader.removeFile(extraFile, context);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -156,7 +156,7 @@ export abstract class BackendRuntimeContext<ED extends EntityDict & BaseEntityDi
|
|||
await this.initializedMark;
|
||||
}
|
||||
|
||||
private async initialize(data?: SerializedData) {
|
||||
protected async initialize(data?: SerializedData) {
|
||||
if (data) {
|
||||
await this.begin();
|
||||
const closeRootMode = this.openRootMode();
|
||||
|
|
@ -246,11 +246,14 @@ export abstract class BackendRuntimeContext<ED extends EntityDict & BaseEntityDi
|
|||
this.temporaryUserId = userId;
|
||||
}
|
||||
|
||||
toString() {
|
||||
if (this.rootMode) {
|
||||
return JSON.stringify({ rootMode: true });
|
||||
}
|
||||
return JSON.stringify({ a: this.application?.id, t: this.token?.id });
|
||||
protected getSerializedData(): SerializedData {
|
||||
const data = super.getSerializedData();
|
||||
return {
|
||||
...data,
|
||||
a: this.application?.id,
|
||||
t: this.token?.id,
|
||||
rm: this.rootMode,
|
||||
};
|
||||
}
|
||||
|
||||
isRoot() {
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@ export type AspectDict<
|
|||
export interface SerializedData extends Fsd {
|
||||
a?: string;
|
||||
t?: string;
|
||||
rm?: boolean;
|
||||
};
|
||||
|
||||
export abstract class FrontendRuntimeContext<
|
||||
|
|
|
|||
|
|
@ -37,7 +37,8 @@ const triggers: Trigger<EntityDict, 'extraFile', BackendRuntimeContext<EntityDic
|
|||
} as CreateTrigger<EntityDict, 'extraFile', BackendRuntimeContext<EntityDict>>,
|
||||
{
|
||||
name: '删除extraFile时远端也进行删除',
|
||||
when: 'before',
|
||||
when: 'commit',
|
||||
strict: 'makeSure',
|
||||
entity: 'extraFile',
|
||||
action: 'remove',
|
||||
fn: async ({ operation }, context) => {
|
||||
|
|
@ -69,13 +70,14 @@ const triggers: Trigger<EntityDict, 'extraFile', BackendRuntimeContext<EntityDic
|
|||
filter,
|
||||
},
|
||||
{
|
||||
includedDeleted: true,
|
||||
dontCollect: true,
|
||||
}
|
||||
);
|
||||
for (const extraFile of extraFileList) {
|
||||
const { origin } = extraFile;
|
||||
const uploader = getCos(origin!);
|
||||
await uploader.checkWhetherSuccess(extraFile as EntityDict['extraFile']['OpSchema'], context);
|
||||
await uploader.removeFile(extraFile as EntityDict['extraFile']['OpSchema'], context);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue