tachybase_todo/packages/plugin-workflow/src/instructions/create.ts
Junyi 46afc05898
Feat(plugin workflow): add more instructions (#201)
* 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
2022-02-20 21:23:39 +08:00

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
};
}
}