diff --git a/process.js b/process.js index 639660b..9e45037 100644 --- a/process.js +++ b/process.js @@ -1,3 +1,5 @@ +const { convertStringToJson } = require("./util"); + const getAllProcesses = async (workflow,query = {}) => { const processes = await bpmsDB.bpms_process.findAll({ where: { diff --git a/util.js b/util.js index e40cf42..9e81820 100644 --- a/util.js +++ b/util.js @@ -4,6 +4,15 @@ const sleep = (ms)=>{ setTimeout(resolve,ms); }) } +function convertStringToJson(string) { + try { + return JSON.parse(string); + } catch (error) { + console.log(error); + return {}; + } +} module.exports={ - sleep + sleep, + convertStringToJson } \ No newline at end of file