mirror of
https://gitee.com/nocobase/nocobase.git
synced 2025-05-09 15:39:24 +08:00
* refactor(db): add batch logic to update for better performance * test(plugin-workflow): fix test cases * fix(db): treat belongsTo field in update values as foreignKey * fix(db): also handle object with id for belongsTo field * fix(db): avoid 0 as falsy * fix(db): fix test case
25 lines
700 B
TypeScript
25 lines
700 B
TypeScript
import FlowNodeModel from '../models/FlowNode';
|
|
import Processor from '../Processor';
|
|
import { JOB_STATUS } from '../constants';
|
|
|
|
export default {
|
|
async run(node: FlowNodeModel, input, processor: Processor) {
|
|
const { collection, params = {} } = node.config;
|
|
|
|
const repo = (<typeof FlowNodeModel>node.constructor).database.getRepository(collection);
|
|
const options = processor.getParsedValue(params, node);
|
|
const result = await repo.update({
|
|
...options,
|
|
context: {
|
|
executionId: processor.execution.id,
|
|
},
|
|
transaction: processor.transaction,
|
|
});
|
|
|
|
return {
|
|
result: result.length ?? result,
|
|
status: JOB_STATUS.RESOLVED,
|
|
};
|
|
},
|
|
};
|