2022-02-20 21:23:39 +08:00
|
|
|
import { JOB_STATUS } from "../constants";
|
|
|
|
import FlowNodeModel from "../models/FlowNode";
|
|
|
|
|
|
|
|
export default {
|
|
|
|
async run(this: FlowNodeModel, input, execution) {
|
|
|
|
const {
|
|
|
|
collection,
|
|
|
|
params = {}
|
|
|
|
} = this.config;
|
|
|
|
|
|
|
|
const repo = (<typeof FlowNodeModel>this.constructor).database.getRepository(collection);
|
2022-04-14 00:05:13 +08:00
|
|
|
const options = execution.getParsedValue(params);
|
2022-02-20 21:23:39 +08:00
|
|
|
const result = await repo.destroy({
|
2022-04-14 00:05:13 +08:00
|
|
|
...options,
|
2022-02-20 21:23:39 +08:00
|
|
|
transaction: execution.transaction
|
|
|
|
});
|
|
|
|
|
|
|
|
return {
|
|
|
|
result,
|
|
|
|
status: JOB_STATUS.RESOLVED
|
|
|
|
};
|
|
|
|
}
|
|
|
|
}
|