diff --git a/index.js b/index.js index 84dff62..886c9cc 100644 --- a/index.js +++ b/index.js @@ -1,5 +1,6 @@ const path = require('path'); const { sleep } = require('./util'); +const { getAllWorkflows } = require('./workflow'); require(path.join(process.cwd(),"..","server","dist","database.js")); @@ -7,6 +8,12 @@ require(path.join(process.cwd(),"..","server","dist","database.js")); await sleep(5e3); console.time("WorkflowTester") + console.log("initilizing begin.."); + + const workflows = await getAllWorkflows(); + if(workflows.length==0) throw "There is not any workflow"; + + console.timeEnd("WorkflowTester") diff --git a/workflow.js b/workflow.js index e69de29..3359d21 100644 --- a/workflow.js +++ b/workflow.js @@ -0,0 +1,21 @@ +const getAllWorkflows = async (query = {}) => { + const workflows = await bpmsDB.bpms_workflow.findAll({ + where: { + // id:workflowId, + deletedAt: { + [Op.is]: null + }, + version: { + [Op.gt]: 0 + }, + ...query + }, + raw: true + }) + return workflows; +} + +module.exports = { + getAllWorkflows, + +} \ No newline at end of file