zet-lib 1.2.28 → 1.2.30

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/index.js CHANGED
@@ -29,4 +29,6 @@ module.exports = {
29
29
  ejs: require('ejs'),
30
30
  axios: require('axios'),
31
31
  Excel: require('exceljs'),
32
+ pm2: require('pm2'),
33
+ nodemailer: require('nodemailer'),
32
34
  }
package/lib/zRoute.js CHANGED
@@ -3704,7 +3704,7 @@ zRoute.modelsCache = async () => {
3704
3704
  obj[table] = {}
3705
3705
  }
3706
3706
  if (!Util.in_array(key, nots)) {
3707
- obj[table][`${keys}___${key}`] = `${widgets[key].fields[1]} as ${key}`
3707
+ obj[table][`${keys}___${key}`] = `${widgets[key].fields[1]} as ${key}_${models[keys].table}`
3708
3708
  if (Object.prototype.hasOwnProperty.call(models[keys].widgets, key)) {
3709
3709
  if (Object.prototype.hasOwnProperty.call(models[keys].widgets[key], 'order_by')) {
3710
3710
  if (models[keys].widgets[key].order_by) {
@@ -3757,12 +3757,17 @@ zRoute.modelsCache = async () => {
3757
3757
  let item = splits.length > 1 ? splits[1] : key
3758
3758
  let arr = []
3759
3759
  for (const result of results) {
3760
- arr.push({ id: result.id, zname: result[item] })
3760
+ if (result[`${item}_${splits[0]}`]) {
3761
+ arr.push({ id: result.id, zname: result[`${item}_${splits[0]}`] })
3762
+ } else {
3763
+ arr.push({ id: result.id, zname: result[item] })
3764
+ }
3761
3765
  }
3762
3766
  if (orderBy[keys]) {
3763
3767
  myCache.set(`${keys}_${key}_${company.id}`, arr)
3764
3768
  } else {
3765
3769
  const myarray = Util.sortArray(arr, 'zname')
3770
+ //console.log(`${keys}_${key}_${company.id}`)
3766
3771
  myCache.set(`${keys}_${key}_${company.id}`, myarray)
3767
3772
  }
3768
3773
  }
@@ -3808,7 +3813,11 @@ zRoute.modelsCacheRenew = (table, companyId) => {
3808
3813
  let item = splits.length > 1 ? splits[1] : key
3809
3814
  let arr = []
3810
3815
  for (const result of results) {
3811
- arr.push({ id: result.id, zname: result[item] })
3816
+ if (result[`${item}_${splits[0]}`]) {
3817
+ arr.push({ id: result.id, zname: result[`${item}_${splits[0]}`] })
3818
+ } else {
3819
+ arr.push({ id: result.id, zname: result[item] })
3820
+ }
3812
3821
  }
3813
3822
  if (orderBy[table]) {
3814
3823
  myCache.set(`${table}_${key}_${companyId}`, arr)
@@ -3825,7 +3834,6 @@ zRoute.modelsCacheRenew = (table, companyId) => {
3825
3834
  console.log(err)
3826
3835
  }
3827
3836
  }
3828
-
3829
3837
  zRoute.makeFunctionsSystem = () => {
3830
3838
  try {
3831
3839
  let obj = myCache.get('ZFUNCTIONS')
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zet-lib",
3
- "version": "1.2.28",
3
+ "version": "1.2.30",
4
4
  "description": "zet is a library that part of zet generator.",
5
5
  "engines": {
6
6
  "node": ">=18"
@@ -40,7 +40,7 @@
40
40
  "node-cache": "^5.1.2",
41
41
  "nodemailer": "^6.9.4",
42
42
  "pg": "^8.11.2",
43
- "pm2": "^5.3.0",
43
+ "pm2": "^5.3.1",
44
44
  "postgres-pool": "^8.1.4",
45
45
  "puppeteer": "^21.0.1",
46
46
  "qs": "^6.11.2",