mirror of
https://github.com/nocobase/nocobase
synced 2024-11-16 16:18:40 +00:00
26 lines
672 B
TypeScript
26 lines
672 B
TypeScript
|
import { Processor, JOB_STATUS } from '..';
|
||
|
import type { FlowNodeModel } from '../types';
|
||
|
|
||
|
export default {
|
||
|
async run(node: FlowNodeModel, input, processor: Processor) {
|
||
|
const { sequelize } = (<typeof FlowNodeModel>node.constructor).database;
|
||
|
const sql = processor.getParsedValue(node.config.sql ?? '', node).trim();
|
||
|
if (!sql) {
|
||
|
return {
|
||
|
status: JOB_STATUS.RESOLVED,
|
||
|
}
|
||
|
}
|
||
|
|
||
|
const result = await sequelize.query(sql, {
|
||
|
transaction: processor.transaction,
|
||
|
// plain: true,
|
||
|
// model: db.getCollection(node.config.collection).model
|
||
|
});
|
||
|
|
||
|
return {
|
||
|
result,
|
||
|
status: JOB_STATUS.RESOLVED,
|
||
|
};
|
||
|
},
|
||
|
};
|