update index.js

main
MohammadHoseinPaymard 2 weeks ago
parent 28a93b02f5
commit 3abe824840
  1. 30
      index.js
  2. 25
      process.js

@ -1,6 +1,7 @@
const path = require('path'); const path = require('path');
const { sleep } = require('./util'); const { sleep } = require('./util');
const { getAllWorkflows } = require('./workflow'); const { getAllWorkflows } = require('./workflow');
const { getAllProcesses } = require('./process');
require(path.join(process.cwd(),"..","server","dist","database.js")); require(path.join(process.cwd(),"..","server","dist","database.js"));
@ -10,10 +11,35 @@ require(path.join(process.cwd(),"..","server","dist","database.js"));
console.log("initilizing begin.."); console.log("initilizing begin..");
const workflows = await getAllWorkflows(); const workflows = await getAllWorkflows({
id:{
[Op.gt] : 0
}
});
if(workflows.length==0) throw "There is not any workflow"; if(workflows.length==0) throw "There is not any workflow";
const allWorkflowInfo = {};
workflowsFor:
for await(const workflow of workflows){
if(+workflow.id < 0) continue;
const processes = await getAllProcesses(workflow);
if(processes.length == 0){
allWorkflowInfo[workflow.id] = {
isValid:false,
root:{
valid: 0,
invalid: 0,
subFlowList: []
},
subFlow:{}
}
continue workflowsFor;
}
}
console.timeEnd("WorkflowTester") console.timeEnd("WorkflowTester")
console.log("DONE"); console.log("DONE");

@ -0,0 +1,25 @@
const getAllProcesses = async (workflow,query = {}) => {
const processes = await bpmsDB.bpms_process.findAll({
where: {
workflowId: workflow.id,
subFlowId: null,
...query
// type:{
// [Op.in]:[0,1]
// }
},
order: [
['id', 'ASC']
],
attributes: [
"id", "pid", "link", "type", "name", "conditions", "subFlowPid", "subFlowId"
],
raw: true
});
return processes;
}
module.exports = {
getAllProcesses,
}
Loading…
Cancel
Save