zet-lib 3.2.3 → 3.3.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.
package/lib/Form.js CHANGED
@@ -4,6 +4,7 @@
4
4
  */
5
5
 
6
6
  const Util = require("./Util");
7
+ const path = require('path');
7
8
 
8
9
  const Form = {};
9
10
  // Menghitung jumlah tanda "[" dalam str
@@ -550,7 +551,12 @@ Form.field = (obj) => {
550
551
  break;
551
552
 
552
553
  case "html":
553
- displayForm = obj.code;
554
+ let obj_code = typeof obj.code === 'string' ? obj.code : '';
555
+ if (!obj_code && obj.code) {
556
+ const dir = path.join(dirRoot,'public','runtime','html',obj.routeName,obj.id+'.txt')
557
+ obj_code = Util.readFile(dir);
558
+ }
559
+ displayForm = obj_code;
554
560
  break;
555
561
 
556
562
  case "location":
@@ -1038,7 +1044,7 @@ Form.build = (obj) => {
1038
1044
  }
1039
1045
 
1040
1046
  if(obj.type == "html") {
1041
- html = obj.code;
1047
+ html = Form.field(obj)
1042
1048
  }
1043
1049
  return html;
1044
1050
  };
package/lib/Mail.js CHANGED
@@ -1,4 +1,5 @@
1
1
  require("dotenv").config();
2
+ const path = require('path');
2
3
  const nodemailer = require('nodemailer')
3
4
  const ejs = require('ejs')
4
5
  const Util = require('./Util')
@@ -47,7 +48,7 @@ MAIL.send = function (options = {}, transporter = null) {
47
48
  }
48
49
 
