delore-crm-core 1.0.6 → 1.0.7

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/db/models.js +6 -3
  2. package/package.json +1 -1
package/db/models.js CHANGED
@@ -5,8 +5,12 @@ const listModels = [];
5
5
  const listModelsIn = [];
6
6
  const logger = require('../utils/logger.js');
7
7
  const listTablesValidDel = [];
8
+ let pathViews = '';
8
9
 
9
10
  const models = {
11
+ setPathViews: function (path) {
12
+ pathViews = path;
13
+ },
10
14
  Migration: function () {
11
15
  return migration();
12
16
  },
@@ -380,8 +384,7 @@ async function createViews() {
380
384
  //
381
385
  // Lista diretório com as views
382
386
  //
383
- const directoryPath = path.join(__dirname, '../views');
384
- var files = fs.readdirSync(directoryPath);
387
+ var files = fs.readdirSync(pathViews);
385
388
  if (files) {
386
389
  for (var i = 0; i < files.length; i++) {
387
390
  var file = files[i];
@@ -394,7 +397,7 @@ async function createViews() {
394
397
 
395
398
  if (listViewExist.length == 0) {
396
399
  console.log('* * * criando a view ' + viewName);
397
- var sql = fs.readFileSync(directoryPath + '/' + file, 'utf8');
400
+ var sql = fs.readFileSync(pathViews + '/' + file, 'utf8');
398
401
  console.log(sql);
399
402
  await sequelize.query(sql);
400
403
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "delore-crm-core",
3
- "version": "1.0.6",
3
+ "version": "1.0.7",
4
4
  "description": "Core CRM utilities for Delore projects",
5
5
  "main": "index.js",
6
6
  "type": "commonjs",