delore-crm-core 1.0.4 → 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.
- package/README.md +1 -1
- package/db/models.js +7 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# delore-crm-core
|
|
2
2
|
|
|
3
|
-
Biblioteca central de utilidades do CRM da Delore. Reúne registro de rotas e acesso, helpers compartilhados, autenticação/token, sincronismo de permissões, conexão com banco (MySQL + MongoDB), modelos e utilidades de impressão (PDF/Excel).
|
|
3
|
+
Biblioteca central de utilidades do CRM da Delore - Alphaville Systems. Reúne registro de rotas e acesso, helpers compartilhados, autenticação/token, sincronismo de permissões, conexão com banco (MySQL + MongoDB), modelos e utilidades de impressão (PDF/Excel).
|
|
4
4
|
|
|
5
5
|
## Instalação
|
|
6
6
|
|
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
|
},
|
|
@@ -370,6 +374,7 @@ function searchModel(nameKey, myArray) {
|
|
|
370
374
|
}
|
|
371
375
|
|
|
372
376
|
async function createViews() {
|
|
377
|
+
const sequelize = require('delore-crm-core').sequelizeDB.getSequelize()
|
|
373
378
|
try {
|
|
374
379
|
await sequelize.transaction(async (t) => {
|
|
375
380
|
//
|
|
@@ -379,8 +384,7 @@ async function createViews() {
|
|
|
379
384
|
//
|
|
380
385
|
// Lista diretório com as views
|
|
381
386
|
//
|
|
382
|
-
|
|
383
|
-
var files = fs.readdirSync(directoryPath);
|
|
387
|
+
var files = fs.readdirSync(pathViews);
|
|
384
388
|
if (files) {
|
|
385
389
|
for (var i = 0; i < files.length; i++) {
|
|
386
390
|
var file = files[i];
|
|
@@ -393,7 +397,7 @@ async function createViews() {
|
|
|
393
397
|
|
|
394
398
|
if (listViewExist.length == 0) {
|
|
395
399
|
console.log('* * * criando a view ' + viewName);
|
|
396
|
-
var sql = fs.readFileSync(
|
|
400
|
+
var sql = fs.readFileSync(pathViews + '/' + file, 'utf8');
|
|
397
401
|
console.log(sql);
|
|
398
402
|
await sequelize.query(sql);
|
|
399
403
|
}
|