zet-lib 3.0.9 → 3.1.0

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.
Files changed (2) hide show
  1. package/lib/zMenuRouter.js +21 -0
  2. package/package.json +1 -1
@@ -44,6 +44,27 @@ router.get('/', async function (req, res, next) {
44
44
  company_id : companyId
45
45
  }
46
46
  });
47
+ if(rows.length == 0){
48
+ //copy from companyId;
49
+ let copyMenu = await connection.result({
50
+ table : "zmenu",
51
+ where : {
52
+ company_id : 1
53
+ }
54
+ })
55
+ if(copyMenu){
56
+ copyMenu.updated_by = res.locals.userId;
57
+ copyMenu.created_by = res.locals.userId;
58
+ copyMenu.created_at = Util.now();
59
+ copyMenu.updated_at = Util.now();
60
+ copyMenu.company_id = companyId;
61
+ delete copyMenu.id;
62
+ await connection.insert({
63
+ table : "zmenu",
64
+ data : copyMenu
65
+ });
66
+ }
67
+ }
47
68
  if (rows.length > 0) {
48
69
  hasAccessMenu = true;
49
70
  //check id changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zet-lib",
3
- "version": "3.0.9",
3
+ "version": "3.1.0",
4
4
  "description": "zet is a library that part of zet generator.",
5
5
  "engines": {
6
6
  "node": ">=18"