zet-lib 1.2.73 → 1.2.74

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/Form.js CHANGED
@@ -153,7 +153,7 @@ Form.field = (obj) => {
153
153
  let stringvalue = value ? value.substring(13) : ''
154
154
  let trashicon = stringvalue ? `<img class="tabler-icons icons-filter-danger" src="/assets/icons/trash-filled.svg" onclick="removeimage(this)">` : ''
155
155
  displayForm = `${prepend}<input ${tabindex} type="file" accept="image/*" onchange="loadFile(this,'${obj.id}' )" data-width="${obj.width}" class="form-control ${obj.class || ''}" ${id} ${name} ${placeholder} value="${value}" ${htmlOptions}>
156
- <div id="body${obj.id}" class="isfile" data-id="${obj.id}" data-table="${obj.routeName}" data-width="${obj.width}" data-name="${obj.title}" data-filename="${value}" data-required="${obj.required}"> <img class="mb-3" id="file${obj.id}" /><br><a class="text-success" target="_blank" href="/uploads/${
156
+ <div id="body${obj.id}" class="isfile" data-id="${obj.id}" data-table="${obj.routeName}" data-width="${obj.width}" data-name="${obj.title}" data-filename="${value}" data-required="${obj.required}"> <img class="mb-3" width="${obj.width}" id="file${obj.id}" /><br><a class="text-success" target="_blank" href="/uploads/${
157
157
  obj.routeName
158
158
  }/${value}"> ${stringvalue}</a> ${trashicon}</div>${append}`
159
159
  break
package/lib/zRoute.js CHANGED
@@ -1228,11 +1228,11 @@ zRoute.selectAllowedField = (req, res, MYMODEL, arr = []) => {
1228
1228
  }
1229
1229
 
1230
1230
  zRoute.excelQuery = async (req, res, MYMODEL, paramsObject = {}) => {
1231
- const cacheRole = myCache.get("ROLES")[res.locals.roleId].params;
1231
+ const cacheRole = myCache.get('ROLES')[res.locals.roleId].params
1232
1232
  const levels = cacheRole[MYMODEL.table] || []
1233
- if(!levels.includes("export")) {
1234
- res.json("no access")
1235
- return false;
1233
+ if (!levels.includes('export')) {
1234
+ res.json('no access')
1235
+ return false
1236
1236
  }
1237
1237
 
1238
1238
  let virtuals = []
@@ -1355,11 +1355,11 @@ zRoute.excelQuery = async (req, res, MYMODEL, paramsObject = {}) => {
1355
1355
 
1356
1356
  // for excels
1357
1357
  zRoute.excel = async (req, res, MYMODEL, fields, rows, callback, fileName) => {
1358
- const cacheRole = myCache.get("ROLES")[res.locals.roleId].params;
1358
+ const cacheRole = myCache.get('ROLES')[res.locals.roleId].params
1359
1359
  const levels = cacheRole[MYMODEL.table] || []
1360
- if(!levels.includes("export")) {
1361
- res.json("no access")
1362
- return false;
1360
+ if (!levels.includes('export')) {
1361
+ res.json('no access')
1362
+ return false
1363
1363
  }
1364
1364
 
1365
1365
  //if any other custom value then callback needed
@@ -2602,7 +2602,7 @@ zRoute.viewForm = (req, res, MYMODEL, relations, data = {}, MODEL_TABLE = {}) =>
2602
2602
  obj[key].type = 'plaintext'
2603
2603
  let width = widgets[key].width || '300'
2604
2604
  if (isTableType) {
2605
- obj[key].value = Util.fileView(`/uploads/${MODEL_TABLE.routeName}/${MYMODEL.routeName}/`, data[key], {
2605
+ obj[key].value = Util.fileView(`/uploads/${MODEL_TABLE.routeName}/${key}/`, data[key], {
2606
2606
  width: width,
2607
2607
  class: 'boxy',
2608
2608
  })
@@ -2618,7 +2618,7 @@ zRoute.viewForm = (req, res, MYMODEL, relations, data = {}, MODEL_TABLE = {}) =>
2618
2618
  case 'file':
2619
2619
  obj[key].type = 'plaintext'
2620
2620
  if (isTableType) {
2621
- obj[key].value = Util.fileView(`/uploads/${MODEL_TABLE.routeName}/${MYMODEL.routeName}/`, data[key], { withIcon: true })
2621
+ obj[key].value = Util.fileView(`/uploads/${MODEL_TABLE.routeName}/${key}/`, data[key], { withIcon: true })
2622
2622
  } else {
2623
2623
  obj[key].value = '<br><br>' + Util.fileView(`/uploads/${MYMODEL.routeName}/`, data[key], { withIcon: true })
2624
2624
  }
@@ -3560,11 +3560,11 @@ zRoute.deleteSQL = async (table, id, company_id) => {
3560
3560
 
3561
3561
  //for import
3562
3562
  zRoute.import = async (req, res, MYMODEL) => {
3563
- const cacheRole = myCache.get("ROLES")[res.locals.roleId].params;
3563
+ const cacheRole = myCache.get('ROLES')[res.locals.roleId].params
3564
3564
  const levels = cacheRole[MYMODEL.table] || []
3565
- if(!levels.includes("export")) {
3566
- res.json("no access")
3567
- return false;
3565
+ if (!levels.includes('export')) {
3566
+ res.json('no access')
3567
+ return false
3568
3568
  }
3569
3569
 
3570
3570
  const userId = res.locals.userId
@@ -3757,7 +3757,7 @@ zRoute.buildForm = async (req, res) => {
3757
3757
  let increment = req.body.increment
3758
3758
  let table = req.body.table
3759
3759
  let keys = req.body.keys
3760
- let relations = JSON.parse(req.body.relations)
3760
+ let relations = JSON.parse(req.body.relations) || {}
3761
3761
  let MYMODEL = MYMODELS[table] || require(`${dirRoot}/models/${table}`)
3762
3762
  let MODEL_TABLE = MYMODELS[MYMODEL.widgets[keys].table] || require(`${dirRoot}/models/${MYMODEL.widgets[keys].table}`)
3763
3763
  let MODEL_TABLE_RELATIONS = await zRoute.relations(req, res, MODEL_TABLE.table)
@@ -4094,7 +4094,7 @@ module.exports = (req, res, next) => {`
4094
4094
  setTimeout(function () {
4095
4095
  pm2.connect(function (err) {
4096
4096
  if (err) {
4097
- console.log(err.toString())
4097
+ console.log(err + '')
4098
4098
  }
4099
4099
  pm2.restart(process.env.PM2_NAME, (err, proc) => {
4100
4100
  //io.to(room).emit("message","Restart done")
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zet-lib",
3
- "version": "1.2.73",
3
+ "version": "1.2.74",
4
4
  "description": "zet is a library that part of zet generator.",
5
5
  "engines": {
6
6
  "node": ">=18"
@@ -41,7 +41,7 @@
41
41
  "nodemailer": "^6.9.4",
42
42
  "pg": "^8.11.2",
43
43
  "pm2": "^5.3.1",
44
- "postgres-pool": "^8.1.4",
44
+ "postgres-pool": "^8.1.6",
45
45
  "puppeteer": "^21.0.1",
46
46
  "qs": "^6.11.2",
47
47
  "randomstring": "^1.3.0",