46afc05898
* test(plugin-workflow): add getter cases * feat(plugin-workflow): add query type for node instruction * feat(plugin-workflow): add crud instructions for node type * fix(plugin-workflow): fix transaction * fix(plugin-workflow): fix context data of model trigger
23 lines
532 B
TypeScript
23 lines
532 B
TypeScript
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);
|
|
const result = await repo.create({
|
|
...execution.getParsedValue(params),
|
|
transaction: execution.transaction
|
|
});
|
|
|
|
return {
|
|
result,
|
|
status: JOB_STATUS.RESOLVED
|
|
};
|
|
}
|
|
}
|