- corretto scheda prodotto, record salvato
This commit is contained in:
@@ -10,7 +10,7 @@ const T_Web_Articoli = require('../models/t_web_articoli');
|
|||||||
const T_Web_StatiProdotto = require('../models/t_web_statiprodotto');
|
const T_Web_StatiProdotto = require('../models/t_web_statiprodotto');
|
||||||
const T_Web_TipiFormato = require('../models/t_web_tipiformato');
|
const T_Web_TipiFormato = require('../models/t_web_tipiformato');
|
||||||
|
|
||||||
const SERVER_A_URL = process.env.SERVER_A_URL || "http://IP_DI_SERVER_A:3000";
|
const SERVER_A_URL = process.env.SERVER_A_URL || "";
|
||||||
const API_KEY = process.env.API_KEY_MSSQL;
|
const API_KEY = process.env.API_KEY_MSSQL;
|
||||||
|
|
||||||
const mongoose = require('mongoose').set('debug', false);
|
const mongoose = require('mongoose').set('debug', false);
|
||||||
@@ -81,15 +81,14 @@ exports.getTableContent = async (options) => {
|
|||||||
try {
|
try {
|
||||||
// Chiama getTableContent, se ritorna errore hangup, allora attendi 2 secondi e poi richiamala.
|
// Chiama getTableContent, se ritorna errore hangup, allora attendi 2 secondi e poi richiamala.
|
||||||
const tableContent = await this.getTableContentBase(options);
|
const tableContent = await this.getTableContentBase(options);
|
||||||
|
console.log(' uscito dalla funzione getTableContentBase ... ')
|
||||||
return tableContent;
|
return tableContent;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('Error: ', error);
|
console.error('Error: ', error?.message);
|
||||||
if (error.message === 'socket hang up') {
|
if (error.message === 'socket hang up') {
|
||||||
console.log('Error: hangup, waiting 2 seconds and retrying...');
|
console.log('Error: hangup, waiting 2 seconds and retrying...');
|
||||||
await new Promise(resolve => setTimeout(resolve, 2000));
|
await new Promise(resolve => setTimeout(resolve, 2000));
|
||||||
return await this.getTableContent(options);
|
return await this.getTableContent(options);
|
||||||
} else {
|
|
||||||
throw error;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -118,11 +117,14 @@ exports.getModelByNameTable = (nameTable) => {
|
|||||||
|
|
||||||
exports.getTableContentBase = async (options) => {
|
exports.getTableContentBase = async (options) => {
|
||||||
try {
|
try {
|
||||||
|
const myurl = SERVER_A_URL + '/query';
|
||||||
|
console.log('getTableContentBase...', myurl)
|
||||||
// Verifica se la tabella esiste
|
// Verifica se la tabella esiste
|
||||||
const checkTableQuery = `SELECT COUNT(*) as tableExists FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = '${options.nameTable}'`;
|
const checkTableQuery = `SELECT COUNT(*) as tableExists FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = '${options.nameTable}'`;
|
||||||
const checkResponse = await axios.post(SERVER_A_URL + '/query', { query: checkTableQuery }, {
|
const checkResponse = await axios.post(myurl, { query: checkTableQuery }, {
|
||||||
headers: { 'x-api-key': API_KEY }
|
headers: { 'x-api-key': API_KEY }
|
||||||
});
|
});
|
||||||
|
console.log(' risposta 1...')
|
||||||
if (!checkResponse?.data || checkResponse?.data.length === 0 || checkResponse?.data[0].tableExists === 0) {
|
if (!checkResponse?.data || checkResponse?.data.length === 0 || checkResponse?.data[0].tableExists === 0) {
|
||||||
return `La tabella '${options.nameTable}' non esiste.`;
|
return `La tabella '${options.nameTable}' non esiste.`;
|
||||||
}
|
}
|
||||||
@@ -132,6 +134,7 @@ exports.getTableContentBase = async (options) => {
|
|||||||
const columnsResponse = await axios.post(SERVER_A_URL + '/query', { query: columnsQuery }, {
|
const columnsResponse = await axios.post(SERVER_A_URL + '/query', { query: columnsQuery }, {
|
||||||
headers: { 'x-api-key': API_KEY }
|
headers: { 'x-api-key': API_KEY }
|
||||||
});
|
});
|
||||||
|
console.log(' risposta 2 (schema)...')
|
||||||
const tableColumns = columnsResponse.data.map(col => col.COLUMN_NAME);
|
const tableColumns = columnsResponse.data.map(col => col.COLUMN_NAME);
|
||||||
|
|
||||||
// Mappatura per unire i campi (ID e Descrizione)
|
// Mappatura per unire i campi (ID e Descrizione)
|
||||||
@@ -162,6 +165,7 @@ exports.getTableContentBase = async (options) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (options.aggregation) {
|
if (options.aggregation) {
|
||||||
|
console.log('options.aggregation', options.aggregation);
|
||||||
records = await mymodel.aggregate(options.aggregation);
|
records = await mymodel.aggregate(options.aggregation);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
@@ -186,10 +190,11 @@ exports.getTableContentBase = async (options) => {
|
|||||||
pipeline.push({ $project: { [options.fieldGM]: 1 } });
|
pipeline.push({ $project: { [options.fieldGM]: 1 } });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
console.log(' aggregate pipeline...', pipeline);
|
||||||
records = await mymodel.aggregate(pipeline);
|
records = await mymodel.aggregate(pipeline);
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log('results', records[0]);
|
console.log('results', records ? records[0] : ' non ricevuto');
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
@@ -340,6 +345,7 @@ exports.getTableContentBase = async (options) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!records || records.length === 0) {
|
if (!records || records.length === 0) {
|
||||||
|
console.log(`Nessun record trovato per la tabella ${options.nameTable}.`);
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -879,16 +885,24 @@ exports.mssqlmigrateTables = async (req) => {
|
|||||||
const MssqlMigrator = require('../modules/MssqlMigrator'); // Importa la classe Macro
|
const MssqlMigrator = require('../modules/MssqlMigrator'); // Importa la classe Macro
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const options = req.body.options;
|
const options = req.body.mydata.options;
|
||||||
let listaTabelle = [];
|
let listaTabelle = [];
|
||||||
|
|
||||||
|
|
||||||
if (options?.tutte) {
|
if (options?.tutte) {
|
||||||
// const listaTabelle = ['T_WEB_StatiProdotto'];
|
// const listaTabelle = ['T_WEB_StatiProdotto'];
|
||||||
listaTabelle = ['T_WEB_TitoliOriginali', 'T_WEB_TestateOrdini', 'T_WEB_Ordini', 'T_WEB_Disponibile', 'T_WOO_TestateOrdini', 'T_WOO_Ordini', 'T_WEB_Articoli',
|
listaTabelle = ['T_WEB_TitoliOriginali', 'T_WEB_TestateOrdini', 'T_WEB_Ordini', 'T_WEB_Disponibile', 'T_WOO_TestateOrdini', 'T_WOO_Ordini', 'T_WEB_Articoli',
|
||||||
'T_WEB_Argomenti', 'T_WEB_ClientiInternet', 'T_WOO_Clienti', 'T_WEB_Autori', 'T_WEB_Collane', 'T_WEB_MarchiEditoriali', 'T_WEB_StatiProdotto', 'T_WEB_TipiFormato', 'T_WEB_Tipologie', 'T_WEB_ArticoliFatturati', 'T_WEB_IdInternetFatturati',
|
'T_WEB_Argomenti', 'T_WEB_ClientiInternet', 'T_WOO_Clienti', 'T_WEB_Autori', 'T_WEB_Collane', 'T_WEB_MarchiEditoriali', 'T_WEB_StatiProdotto', 'T_WEB_TipiFormato', 'T_WEB_Tipologie', 'T_WEB_ArticoliFatturati', 'T_WEB_IdInternetFatturati',
|
||||||
'T_WEB_Edizioni', 'T_WEB_Contratti'];
|
'T_WEB_Edizioni', 'T_WEB_Contratti'];
|
||||||
|
} else if (options?.parte1) {
|
||||||
|
listaTabelle = ['T_WEB_TitoliOriginali', 'T_WEB_TestateOrdini', 'T_WEB_Ordini', 'T_WOO_TestateOrdini', 'T_WOO_Ordini', 'T_WEB_Articoli'];
|
||||||
|
} else if (options?.parte2) {
|
||||||
|
listaTabelle = ['T_WEB_Disponibile', 'T_WEB_Argomenti', 'T_WEB_ClientiInternet', 'T_WOO_Clienti', 'T_WEB_Autori'];
|
||||||
|
} else if (options?.parte3) {
|
||||||
|
listaTabelle = ['T_WEB_Collane', 'T_WEB_MarchiEditoriali', 'T_WEB_StatiProdotto', 'T_WEB_TipiFormato', 'T_WEB_Tipologie', 'T_WEB_ArticoliFatturati', 'T_WEB_IdInternetFatturati',
|
||||||
|
'T_WEB_Edizioni', 'T_WEB_Contratti'];
|
||||||
} else {
|
} else {
|
||||||
listaTabelle = ['T_WEB_Ordini'];
|
listaTabelle = ['T_WEB_Articoli'];
|
||||||
}
|
}
|
||||||
|
|
||||||
const migrator = new MssqlMigrator();
|
const migrator = new MssqlMigrator();
|
||||||
@@ -908,11 +922,11 @@ exports.updateAllBook = async (idapp, options) => {
|
|||||||
const macro = new Macro(idapp); // Crea un'istanza della classe Macro
|
const macro = new Macro(idapp); // Crea un'istanza della classe Macro
|
||||||
options.idapp = idapp;
|
options.idapp = idapp;
|
||||||
|
|
||||||
return await macro.updateLocalDbFromGM_T_Web_Articoli(options);
|
return await macro.updateLocalDbFromGM_T_Web_Articoli(options);
|
||||||
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error(e.message);
|
console.error(e.message);
|
||||||
throw e;
|
return e.message;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -32,6 +32,9 @@ const CatalogSchema = new Schema({
|
|||||||
idCollane: [{
|
idCollane: [{
|
||||||
type: String,
|
type: String,
|
||||||
}],
|
}],
|
||||||
|
idTipoFormato: [{
|
||||||
|
type: Number,
|
||||||
|
}],
|
||||||
|
|
||||||
argomenti: [{
|
argomenti: [{
|
||||||
type: String,
|
type: String,
|
||||||
|
|||||||
@@ -256,7 +256,7 @@ CitySchema.statics.insertGeojsonToMongoDB = async function (nomefilejson) {
|
|||||||
|
|
||||||
if (reccity) {
|
if (reccity) {
|
||||||
const ris = await City.updateOne({ _id: reccity._id }, { $set: { geojson: citta } });
|
const ris = await City.updateOne({ _id: reccity._id }, { $set: { geojson: citta } });
|
||||||
if (ris.acknowledged === 1) {
|
if (ris.acknowledged) {
|
||||||
inseriti++;
|
inseriti++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -63,6 +63,7 @@ const catalogo = new Schema(
|
|||||||
argomenti: [{ type: String }],
|
argomenti: [{ type: String }],
|
||||||
idCollane: [{ type: String }],
|
idCollane: [{ type: String }],
|
||||||
idTipologia: [{ type: Number }],
|
idTipologia: [{ type: Number }],
|
||||||
|
idTipoFormato: [{ type: Number }],
|
||||||
sort_field: { type: String },
|
sort_field: { type: String },
|
||||||
sort_dir: { type: Number },
|
sort_dir: { type: Number },
|
||||||
pdf: { type: Boolean },
|
pdf: { type: Boolean },
|
||||||
|
|||||||
@@ -130,7 +130,8 @@ const scheletroScheda = {
|
|||||||
|
|
||||||
productTypes: [{ type: Number }],
|
productTypes: [{ type: Number }],
|
||||||
excludeproductTypes: [{ type: Number }],
|
excludeproductTypes: [{ type: Number }],
|
||||||
idTipologia: [{ type: Number }],
|
idTipologie: [{ type: Number }],
|
||||||
|
idTipoFormato: [{ type: Number }],
|
||||||
editore: [{ type: String }],
|
editore: [{ type: String }],
|
||||||
argomenti: [{ type: String }],
|
argomenti: [{ type: String }],
|
||||||
idCollane: [{ type: String }],
|
idCollane: [{ type: String }],
|
||||||
|
|||||||
@@ -112,6 +112,20 @@ const productSchema = new Schema({
|
|||||||
eta: {
|
eta: {
|
||||||
type: String
|
type: String
|
||||||
},
|
},
|
||||||
|
verificaprod: {
|
||||||
|
esito: {
|
||||||
|
type: Number,
|
||||||
|
},
|
||||||
|
data: {
|
||||||
|
type: Date,
|
||||||
|
},
|
||||||
|
username: {
|
||||||
|
type: String,
|
||||||
|
},
|
||||||
|
note: {
|
||||||
|
type: String,
|
||||||
|
},
|
||||||
|
},
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
price_acquistato: {
|
price_acquistato: {
|
||||||
|
|||||||
@@ -459,12 +459,14 @@ module.exports.updateProductInfoByStats = async function (idapp) {
|
|||||||
const T_WEB_ArticoliFatturati = require('./t_web_articolifatturati');
|
const T_WEB_ArticoliFatturati = require('./t_web_articolifatturati');
|
||||||
const T_WEB_Ordini = require('./t_web_ordini');
|
const T_WEB_Ordini = require('./t_web_ordini');
|
||||||
|
|
||||||
const statistics = await T_WEB_ArticoliFatturati.getStatistics();
|
|
||||||
|
|
||||||
mylog = "Inizio Aggiornamento Statistiche... \n";
|
mylog = "Inizio Aggiornamento Statistiche... \n";
|
||||||
mylogtot += mylog;
|
mylogtot += mylog;
|
||||||
console.log(mylog);
|
console.log(mylog);
|
||||||
|
|
||||||
|
let countUpdate = 0;
|
||||||
|
|
||||||
|
countUpdate = await T_WEB_ArticoliFatturati.updateStatisticsFatt('', idapp, true);
|
||||||
|
|
||||||
// Itera sui risultati e aggiorna productInfo
|
// Itera sui risultati e aggiorna productInfo
|
||||||
|
|
||||||
mylog = `Aggiornati ${countUpdate} record di productInfo`;
|
mylog = `Aggiornati ${countUpdate} record di productInfo`;
|
||||||
|
|||||||
@@ -87,13 +87,16 @@ module.exports.updateStatisticsOrders = async function (CodArticoloGM, idapp, up
|
|||||||
try {
|
try {
|
||||||
let myquery = [];
|
let myquery = [];
|
||||||
|
|
||||||
// Query di aggregazione per calcolare le statistiche
|
if (CodArticoloGM) {
|
||||||
myquery.push(
|
// Query di aggregazione per calcolare le statistiche
|
||||||
{
|
myquery.push(
|
||||||
$match: {
|
{
|
||||||
CodArticoloGM: CodArticoloGM,
|
$match: {
|
||||||
},
|
CodArticoloGM: CodArticoloGM,
|
||||||
});
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
myquery.push(
|
myquery.push(
|
||||||
{
|
{
|
||||||
$group: {
|
$group: {
|
||||||
|
|||||||
@@ -26,6 +26,8 @@ class Macro {
|
|||||||
|
|
||||||
async updateLocalDbFromGM_T_Web_Articoli(params) {
|
async updateLocalDbFromGM_T_Web_Articoli(params) {
|
||||||
|
|
||||||
|
console.log('INIZIO updateLocalDbFromGM_T_Web_Articoli...', params);
|
||||||
|
|
||||||
let mylog = ''
|
let mylog = ''
|
||||||
let numrec = 0;
|
let numrec = 0;
|
||||||
const options = {
|
const options = {
|
||||||
@@ -69,11 +71,12 @@ class Macro {
|
|||||||
{ DescrizioneStatoProdotto: 'Prossima uscita/pubblicazione' },
|
{ DescrizioneStatoProdotto: 'Prossima uscita/pubblicazione' },
|
||||||
{ DescrizioneStatoProdotto: 'In prevendita' },
|
{ DescrizioneStatoProdotto: 'In prevendita' },
|
||||||
{ DescrizioneStatoProdotto: 'Vendita sito' },
|
{ DescrizioneStatoProdotto: 'Vendita sito' },
|
||||||
{ DescrizioneStatoProdotto: '2023 in commercio' },
|
{ DescrizioneStatoProdotto: '2023 in commercio' }
|
||||||
]
|
],
|
||||||
|
Ean13: { $not: /^USATO/ }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
1 In commercio
|
1 In commercio
|
||||||
3 Ristampa
|
3 Ristampa
|
||||||
@@ -97,30 +100,18 @@ class Macro {
|
|||||||
} else {
|
} else {
|
||||||
options.where = `
|
options.where = `
|
||||||
(DescrizioneStatoProdotto = 'In commercio' OR
|
(DescrizioneStatoProdotto = 'In commercio' OR
|
||||||
DescrizioneStatoProdotto = 'Ristampa' OR
|
|
||||||
DescrizioneStatoProdotto = 'Prossima uscita/pubblicazione' OR
|
DescrizioneStatoProdotto = 'Prossima uscita/pubblicazione' OR
|
||||||
DescrizioneStatoProdotto = 'In promozione' OR
|
|
||||||
DescrizioneStatoProdotto = 'In fase di valutazione' OR
|
|
||||||
DescrizioneStatoProdotto = 'Titolo in esaurimento (in attesa Nuova Edizione)' OR
|
|
||||||
DescrizioneStatoProdotto = 'Titolo in esaurimento' OR
|
|
||||||
DescrizioneStatoProdotto = 'Titolo in esaurimento (in att N.E Ricopertinata)' OR
|
|
||||||
DescrizioneStatoProdotto = 'Titolo in Esaurimento (disponibile N.E.)' OR
|
|
||||||
DescrizioneStatoProdotto = 'In commercio (digitale)' OR
|
|
||||||
DescrizioneStatoProdotto = 'In prevendita' OR
|
DescrizioneStatoProdotto = 'In prevendita' OR
|
||||||
DescrizioneStatoProdotto = 'Vendita sito' OR
|
|
||||||
DescrizioneStatoProdotto = '2023 in commercio' OR
|
DescrizioneStatoProdotto = '2023 in commercio' OR
|
||||||
DescrizioneStatoProdotto = 'Assoluto NO Reso' OR
|
DescrizioneStatoProdotto = 'Prossima uscita')
|
||||||
DescrizioneStatoProdotto = 'Titolo esaurito'
|
AND
|
||||||
DescrizioneStatoProdotto = '2023 in commercio' OR
|
|
||||||
DescrizioneStatoProdotto = 'Vendita sito' OR
|
|
||||||
DescrizioneStatoProdotto = 'In prevendita' OR
|
|
||||||
DescrizioneStatoProdotto = 'Prossima uscita') AND
|
|
||||||
(DescrizioneTipologia = 'Libri' OR
|
(DescrizioneTipologia = 'Libri' OR
|
||||||
DescrizioneTipologia = 'Cartolibro' OR
|
DescrizioneTipologia = 'Cartolibro' OR
|
||||||
DescrizioneTipologia = 'Carte')
|
DescrizioneTipologia = 'Carte')
|
||||||
|
AND
|
||||||
|
(Ean13 NOT LIKE 'USATO%')
|
||||||
`;
|
`;
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
miolimit = 1;
|
miolimit = 1;
|
||||||
miomatch = {
|
miomatch = {
|
||||||
@@ -432,6 +423,7 @@ class Macro {
|
|||||||
// if (!options.caricatutti) {
|
// if (!options.caricatutti) {
|
||||||
await this.elaboraProdotto(recproduct, opt);
|
await this.elaboraProdotto(recproduct, opt);
|
||||||
|
|
||||||
|
|
||||||
const sku = recproduct.IdArticolo;
|
const sku = recproduct.IdArticolo;
|
||||||
|
|
||||||
if (sku) {
|
if (sku) {
|
||||||
@@ -775,7 +767,6 @@ class Macro {
|
|||||||
|
|
||||||
if (productGM.DescrizioneTipologia === 'Usato')
|
if (productGM.DescrizioneTipologia === 'Usato')
|
||||||
vers = shared_consts.PRODUCTTYPE.USATO;
|
vers = shared_consts.PRODUCTTYPE.USATO;
|
||||||
|
|
||||||
if (productGM.DescrizioneTipologia === 'Download')
|
if (productGM.DescrizioneTipologia === 'Download')
|
||||||
vers = shared_consts.PRODUCTTYPE.DOWNLOAD;
|
vers = shared_consts.PRODUCTTYPE.DOWNLOAD;
|
||||||
else if (productGM.DescrizioneTipologia === 'DVD')
|
else if (productGM.DescrizioneTipologia === 'DVD')
|
||||||
|
|||||||
@@ -28,11 +28,16 @@ class MssqlMigrator {
|
|||||||
async migrateTables(tableNames) {
|
async migrateTables(tableNames) {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
|
const numtables = tableNames.length;
|
||||||
|
let indtab = 0;
|
||||||
|
let indtabok = 0;
|
||||||
const logs = [];
|
const logs = [];
|
||||||
for (const tableName of tableNames) {
|
for (const tableName of tableNames) {
|
||||||
try {
|
try {
|
||||||
|
|
||||||
logs.push(`\n>> Recupero dati da MSSQL per la tabella: ${tableName}`);
|
const percentuale = ((indtab / numtables) * 100).toFixed(2);
|
||||||
|
logs.push(`\n>> Recupero dati da MSSQL per la tabella: ${tableName} - (Completamento: ${percentuale}%)`);
|
||||||
console.log(logs[logs.length - 1]);
|
console.log(logs[logs.length - 1]);
|
||||||
const dataQuery = `SELECT * FROM [${tableName}]`;
|
const dataQuery = `SELECT * FROM [${tableName}]`;
|
||||||
|
|
||||||
@@ -44,7 +49,7 @@ class MssqlMigrator {
|
|||||||
{ query: dataQuery },
|
{ query: dataQuery },
|
||||||
{ headers: { 'x-api-key': this.apiKey } },
|
{ headers: { 'x-api-key': this.apiKey } },
|
||||||
null,
|
null,
|
||||||
{ timeout: 300000 });
|
{ timeout: 900000 });
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('Error: ', error);
|
console.error('Error: ', error);
|
||||||
if (error.message === 'socket hang up') {
|
if (error.message === 'socket hang up') {
|
||||||
@@ -56,10 +61,11 @@ class MssqlMigrator {
|
|||||||
{ query: dataQuery },
|
{ query: dataQuery },
|
||||||
{ headers: { 'x-api-key': this.apiKey } },
|
{ headers: { 'x-api-key': this.apiKey } },
|
||||||
null,
|
null,
|
||||||
{ timeout: 300000 });
|
{ timeout: 900000 });
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
throw error;
|
console.error('Unexpected error while fetching data from MSSQL:', error.message);
|
||||||
|
// throw error;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -101,14 +107,19 @@ class MssqlMigrator {
|
|||||||
logs.push(`✅ Inserimento di ${records.length} record nella collezione MongoDB: ${modelName}`);
|
logs.push(`✅ Inserimento di ${records.length} record nella collezione MongoDB: ${modelName}`);
|
||||||
console.log(logs[logs.length - 1]);
|
console.log(logs[logs.length - 1]);
|
||||||
await DynamicModel.insertMany(records);
|
await DynamicModel.insertMany(records);
|
||||||
|
|
||||||
|
indtabok++;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
logs.push(`❌ Errore con la tabella ${tableName}:`, error.message);
|
logs.push(`❌ Errore con la tabella ${tableName}:`, error.message);
|
||||||
console.log(logs[logs.length - 1]);
|
console.log(logs[logs.length - 1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
indtab++;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
logs.push('\n🎉 Tutte le tabelle sono state migrate.');
|
logs.push(`\n🎉 ${indtabok} tabelle su ${numtables} sono state migrate.`);
|
||||||
console.log(logs[logs.length - 1]);
|
console.log(logs[logs.length - 1]);
|
||||||
return logs.join('\n');
|
return logs.join('\n');
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|||||||
@@ -518,7 +518,7 @@ router.post('/settable', authenticate, async (req, res) => {
|
|||||||
})
|
})
|
||||||
.then(async (risult) => {
|
.then(async (risult) => {
|
||||||
let rec = null;
|
let rec = null;
|
||||||
if (risult && risult.acknowledged === 1) {
|
if (risult && risult.acknowledged) {
|
||||||
rec = await mytable.findById(mytablerec._id).lean();
|
rec = await mytable.findById(mytablerec._id).lean();
|
||||||
} else {
|
} else {
|
||||||
rec = risult;
|
rec = risult;
|
||||||
|
|||||||
@@ -99,7 +99,7 @@ router.post('/cmd', authenticate_noerror, async (req, res) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
let state = (value && ris && ris.acknowledged === 1) ? 1 : ((!value && ris && ris.acknowledged === 1) ? -1 : 0);
|
let state = (value && ris && ris.acknowledged) ? 1 : ((!value && ris && ris.acknowledged) ? -1 : 0);
|
||||||
|
|
||||||
const risreac = await Reaction.calcReactions(idapp, id, tab);
|
const risreac = await Reaction.calcReactions(idapp, id, tab);
|
||||||
if (risreac) {
|
if (risreac) {
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
1.2.33
|
1.2.34
|
||||||
Reference in New Issue
Block a user