49
50
  MAIL.forgotPassword = (datas = {}, options = {}) => {
50
- ejs.renderFile(`${dirRoot}/views/layouts/email/forgot_password.ejs`, { data: datas, Util: Util }, function (err, data) {
51
+ ejs.renderFile(path.join(dirRoot, 'views', 'layouts', 'email', 'forgot_password.ejs'), { data: datas, Util: Util }, function (err, data) {
51
52
  let option = Object.assign(mailOptions, options)
52
53
  option.html = data
53
54
  if (err) {
@@ -59,7 +60,7 @@ MAIL.forgotPassword = (datas = {}, options = {}) => {
59
60
  }
60
61
 
61
62
  MAIL.register = (datas = {}, options = {}) => {
62
- ejs.renderFile(`${dirRoot}/views/layouts/email/register.ejs`, { data: datas, Util: Util }, function (err, data) {
63
+ ejs.renderFile(path.join(dirRoot, 'views', 'layouts', 'email', 'register.ejs'), { data: datas, Util: Util }, function (err, data) {
63
64
  let option = Object.assign(mailOptions, options)
64
65
  option.html = data
65
66
  if (err) {
@@ -88,7 +89,7 @@ MAIL.approval = (req, res, data, email) => {
88
89
  });
89
90
 
90
91
  ejs.renderFile(
91
- dirRoot + "/views/layouts/email/approval.ejs",
92
+ path.join(dirRoot, 'views', 'layouts', 'email', 'approval.ejs'),
92
93
  { data: data, Util: Util },
93
94
  function (err, html) {
94
95
  if (err) {
package/lib/Model.js CHANGED
@@ -2387,14 +2387,15 @@ Model.relation = {
2387
2387
  "where",
2388
2388
  "please_select",
2389
2389
  "isChain",
2390
- "isAttributes",
2390
+ "onChange",
2391
2391
  "information",
2392
2392
  "defaultValue",
2393
2393
  "hidden",
2394
2394
  "isSearch",
2395
2395
  "order_by",
2396
2396
  "import_field",
2397
- "relation_info"
2397
+ "relation_info",
2398
+ "isAttributes",
2398
2399
  ],
2399
2400
  labels: {
2400
2401
  required: "Required",
@@ -2405,7 +2406,7 @@ Model.relation = {
2405
2406
  concat: "Concat",
2406
2407
  where: "Where SQL",
2407
2408
  isChain: "is Chain",
2408
- isAttributes: "With Attributes",
2409
+ onChange: "On Change (return data)",
2409
2410
  information: "Additional Information",
2410
2411
  please_select: "Please Select (Labeling)",
2411
2412
  defaultValue: "Default Value",
@@ -2413,7 +2414,8 @@ Model.relation = {
2413
2414
  isSearch:"Auto complete Search",
2414
2415
  order_by : "Order By",
2415
2416
  import_field :"Default Import Field (id)",
2416
- relation_info : "Relation Data"
2417
+ relation_info : "Relation Data",
2418
+ isAttributes:"Show all attributes data",
2417
2419
  },
2418
2420
  defaultValues: {
2419
2421
  required: false,
@@ -2423,8 +2425,9 @@ Model.relation = {
2423
2425
  name: "username",
2424
2426
  concat: "CONCAT(fullname, ' ',email)",
2425
2427
  where:"",
2428
+ isAttributes:false,
2426
2429
  isChain: false,
2427
- isAttributes: false,
2430
+ onChange: "",
2428
2431
  information: "",
2429
2432
  please_select: "",
2430
2433
  defaultValue: null,
@@ -2463,14 +2466,17 @@ Model.relation = {
2463
2466
  tag: "input",
2464
2467
  type: "text",
2465
2468
  },
2466
- isChain: {
2469
+ isAttributes: {
2467
2470
  tag: "input",
2468
2471
  type: "checkbox",
2469
2472
  },
2470
- isAttributes: {
2473
+ isChain: {
2471
2474
  tag: "input",
2472
2475
  type: "checkbox",
2473
2476
  },
2477
+ onChange: {
2478
+ tag: "textarea",
2479
+ },
2474
2480
  information: {
2475
2481
  tag: "input",
2476
2482
  type: "text",
@@ -34,7 +34,7 @@ generatorApp.CREATE_MODEL_API = async (columns, constraintList, MYMODEL) => {
34
34
  generatorApp.CREATE_ROUTER = async (MYMODEL, zFields) => {
35
35
  let CONTENT =
36
36
  zFields.router ||
37
- fs.readFileSync(generatorApp.DIRECTORY + "/routerApp.ejs", "utf-8");
37
+ fs.readFileSync(path.join(generatorApp.DIRECTORY, "routerApp.ejs"), "utf-8");
38
38
  const zfields = await connection.result({
39
39
  table: "zfields",
40
40
  where: { table: MYMODEL.table },
@@ -58,7 +58,7 @@ generatorApp.CREATE_ROUTER = async (MYMODEL, zFields) => {
58
58
  }
59
59
 
60
60
  fs.writeFileSync(
61
- generatorApp.DIRECTORY_ROUTES + "/" + MYMODEL.table + ".js",
61
+ path.join(generatorApp.DIRECTORY_ROUTES, MYMODEL.table + ".js"),
62
62
  CONTENT,
63
63
  "utf-8"
64
64
  );
@@ -67,7 +67,7 @@ generatorApp.CREATE_ROUTER = async (MYMODEL, zFields) => {
67
67
  generatorApp.CREATE_ROUTER_API = (MYMODEL, zfields) => {
68
68
  let CONTENT =
69
69
  zfields.router ||
70
- fs.readFileSync(generatorApp.DIRECTORY + "/routerApp.ejs", "utf-8");
70
+ fs.readFileSync(path.join(generatorApp.DIRECTORY, "routerApp.ejs"), "utf-8");
71
71
  //var zfields = await connection.result({table: "zfields", where: {table: MYMODEL.table}});
72
72
  const ADDITIONAL_FIELDS = generatorApp.ADDITIONAL_FIELDS(MYMODEL);
73
73
  const OBJ = {
@@ -86,7 +86,7 @@ generatorApp.CREATE_ROUTER_API = (MYMODEL, zfields) => {
86
86
  for (let KEY in OBJ) {
87
87
  CONTENT = Util.replaceAll(CONTENT, "[[[" + KEY + "]]]", OBJ[KEY]);
88
88
  }
89
- //fs.writeFileSync(generatorApp.DIRECTORY_ROUTES + "/" + MYMODEL.table + ".js", CONTENT, 'utf-8');
89
+ //fs.writeFileSync(path.join(generatorApp.DIRECTORY_ROUTES, MYMODEL.table + ".js"), CONTENT, 'utf-8');
90
90
  return {
91
91
  filename: MYMODEL.table + ".js",
92
92
  content: CONTENT,
@@ -123,7 +123,7 @@ generatorApp.CREATE_VIEWS = async (MYMODEL, zFields) => {
123
123
  "[[[GENERATE_VIEW]]]": GENERATE_VIEW,
124
124
  };
125
125
 
126
- const DIR_VIEW = generatorApp.DIRECTORY_VIEWS + "/" + MYMODEL.table;
126
+ const DIR_VIEW = path.join(generatorApp.DIRECTORY_VIEWS, MYMODEL.table);
127
127
  if (!fs.existsSync(DIR_VIEW)) {
128
128
  fs.mkdirSync(DIR_VIEW);
129
129
  }
@@ -133,16 +133,16 @@ generatorApp.CREATE_VIEWS = async (MYMODEL, zFields) => {
133
133
  name = name.replace(".", "_");
134
134
  let source = zFields[name];
135
135
  if (source) {
136
- fs.writeFileSync(DIR_VIEW + "/" + item, source);
136
+ fs.writeFileSync(path.join(DIR_VIEW, item), source);
137
137
  } else {
138
- source = generatorApp.DIRECTORY_GENERATOR_VIEWS + "/" + item;
139
- fs.copySync(source, DIR_VIEW + "/" + item);
138
+ source = path.join(generatorApp.DIRECTORY_GENERATOR_VIEWS, item);
139
+ fs.copySync(source, path.join(DIR_VIEW, item));
140
140
  }
141
- console.log(DIR_VIEW + "/" + item);
141
+ console.log(path.join(DIR_VIEW, item));
142
142
  for (let KEY in OBJ) {
143
143
  generatorApp.MODIFIY(
144
- DIR_VIEW + "/" + item,
145
- DIR_VIEW + "/" + item,
144
+ path.join(DIR_VIEW, item),
145
+ path.join(DIR_VIEW, item),
146
146
  KEY,
147
147
  OBJ[KEY]
148
148
  );
@@ -183,7 +183,7 @@ generatorApp.CREATE_VIEWS_API = (MYMODEL, zFields) => {
183
183
  "[[[GENERATE_VIEW]]]": GENERATE_VIEW,
184
184
  };
185
185
 
186
- const DIR_VIEW = `${dirRoot}/public/temp/${token}`;
186
+ const DIR_VIEW = path.join(dirRoot, "public", "temp", token);
187
187
  if (!fs.existsSync(DIR_VIEW)) {
188
188
  fs.mkdirSync(DIR_VIEW);
189
189
  }
@@ -194,23 +194,23 @@ generatorApp.CREATE_VIEWS_API = (MYMODEL, zFields) => {
194
194
  name = name.replace(".", "_");
195
195
  let source = zFields.hasOwnProperty(name)
196
196
  ? zFields[name]
197
- : fs.readFileSync(generatorApp.DIRECTORY_GENERATOR_VIEWS + "/" + item, {
197
+ : fs.readFileSync(path.join(generatorApp.DIRECTORY_GENERATOR_VIEWS, item), {
198
198
  encoding: "utf8",
199
199
  flag: "r",
200
200
  });
201
201
  if (source) {
202
- fs.writeFileSync(DIR_VIEW + "/" + item, source);
202
+ fs.writeFileSync(path.join(DIR_VIEW, item), source);
203
203
  } else {
204
204
  source = fs.readFileSync(
205
- generatorApp.DIRECTORY_GENERATOR_VIEWS + "/" + item,
205
+ path.join(generatorApp.DIRECTORY_GENERATOR_VIEWS, item),
206
206
  { encoding: "utf8", flag: "r" }
207
207
  );
208
- fs.copySync(source, DIR_VIEW + "/" + item);
208
+ fs.copySync(source, path.join(DIR_VIEW, item));
209
209
  }
210
210
  for (let KEY in OBJ) {
211
211
  generatorApp.MODIFIY(
212
- DIR_VIEW + "/" + item,
213
- DIR_VIEW + "/" + item,
212
+ path.join(DIR_VIEW, item),
213
+ path.join(DIR_VIEW, item),
214
214
  KEY,
215
215
  OBJ[KEY]
216
216
  );
@@ -218,7 +218,7 @@ generatorApp.CREATE_VIEWS_API = (MYMODEL, zFields) => {
218
218
  }
219
219
  for (let i = 0; i < views.length; i++) {
220
220
  const item = views[i];
221
- datas[item] = fs.readFileSync(`${DIR_VIEW}/${item}`, {
221
+ datas[item] = fs.readFileSync(path.join(DIR_VIEW, item), {
222
222
  encoding: "utf8",
223
223
  flag: "r",
224
224
  });
@@ -1,6 +1,7 @@
1
1
  /**
2
2
  * Created by sintret dev on 10/1/2021.
3
3
  */
4
+ const path = require("path");
4
5
  const configGenerator = require("./config_generator");
5
6
  const Model = require("./Model");
6
7
  const fs = require("fs-extra");
@@ -277,23 +278,22 @@ me.prepare = (MYMODEL) => {
277
278
  };
278
279
 
279
280
  widgets[key].hasInputGroup = false;
280
- if (
281
- Object.prototype.hasOwnProperty.call(property.values, "inputGroupLeft") &&
282
- property.values.inputGroupLeft
283
- ) {
281
+ if (Object.prototype.hasOwnProperty.call(property.values, "inputGroupLeft") && property.values.inputGroupLeft) {
284
282
  widgets[key].inputGroupLeft = property.values.inputGroupLeft;
285
283
  widgets[key].hasInputGroup = true;
286
284
  }
287
- if (
288
- Object.prototype.hasOwnProperty.call(
289
- property.values,
290
- "inputGroupRight"
291
- ) &&
292
- property.values.inputGroupRight
293
- ) {
285
+ if (Object.prototype.hasOwnProperty.call(property.values,"inputGroupRight") && property.values.inputGroupRight) {
294
286
  widgets[key].inputGroupRight = property.values.inputGroupRight;
295
287
  widgets[key].hasInputGroup = true;
296
288
  }
289
+ widgets[key].isAttributes = false;
290
+ if (Object.prototype.hasOwnProperty.call(property.values,"isAttributes") && property.values.isAttributes) {
291
+ widgets[key].isAttributes = true;
292
+ }
293
+ widgets[key].onChange = false;
294
+ if (Object.prototype.hasOwnProperty.call(property.values,"onChange") && property.values.onChange.length > 4) {
295
+ widgets[key].onChange = true;
296
+ }
297
297
 
298
298
  if (property.values.information) {
299
299
  widgets[key].information = JSON.stringify(property.values.information);
@@ -335,7 +335,6 @@ me.prepare = (MYMODEL) => {
335
335
  }
336
336
  if (Object.prototype.hasOwnProperty.call(property.values, "where")) {
337
337
  widgets[key].where = property.values.where || "";
338
- console.log(widgets[key].where)
339
338
  }
340
339
 
341
340
  switch (type) {
@@ -399,12 +398,21 @@ me.prepare = (MYMODEL) => {
399
398
  widgets[key].relation_info = property.values.relation_info ? true : false;
400
399
  if(widgets[key].relation_info) {
401
400
  //create file info to runtime
402
- let dirInfo = `${dirRoot}/public/runtime/info/${MYMODEL.table}`
403
- //Util.writeFile(`${dirRoot}/runtime/info/${MYMODEL.tab}`)
401
+ let dirInfo = path.join(dirRoot, "public", "runtime", "info", MYMODEL.table);
402
+ //Util.writeFile(path.join(dirRoot, "runtime", "info", MYMODEL.tab))
403
+ if(!fs.existsSync(dirInfo)) {
404
+ fs.mkdirSync(dirInfo, { recursive: true });
405
+ }
406
+ fs.writeFileSync(path.join(dirInfo, key + ".txt"), property.values.relation_info);
407
+ }
408
+ if(widgets[key].onChange) {
409
+ //create file info to runtime
410
+ let dirInfo = path.join(dirRoot, "public", "runtime", "onchange", MYMODEL.table);
411
+ //Util.writeFile(path.join(dirRoot, "runtime", "info", MYMODEL.tab))
404
412
  if(!fs.existsSync(dirInfo)) {
405
413
  fs.mkdirSync(dirInfo, { recursive: true });
406
414
  }
407
- fs.writeFileSync(`${dirInfo}/${key}.txt`, property.values.relation_info);
415
+ fs.writeFileSync(path.join(dirInfo, key + ".txt"), property.values.onChange);
408
416
  }
409
417
  break;
410
418
  case "dragdrop":
@@ -464,7 +472,16 @@ me.prepare = (MYMODEL) => {
464
472
  : property.values.height;
465
473
  break;
466
474
  case "html":
467
- widgets[key].code = property.values.code || "";
475
+ widgets[key].code = property.values.code ? true : false;
476
+ if(widgets[key].code) {
477
+ //create file info to runtime
478
+ let dirInfo = path.join(dirRoot, "public", "runtime", "html", MYMODEL.table);
479
+ //Util.writeFile(path.join(dirRoot, "runtime", "info", MYMODEL.tab))
480
+ if(!fs.existsSync(dirInfo)) {
481
+ fs.mkdirSync(dirInfo, { recursive: true });
482
+ }
483
+ fs.writeFileSync(path.join(dirInfo, key + ".txt"), property.values.code);
484
+ }
468
485
  break;
469
486
 
470
487
  case "money":
@@ -516,7 +533,7 @@ me.create = async (ZFIELDS) => {
516
533
  const JSON_MODEL = me.prepare(ZFIELDS);
517
534
  jsonText += me.build(JSON_MODEL);
518
535
  jsonText += `}`;
519
- const filename = `${dirRoot}/models/${ZFIELDS.table}.js`;
536
+ const filename = path.join(dirRoot, "models", ZFIELDS.table + ".js");
520
537
  fs.writeFile(filename, jsonText, function (err) {
521
538
  if (err) {
522
539
  return console.log(err.toString());
package/lib/io.js CHANGED
@@ -1,6 +1,5 @@
1
1
  const { Server } = require('socket.io');
2
- const io = new Server(); // TANPA listen/attach di sini
3
- //room = token
2
+ const io = new Server();
4
3
  let socketArray = [];
5
4
 
6
5
  io.on('connection', function (socket) {
@@ -11,26 +10,15 @@ io.on('connection', function (socket) {
11
10
  socket.handshake.session.user = {
12
11
  username: 'OSK'
13
12
  };
14
- //console.log('socket.handshake session data is %j.', socket.handshake.session);
15
-
16
- // socket.handshake.session.save();
17
- //emit logged_in for debugging purposes of this example
18
13
  socket.emit('logged_in', socket.handshake.session);
19
14
  });
20
15
  // Unset session data via socket
21
16
  socket.on('checksession', function() {
22
- // console.log('Received checksession message');
23
- // console.log('socket.handshake session data is %j.', socket.handshake.session);
24
17
  socket.emit('checksession', socket.handshake.session);
25
18
  });
26
- // Unset session data via socket
27
19
  socket.on('logout', function() {
28
20
  console.log('Received logout message');
29
21
  delete socket.handshake.session.user;
30
- // socket.handshake.session.save();
31
- //emit logged_out for debugging purposes of this example
32
- //console.log('socket.handshake session data is %j.', socket.handshake.session);
33
-
34
22
  socket.emit('logged_out', socket.handshake.session);
35
23
  });
36
24
 
package/lib/zAppRouter.js CHANGED
@@ -161,7 +161,7 @@ router.post("/profile-sign", access, async (req, res) => {
161
161
  },
162
162
  });
163
163
  fs.writeFile(
164
- dirRoot + "/public/uploads/zuser/" + filename,
164
+ path.join(dirRoot, "public", "uploads", "zuser", filename),
165
165
  base64Image,
166
166
  { encoding: "base64" },
167
167
  function (err) {}
@@ -1337,8 +1337,8 @@ router.post('/get_approval_comments', async(req,res) => {
1337
1337
 
1338
1338
  router.get("/zdownload/zgenerator/:table", async (req, res) => {
1339
1339
  var table = req.params.table;
1340
- var path = `${dirRoot}/public/uploads/zgenerator/${table}.json`;
1341
- res.download(path, function (err) {
1340
+ var filePath = path.join(dirRoot, "public", "uploads", "zgenerator", table + ".json");
1341
+ res.download(filePath, function (err) {
1342
1342
  if (err) {
1343
1343
  //console.log(err);
1344
1344
  }
@@ -1592,12 +1592,12 @@ router.post("/zdropzone", async (req, res) => {
1592
1592
  try {
1593
1593
  let userId = res.locals.userId;
1594
1594
  if (userId) {
1595
- let dir = `${dirRoot}/public/zdropzone/${userId}`;
1595
+ let dir = path.join(dirRoot, "public", "zdropzone", userId);
1596
1596
  if (!fs.existsSync(dir)) {
1597
1597
  fs.mkdirSync(dir, { recursive: true });
1598
1598
  }
1599
1599
  let filename = req.files.file.name;
1600
- req.files.file.mv(dir + "/" + filename, function (err) {
1600
+ req.files.file.mv(path.join(dir, filename), function (err) {
1601
1601
  if (err) {
1602
1602
  return res.status(500).send(err + "");
1603
1603
  }
@@ -1615,11 +1615,11 @@ router.post("/zdropzone-remove", async (req, res) => {
1615
1615
  try {
1616
1616
  let userId = res.locals.userId;
1617
1617
  let cacheName = req.body.cname.replace("ZUSER___ID", userId);
1618
- let dir = `${dirRoot}/public/zdropzone/${userId}`;
1618
+ let dir = path.join(dirRoot, "public", "zdropzone", userId);
1619
1619
  if (!fs.existsSync(dir)) {
1620
1620
  fs.mkdirSync(dir, { recursive: true });
1621
1621
  }
1622
- let filename = `${dirRoot}/public/zdropzone/${userId}/${req.body.file}`;
1622
+ let filename = path.join(dirRoot, "public", "zdropzone", userId, req.body.file);
1623
1623
  let arr = [];
1624
1624
  if (Util.fileExist(filename)) {
1625
1625
  await fs.unlink(filename);
@@ -1639,7 +1639,7 @@ router.post("/zdropzone-remove", async (req, res) => {
1639
1639
  router.post("/zdropzone-attributes", async (req, res) => {
1640
1640
  try {
1641
1641
  let userId = res.locals.userId;
1642
- let dir = `${dirRoot}/public/zdropzone/${userId}`;
1642
+ let dir = path.join(dirRoot, "public", "zdropzone", userId);
1643
1643
  if (!fs.existsSync(dir)) {
1644
1644
  fs.mkdirSync(dir, { recursive: true });
1645
1645
  }
@@ -1726,13 +1726,14 @@ router.get("/zdownloads-dropzone/:table/:field/:id", async (req, res) => {
1726
1726
  id: id,
1727
1727
  },
1728
1728
  });
1729
- let dir = `${dirRoot}/public/uploads/${table}/${field}/`;
1729
+ let dir = path.join(dirRoot, "public", "uploads", table, field);
1730
1730
  let arr = [];
1731
1731
  let files = result[field];
1732
1732
  for (const file of files) {
1733
- if (Util.fileExist(dir + file)) {
1733
+ let fullPath = path.join(dir, file);
1734
+ if (Util.fileExist(fullPath)) {
1734
1735
  let filename = file.substring(13);
1735
- arr.push({ path: dir + file, name: filename });
1736
+ arr.push({ path: fullPath, name: filename });
1736
1737
  //io.to(room).emit('message', `Zip file ${filename}`)
1737
1738
  }
1738
1739
  }
@@ -1792,14 +1793,14 @@ router.post("/zcompress-dropzone", async (req, res) => {
1792
1793
  if (!fs.existsSync(tempDir)) {
1793
1794
  fs.mkdirSync(tempDir);
1794
1795
  }
1795
- //let dir = `${dirRoot}/public/uploads/${table}/${field}/`;
1796
+ //let dir = path.join(dirRoot, "public", "uploads", table, field);
1796
1797
  let arr = [];
1797
1798
  let files = result[field];
1798
1799
  const count = files.length;
1799
1800
  let i = 0;
1800
1801
  for (const file of files) {
1801
1802
  let filename = file.substring(13);
1802
- let attributes = Util.fileAttribute(dir + file);
1803
+ let attributes = Util.fileAttribute(path.join(dir, file));
1803
1804
  if (attributes.type == "image") {
1804
1805
  const filePath = path.join(dir, file);
1805
1806
  const tempPath = path.join(tempDir, file);
@@ -2098,7 +2099,7 @@ router.get("/zdownloads-dropbox/:table/:field/:id", async (req, res) => {
2098
2099
  id: id,
2099
2100
  },
2100
2101
  });
2101
- let dir = `${dirRoot}/public/uploads/${table}/${field}/`;
2102
+ let dir = path.join(dirRoot, "public", "uploads", table, field);
2102
2103
  let arr = [];
2103
2104
  let files = result[field];
2104
2105
  const jsZip = new JSZip();
@@ -2273,7 +2274,7 @@ router.post('/zcall-information_info', async(req,res) => {
2273
2274
  let data = ''
2274
2275
  try {
2275
2276
  const {table, elementId, myvalue} = req.body;
2276
- let content = Util.readFile(`${dirRoot}/public/runtime/info/${table}/${elementId}.txt`)
2277
+ let content = Util.readFile(path.join(dirRoot, "public", "runtime", "info", table, elementId + ".txt"))
2277
2278
  data = content;
2278
2279
 
2279
2280
  // Fungsi untuk mengekstrak semua field dari template
@@ -2325,7 +2326,6 @@ router.post('/zcall-information_info', async(req,res) => {
2325
2326
  for(let key in others){
2326
2327
  dataReplace[key] = others[key];
2327
2328
  }
2328
- console.log(dataReplace);
2329
2329
 
2330
2330
  //saya ingin replace data dengan dataReplace
2331
2331
  // Fungsi untuk mendapatkan nilai dari path nested object