ver 1.1.20:
- corretto campo foto che non compariva più. - sistemato i campi aggiuntivi e i richiesti. - migliorato la barra in alto di selezione. - aggiunto alcune icone.
This commit is contained in:
108
src/server/models/catalog.js
Executable file
108
src/server/models/catalog.js
Executable file
@@ -0,0 +1,108 @@
|
||||
const mongoose = require('mongoose').set('debug', false)
|
||||
const Schema = mongoose.Schema;
|
||||
|
||||
const tools = require('../tools/general');
|
||||
const { ObjectId } = require('mongodb');
|
||||
|
||||
mongoose.Promise = global.Promise;
|
||||
mongoose.level = "F";
|
||||
|
||||
|
||||
// Resolving error Unknown modifier: $pushAll
|
||||
mongoose.plugin(schema => {
|
||||
schema.options.usePushEach = true
|
||||
});
|
||||
|
||||
const Foto = {
|
||||
imagefile: {
|
||||
type: String,
|
||||
},
|
||||
alt: {
|
||||
type: String,
|
||||
},
|
||||
description: {
|
||||
type: String,
|
||||
},
|
||||
};
|
||||
|
||||
const FilesCataloghi = {
|
||||
per_web: { type: String, },
|
||||
per_stampa: { type: String, },
|
||||
};
|
||||
|
||||
const CatalogSchema = new Schema({
|
||||
idapp: {
|
||||
type: String,
|
||||
},
|
||||
active: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
title: {
|
||||
type: String,
|
||||
},
|
||||
foto_collana: Foto,
|
||||
idCollana: {
|
||||
type: String,
|
||||
},
|
||||
descr_introduttiva: {
|
||||
type: String,
|
||||
},
|
||||
idTemplateScheda: {
|
||||
type: String,
|
||||
},
|
||||
referenti: [{
|
||||
type: String,
|
||||
}],
|
||||
|
||||
img_bordata_web: Foto,
|
||||
img_bordata_stampa: Foto,
|
||||
img_intro_web: Foto,
|
||||
img_intro_stampa: Foto,
|
||||
|
||||
generati: FilesCataloghi,
|
||||
online: FilesCataloghi,
|
||||
|
||||
date_created: {
|
||||
type: Date,
|
||||
default: Date.now
|
||||
},
|
||||
date_updated: {
|
||||
type: Date,
|
||||
},
|
||||
});
|
||||
|
||||
CatalogSchema.pre('save', async function (next) {
|
||||
if (this.isNew) {
|
||||
this._id = new ObjectId();
|
||||
}
|
||||
|
||||
next();
|
||||
});
|
||||
|
||||
CatalogSchema.statics.getFieldsForSearch = function () {
|
||||
return [{ field: 'title', type: tools.FieldType.string }]
|
||||
};
|
||||
|
||||
CatalogSchema.statics.executeQueryTable = function (idapp, params, user) {
|
||||
params.fieldsearch = this.getFieldsForSearch();
|
||||
return tools.executeQueryTable(this, idapp, params, user);
|
||||
};
|
||||
|
||||
CatalogSchema.statics.findAllIdApp = async function (idapp) {
|
||||
const Catalog = this;
|
||||
|
||||
const myfind = { idapp };
|
||||
|
||||
const arrrec = await Catalog.find(myfind).lean().sort({ title: 1 });
|
||||
|
||||
return arrrec;
|
||||
};
|
||||
|
||||
const Catalog = mongoose.model('Catalog', CatalogSchema);
|
||||
|
||||
Catalog.createIndexes((err) => {
|
||||
if (err) throw err;
|
||||
});
|
||||
|
||||
module.exports = { Catalog };
|
||||
@@ -21,7 +21,7 @@ const CollanaSchema = new Schema({
|
||||
descrizione: {
|
||||
type: String,
|
||||
},
|
||||
Descrizione_Estesa: {
|
||||
descrizione_estesa: {
|
||||
type: String,
|
||||
},
|
||||
dataOra: {
|
||||
@@ -52,7 +52,7 @@ module.exports.executeQueryTable = function (idapp, params) {
|
||||
module.exports.findAllIdApp = async function (idapp) {
|
||||
const myfind = { idapp };
|
||||
|
||||
return await Collana.find(myfind).sort({name: 1, surname: 1});
|
||||
return await Collana.find(myfind).sort({descrizione: 1});
|
||||
};
|
||||
|
||||
module.exports.createIndexes((err) => {
|
||||
|
||||
@@ -526,6 +526,20 @@ module.exports.findAllIdApp = async function (idapp, code, id, all) {
|
||||
preserveNullAndEmptyArrays: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
$lookup: {
|
||||
from: 'collanas',
|
||||
localField: 'productInfo.idCollana',
|
||||
foreignField: '_id',
|
||||
as: 'productInfo.collana'
|
||||
}
|
||||
},
|
||||
{
|
||||
$unwind: {
|
||||
path: '$productInfo.collana',
|
||||
preserveNullAndEmptyArrays: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
$lookup: {
|
||||
from: 'catprods',
|
||||
|
||||
@@ -119,7 +119,7 @@ const productInfoSchema = new Schema({
|
||||
type: String,
|
||||
},
|
||||
idAuthors: [{ type: Schema.Types.ObjectId, ref: 'Author' }],
|
||||
idCollana: { type: Schema.Types.ObjectId, ref: 'Collana' },
|
||||
idCollana: { type: Number },
|
||||
idPublisher: { type: Schema.Types.ObjectId, ref: 'Publisher' },
|
||||
collezione: {
|
||||
type: String,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
module.exports = {
|
||||
list: [
|
||||
{_id: 1, descr: 'Offro'},
|
||||
{_id: 2, descr: 'Cerco'},
|
||||
{_id: 1, descr: '🟢 Offro'},
|
||||
{_id: 2, descr: '🔴 Cerco'},
|
||||
],
|
||||
};
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
module.exports = {
|
||||
list: [
|
||||
{_id: 1, descr: 'Offro'},
|
||||
{_id: 2, descr: 'Cerco'},
|
||||
{_id: 1, descr: '🟢 Offro'},
|
||||
{_id: 2, descr: '🔴 Cerco'},
|
||||
],
|
||||
};
|
||||
|
||||
@@ -1,85 +1,82 @@
|
||||
module.exports = {
|
||||
list: [
|
||||
{_id: 1, idSectorGood: [1], descr: 'Abbigliamento donna'},
|
||||
{_id: 2, idSectorGood: [1], descr: 'Abbigliamento uomo'},
|
||||
{_id: 3, idSectorGood: [1], descr: 'Accessori'},
|
||||
{_id: 4, idSectorGood: [1], descr: 'Scarpe donna'},
|
||||
{_id: 5, idSectorGood: [1], descr: 'Scarpe uomo'},
|
||||
{_id: 6, idSectorGood: [2], descr: 'Bagno'},
|
||||
{_id: 7, idSectorGood: [2], descr: 'Camera'},
|
||||
{_id: 8, idSectorGood: [2], descr: 'Complementi d\'arredo'},
|
||||
{_id: 9, idSectorGood: [2], descr: 'Cucina'},
|
||||
{_id: 10, idSectorGood: [2], descr: 'Esterno'},
|
||||
{_id: 11, idSectorGood: [2], descr: 'Soggiorno'},
|
||||
{_id: 12, idSectorGood: [3], descr: 'Altri veicoli'},
|
||||
{_id: 13, idSectorGood: [3], descr: 'Auto'},
|
||||
{_id: 14, idSectorGood: [3], descr: 'Moto'},
|
||||
{_id: 15, idSectorGood: [3], descr: 'Camper'},
|
||||
{_id: 16, idSectorGood: [3], descr: 'Van (furgoni camperizzati)'},
|
||||
{_id: 17, idSectorGood: [4], descr: 'Bigiotteria'},
|
||||
{_id: 18, idSectorGood: [4], descr: 'Lavoretti'},
|
||||
{_id: 19, idSectorGood: [4], descr: 'Altro'},
|
||||
{_id: 20, idSectorGood: [5], descr: 'Accessori bellezza'},
|
||||
{_id: 21, idSectorGood: [5], descr: 'Creme e detergenti'},
|
||||
{_id: 22, idSectorGood: [5], descr: 'Trucchi e profumi'},
|
||||
{_id: 23, idSectorGood: [6], descr: 'Giocattoli e giochi di società'},
|
||||
{_id: 24, idSectorGood: [6], descr: 'Igiene e pannolini'},
|
||||
{_id: 25, idSectorGood: [6], descr: 'Lettini e culle'},
|
||||
{_id: 26, idSectorGood: [6], descr: 'Passeggini & co'},
|
||||
{_id: 27, idSectorGood: [6], descr: 'Vestiti e scarpe'},
|
||||
{_id: 28, idSectorGood: [7], descr: 'Bere'},
|
||||
{_id: 29, idSectorGood: [7], descr: 'Mangiare'},
|
||||
{_id: 30, idSectorGood: [8], descr: 'Antiquariato'},
|
||||
{_id: 31, idSectorGood: [8], descr: 'Collezionismo'},
|
||||
{_id: 32, idSectorGood: [9], descr: 'Altro'},
|
||||
{_id: 33, idSectorGood: [9], descr: 'Cellulari e accessori'},
|
||||
{_id: 34, idSectorGood: [9], descr: 'Computer e software'},
|
||||
{_id: 35, idSectorGood: [9], descr: 'Elettrodomestici'},
|
||||
{_id: 36, idSectorGood: [9], descr: 'Fotografia'},
|
||||
{_id: 37, idSectorGood: [9], descr: 'Videogiochi e console'},
|
||||
{_id: 38, idSectorGood: [10], descr: 'Console'},
|
||||
{_id: 39, idSectorGood: [10], descr: 'Giochi di società'},
|
||||
{_id: 40, idSectorGood: [10], descr: 'PC games'},
|
||||
{_id: 41, idSectorGood: [11], descr: 'Attrezzatura'},
|
||||
{_id: 42, idSectorGood: [11], descr: 'Materiali'},
|
||||
{_id: 43, idSectorGood: [11], descr: 'Prodotti'},
|
||||
{_id: 44, idSectorGood: [11], descr: 'Strumentazione'},
|
||||
{_id: 45, idSectorGood: [12], descr: ' riviste e fumetti'},
|
||||
{_id: 46, idSectorGood: [13], descr: 'CD e vinili'},
|
||||
{_id: 47, idSectorGood: [13], descr: 'Film e DVD'},
|
||||
{_id: 48, idSectorGood: [13], descr: 'Strumenti musicali'},
|
||||
{_id: 49, idSectorGood: [14], descr: 'Arredamento'},
|
||||
{_id: 50, idSectorGood: [14], descr: 'Attrezzature e accessori'},
|
||||
{_id: 51, idSectorGood: [14], descr: 'Cancelleria e cartucce'},
|
||||
{_id: 52, idSectorGood: [15], descr: 'Abbigliamento'},
|
||||
{_id: 53, idSectorGood: [15], descr: 'Attrezzature e accessori Sport'},
|
||||
{_id: 54, idSectorGood: [15], descr: 'Bici e accessori'},
|
||||
{_id: 55, idSectorGood: [17], descr: 'Edilizia'},
|
||||
{_id: 56, idSectorGood: [17], descr: 'Cucina'},
|
||||
{_id: 57, idSectorGood: [17], descr: 'Modellismo'},
|
||||
{_id: 58, idSectorGood: [17], descr: 'Cucito'},
|
||||
{_id: 59, idSectorGood: [17], descr: 'Pulizia'},
|
||||
{_id: 60, idSectorGood: [17], descr: 'Per Imbiancare'},
|
||||
{_id: 61, idSectorGood: [17], descr: 'Giardinaggio'},
|
||||
{_id: 62, idSectorGood: [17], descr: 'Falegnameria'},
|
||||
{_id: 63, idSectorGood: [7], descr: 'Pane'},
|
||||
{_id: 64, idSectorGood: [7], descr: 'Pasta'},
|
||||
{_id: 65, idSectorGood: [7], descr: 'Formaggi'},
|
||||
{_id: 66, idSectorGood: [7], descr: 'Olio'},
|
||||
{_id: 67, idSectorGood: [7], descr: 'Fervida'},
|
||||
{_id: 68, idSectorGood: [7], descr: 'Fermentati'},
|
||||
{_id: 69, idSectorGood: [7], descr: 'Marmellate'},
|
||||
{_id: 70, idSectorGood: [7], descr: 'Salse'},
|
||||
{_id: 71, idSectorGood: [20], descr: 'Cereali'},
|
||||
{_id: 72, idSectorGood: [20], descr: 'Frutta'},
|
||||
{_id: 73, idSectorGood: [20], descr: 'Ortaggi'},
|
||||
{_id: 74, idSectorGood: [20], descr: 'Zootecnia'},
|
||||
{_id: 75, idSectorGood: [20], descr: 'Giardinaggio'},
|
||||
{_id: 76, idSectorGood: [20], descr: 'Biologica'},
|
||||
{_id: 77, idSectorGood: [20], descr: 'Permacultura'},
|
||||
{_id: 78, idSectorGood: [20], descr: 'Sinergico'},
|
||||
{_id: 79, idSectorGood: [20], descr: 'Tradizionale'},
|
||||
{_id: 80, idSectorGood: [20], descr: 'Viticoltura'},
|
||||
{_id: 81, idSectorGood: [20], descr: 'Acquacoltura'},
|
||||
{ _id: 1, idSectorGood: [1], descr: 'Abbigliamento donna', icon: 'fas fa-tshirt', color: 'pink' },
|
||||
{ _id: 2, idSectorGood: [1], descr: 'Abbigliamento uomo', icon: 'fas fa-tshirt', color: 'blue' },
|
||||
{ _id: 3, idSectorGood: [1], descr: 'Accessori', icon: 'fas fa-glasses', color: 'purple' },
|
||||
{ _id: 4, idSectorGood: [1], descr: 'Scarpe donna', icon: 'fas fa-shoe-prints', color: 'pink' },
|
||||
{ _id: 5, idSectorGood: [1], descr: 'Scarpe uomo', icon: 'fas fa-shoe-prints', color: 'blue' },
|
||||
{ _id: 6, idSectorGood: [2], descr: 'Bagno', icon: 'fas fa-bath', color: 'teal' },
|
||||
{ _id: 7, idSectorGood: [2], descr: 'Camera', icon: 'fas fa-bed', color: 'indigo' },
|
||||
{ _id: 8, idSectorGood: [2], descr: 'Complementi d\'arredo', icon: 'fas fa-couch', color: 'brown' },
|
||||
{ _id: 9, idSectorGood: [2], descr: 'Cucina', icon: 'fas fa-utensils', color: 'orange' },
|
||||
{ _id: 10, idSectorGood: [2], descr: 'Esterno', icon: 'fas fa-tree', color: 'green' },
|
||||
{ _id: 11, idSectorGood: [2], descr: 'Soggiorno', icon: 'fas fa-tv', color: 'grey' },
|
||||
{ _id: 12, idSectorGood: [3], descr: 'Altri veicoli', icon: 'fas fa-car', color: 'black' },
|
||||
{ _id: 13, idSectorGood: [3], descr: 'Auto', icon: 'fas fa-car', color: 'red' },
|
||||
{ _id: 14, idSectorGood: [3], descr: 'Moto', icon: 'fas fa-motorcycle', color: 'black' },
|
||||
{ _id: 15, idSectorGood: [3], descr: 'Camper', icon: 'fas fa-caravan', color: 'orange' },
|
||||
{ _id: 16, idSectorGood: [3], descr: 'Van (furgoni camperizzati)', icon: 'fas fa-truck', color: 'blue' },
|
||||
{ _id: 17, idSectorGood: [4], descr: 'Bigiotteria', icon: 'fas fa-gem', color: 'gold' },
|
||||
{ _id: 18, idSectorGood: [4], descr: 'Lavoretti', icon: 'fas fa-paint-brush', color: 'yellow' },
|
||||
{ _id: 19, idSectorGood: [4], descr: 'Altro', icon: 'fas fa-question', color: 'grey' },
|
||||
{ _id: 20, idSectorGood: [5], descr: 'Accessori bellezza', icon: 'fas fa-spa', color: 'pink' },
|
||||
{ _id: 21, idSectorGood: [5], descr: 'Creme e detergenti', icon: 'fas fa-pump-soap', color: 'teal' },
|
||||
{ _id: 22, idSectorGood: [5], descr: 'Trucchi e profumi', icon: 'fas fa-palette', color: 'purple' },
|
||||
{ _id: 23, idSectorGood: [6], descr: 'Giocattoli e giochi di società', icon: 'fas fa-dice', color: 'yellow' },
|
||||
{ _id: 24, idSectorGood: [6], descr: 'Igiene e pannolini', icon: 'fas fa-baby', color: 'pink' },
|
||||
{ _id: 25, idSectorGood: [6], descr: 'Lettini e culle', icon: 'fas fa-baby-carriage', color: 'blue' },
|
||||
{ _id: 26, idSectorGood: [6], descr: 'Passeggini & co', icon: 'fas fa-baby-carriage', color: 'green' },
|
||||
{ _id: 27, idSectorGood: [6], descr: 'Vestiti e scarpe', icon: 'fas fa-socks', color: 'purple' },
|
||||
{ _id: 28, idSectorGood: [7], descr: 'Bere', icon: 'fas fa-glass-cheers', color: 'red' },
|
||||
{ _id: 29, idSectorGood: [7], descr: 'Mangiare', icon: 'fas fa-utensils', color: 'orange' },
|
||||
{ _id: 30, idSectorGood: [8], descr: 'Antiquariato', icon: 'fas fa-history', color: 'brown' },
|
||||
{ _id: 31, idSectorGood: [8], descr: 'Collezionismo', icon: 'fas fa-coins', color: 'gold' },
|
||||
{ _id: 32, idSectorGood: [9], descr: 'Cellulari e accessori', icon: 'fas fa-mobile-alt', color: 'blue' },
|
||||
{ _id: 33, idSectorGood: [9], descr: 'Computer e software', icon: 'fas fa-laptop', color: 'grey' },
|
||||
{ _id: 34, idSectorGood: [9], descr: 'Elettrodomestici', icon: 'fas fa-blender', color: 'green' },
|
||||
{ _id: 35, idSectorGood: [9], descr: 'Fotografia', icon: 'fas fa-camera', color: 'black' },
|
||||
{ _id: 36, idSectorGood: [9], descr: 'Videogiochi e console', icon: 'fas fa-gamepad', color: 'purple' },
|
||||
{ _id: 37, idSectorGood: [10], descr: 'Console', icon: 'fas fa-gamepad', color: 'black' },
|
||||
{ _id: 38, idSectorGood: [10], descr: 'Giochi di società', icon: 'fas fa-dice', color: 'yellow' },
|
||||
{ _id: 39, idSectorGood: [10], descr: 'PC games', icon: 'fas fa-desktop', color: 'blue' },
|
||||
{ _id: 40, idSectorGood: [11], descr: 'Attrezzatura', icon: 'fas fa-tools', color: 'grey' },
|
||||
{ _id: 41, idSectorGood: [11], descr: 'Materiali', icon: 'fas fa-box-open', color: 'brown' },
|
||||
{ _id: 42, idSectorGood: [11], descr: 'Prodotti', icon: 'fas fa-box', color: 'green' },
|
||||
{ _id: 43, idSectorGood: [11], descr: 'Strumentazione', icon: 'fas fa-toolbox', color: 'blue' },
|
||||
{ _id: 44, idSectorGood: [12], descr: ' riviste e fumetti', icon: 'fas fa-book-open', color: 'red' },
|
||||
{ _id: 45, idSectorGood: [13], descr: 'CD e vinili', icon: 'fas fa-compact-disc', color: 'black' },
|
||||
{ _id: 46, idSectorGood: [13], descr: 'Film e DVD', icon: 'fas fa-film', color: 'blue' },
|
||||
{ _id: 47, idSectorGood: [13], descr: 'Strumenti musicali', icon: 'fas fa-guitar', color: 'brown' },
|
||||
{ _id: 48, idSectorGood: [14], descr: 'Arredamento', icon: 'fas fa-couch', color: 'brown' },
|
||||
{ _id: 49, idSectorGood: [14], descr: 'Attrezzature e accessori', icon: 'fas fa-tools', color: 'grey' },
|
||||
{ _id: 50, idSectorGood: [14], descr: 'Cancelleria e cartucce', icon: 'fas fa-print', color: 'blue' },
|
||||
{ _id: 51, idSectorGood: [15], descr: 'Abbigliamento', icon: 'fas fa-tshirt', color: 'purple' },
|
||||
{ _id: 52, idSectorGood: [15], descr: 'Attrezzature e accessori Sport', icon: 'fas fa-football-ball', color: 'green' },
|
||||
{ _id: 53, idSectorGood: [15], descr: 'Bici e accessori', icon: 'fas fa-bicycle', color: 'blue' },
|
||||
{ _id: 54, idSectorGood: [17], descr: 'Edilizia', icon: 'fas fa-hard-hat', color: 'orange' },
|
||||
{ _id: 55, idSectorGood: [17], descr: 'Modellismo', icon: 'fas fa-puzzle-piece', color: 'yellow' },
|
||||
{ _id: 56, idSectorGood: [17], descr: 'Cucito', icon: 'fas fa-cut', color: 'pink' },
|
||||
{ _id: 57, idSectorGood: [17], descr: 'Pulizia', icon: 'fas fa-broom', color: 'green' },
|
||||
{ _id: 58, idSectorGood: [17], descr: 'Per Imbiancare', icon: 'fas fa-paint-roller', color: 'white' },
|
||||
{ _id: 59, idSectorGood: [17], descr: 'Giardinaggio', icon: 'fas fa-seedling', color: 'green' },
|
||||
{ _id: 60, idSectorGood: [17], descr: 'Falegnameria', icon: 'fas fa-hammer', color: 'brown' },
|
||||
{ _id: 61, idSectorGood: [7], descr: 'Pane', icon: 'fas fa-bread-slice', color: 'brown' },
|
||||
{ _id: 62, idSectorGood: [7], descr: 'Pasta', icon: 'fas fa-utensils', color: 'yellow' },
|
||||
{ _id: 63, idSectorGood: [7], descr: 'Formaggi', icon: 'fas fa-cheese', color: 'yellow' },
|
||||
{ _id: 64, idSectorGood: [7], descr: 'Olio', icon: 'fas fa-oil-can', color: 'green' },
|
||||
{ _id: 65, idSectorGood: [7], descr: 'Fervida', icon: 'fas fa-fire', color: 'red' },
|
||||
{ _id: 66, idSectorGood: [7], descr: 'Fermentati', icon: 'fas fa-beer', color: 'brown' },
|
||||
{ _id: 67, idSectorGood: [7], descr: 'Marmellate', icon: 'fas fa-jar', color: 'orange' },
|
||||
{ _id: 68, idSectorGood: [7], descr: 'Salse', icon: 'fas fa-mortar-pestle', color: 'red' },
|
||||
{ _id: 69, idSectorGood: [20], descr: 'Cereali', icon: 'fas fa-wheat', color: 'yellow' },
|
||||
{ _id: 70, idSectorGood: [20], descr: 'Frutta', icon: 'fas fa-apple-alt', color: 'red' },
|
||||
{ _id: 71, idSectorGood: [20], descr: 'Ortaggi', icon: 'fas fa-carrot', color: 'orange' },
|
||||
{ _id: 72, idSectorGood: [20], descr: 'Zootecnia', icon: 'fas fa-paw', color: 'brown' },
|
||||
{ _id: 73, idSectorGood: [20], descr: 'Biologica', icon: 'fas fa-leaf', color: 'green' },
|
||||
{ _id: 74, idSectorGood: [20], descr: 'Permacultura', icon: 'fas fa-recycle', color: 'green' },
|
||||
{ _id: 75, idSectorGood: [20], descr: 'Sinergico', icon: 'fas fa-handshake', color: 'green' },
|
||||
{ _id: 76, idSectorGood: [20], descr: 'Tradizionale', icon: 'fas fa-tractor', color: 'brown' },
|
||||
{ _id: 77, idSectorGood: [20], descr: 'Viticoltura', icon: 'fas fa-wine-glass-alt', color: 'purple' },
|
||||
{ _id: 78, idSectorGood: [20], descr: 'Acquacoltura', icon: 'fas fa-fish', color: 'blue' },
|
||||
],
|
||||
};
|
||||
};
|
||||
@@ -1,8 +1,8 @@
|
||||
module.exports = {
|
||||
list: [
|
||||
{_id: 0, descr: '[Nessuno]', years_of_exp: 0},
|
||||
{_id: 1, descr: 'Elementare', years_of_exp: 1},
|
||||
{_id: 2, descr: 'Intermedio', years_of_exp: 2},
|
||||
{_id: 3, descr: 'Avanzato', years_of_exp: 3},
|
||||
{_id: 2, descr: 'Elementare', years_of_exp: 1},
|
||||
{_id: 3, descr: 'Intermedio', years_of_exp: 2},
|
||||
{_id: 4, descr: 'Avanzato', years_of_exp: 3},
|
||||
],
|
||||
};
|
||||
|
||||
@@ -30,7 +30,7 @@ module.exports = {
|
||||
|
||||
},
|
||||
|
||||
async insertIntoDb_NoDuplicate(attiva, tablename, table, field) {
|
||||
async insertIntoDb_NoDuplicate(attiva, tablename, table, field, field2) {
|
||||
let numrec = 0;
|
||||
let numupdated = 0;
|
||||
try {
|
||||
@@ -43,7 +43,10 @@ module.exports = {
|
||||
if (mydbfile && mydbfile.list) {
|
||||
for (const rec of mydbfile.list) {
|
||||
let query = {};
|
||||
query[field] = rec[field];
|
||||
if (field)
|
||||
query[field] = rec[field];
|
||||
if (field2)
|
||||
query[field2] = rec[field2];
|
||||
|
||||
if (rec.hasOwnProperty('_id')) {
|
||||
query._id = rec._id;
|
||||
@@ -57,6 +60,8 @@ module.exports = {
|
||||
const existingDoc = await table.findOne(query);
|
||||
if (!existingDoc) {
|
||||
|
||||
console.log('ADD: ' + query);
|
||||
|
||||
const { value: existingDoc, upserted } = await table.findOneAndUpdate(
|
||||
query,
|
||||
{ $set: rec },
|
||||
@@ -71,8 +76,9 @@ module.exports = {
|
||||
|
||||
} else {
|
||||
// Il documento esiste, lo aggiorniamo
|
||||
await table.updateOne({ _id: existingDoc._id }, { $set: rec });
|
||||
numupdated++;
|
||||
const ris = await table.updateOne({ _id: existingDoc._id }, { $set: rec });
|
||||
if (ris && ris.nModified > 0)
|
||||
numupdated++;
|
||||
}
|
||||
} catch (e) {
|
||||
console.log('Error processing record:', e);
|
||||
@@ -172,8 +178,7 @@ module.exports = {
|
||||
if (rec.table === 'contribtypes') {
|
||||
attiva = scrivi_contribtype;
|
||||
}
|
||||
|
||||
await this.insertIntoDb_NoDuplicate(attiva, rec.table, mytable, rec.key);
|
||||
await this.insertIntoDb_NoDuplicate(attiva, rec.table, mytable, rec.key, rec.key2);
|
||||
}
|
||||
|
||||
console.log('FINE - popolaTabelleNuove');
|
||||
|
||||
@@ -8,7 +8,7 @@ module.exports = {
|
||||
{_id: 6, descr: 'Bimbi', icon: 'fas fa-child', color: 'cyan-7'},
|
||||
{_id: 7, descr: 'Cibo'},
|
||||
{_id: 8, descr: 'Collezionismo e Antiquariato'},
|
||||
{_id: 9, descr: 'Elettronica'},
|
||||
{_id: 9, descr: 'Elettronica di Consumo'},
|
||||
{_id: 10, descr: 'Giochi', icon: 'fas fa-gamepad', color: 'purple-7'},
|
||||
{_id: 11, descr: 'Hobby', icon: 'fas fa-guitar', color: 'cyan-7'},
|
||||
{_id: 12, descr: 'Libri', icon: 'fas fa-book', color: 'indigo-7'},
|
||||
@@ -20,7 +20,6 @@ module.exports = {
|
||||
{_id: 18, descr: 'Animali', icon: 'fas fa-paw', color: 'green-7'},
|
||||
{_id: 19, descr: 'Arte / Decorazioni', icon: 'fas fa-palette', color: 'purple-7'},
|
||||
{_id: 20, descr: 'Agricoltura', icon: 'fas fa-seedling', color: 'green-7'},
|
||||
{_id: 21, descr: 'Elettrodomestici', icon: 'fas fa-blender', color: 'green-7'},
|
||||
|
||||
],
|
||||
};
|
||||
|
||||
@@ -1,3 +1,27 @@
|
||||
/*
|
||||
module.exports = {
|
||||
list: [
|
||||
{ _id: 2, descr: 'Agricoltura', icon: 'fas fa-tractor', color: '#4CAF50' },
|
||||
{ _id: 3, descr: 'Cibo e Ristorazione', icon: 'fas fa-utensils', color: '#FF9800' },
|
||||
{ _id: 4, descr: 'Animali', icon: 'fas fa-paw', color: '#795548' },
|
||||
{ _id: 5, descr: 'Auto e Veicoli', icon: 'fas fa-car', color: '#607D8B' },
|
||||
{ _id: 6, descr: 'Salute e Benessere', icon: 'fas fa-heartbeat', color: '#E91E63' },
|
||||
{ _id: 7, descr: 'Casa e Arredamento', icon: 'fas fa-home', color: '#9C27B0' },
|
||||
{ _id: 8, descr: 'Attività Ricreative e di Intrattenim.', icon: 'fas fa-gamepad', color: '#FF5722' },
|
||||
{ _id: 13, descr: 'Tecnologie', icon: 'fas fa-microchip', color: '#2196F3' },
|
||||
{ _id: 15, descr: 'Artigianato', icon: 'fas fa-hammer', color: '#FFC107' },
|
||||
{ _id: 16, descr: 'Arte e Cultura', icon: 'fas fa-palette', color: '#3F51B5' },
|
||||
{ _id: 17, descr: 'Assistenza e Integrazione', icon: 'fas fa-hands-helping', color: '#00BCD4' },
|
||||
{ _id: 18, descr: 'Attività fisica e sportiva', icon: 'fas fa-running', color: '#8BC34A' },
|
||||
{ _id: 20, descr: 'Bambini', icon: 'fas fa-baby', color: '#FFEB3B' },
|
||||
{ _id: 21, descr: 'Consulenza e Supporto Professionale', icon: 'fas fa-briefcase', color: '#9E9E9E' },
|
||||
{ _id: 22, descr: 'Formazione e crescita personale', icon: 'fas fa-graduation-cap', color: '#673AB7' },
|
||||
{ _id: 23, descr: 'Manutenzione e riparazione', icon: 'fas fa-wrench', color: '#F44336' },
|
||||
{ _id: 24, descr: 'Mobilità e Trasporti', icon: 'fas fa-bus', color: '#009688' },
|
||||
],
|
||||
};
|
||||
*/
|
||||
|
||||
module.exports = {
|
||||
list: [
|
||||
{_id: 1, descr: 'Abitare'},
|
||||
@@ -14,4 +38,4 @@ module.exports = {
|
||||
{_id: 13, descr: 'Tecnologie'},
|
||||
{_id: 14, descr: 'Servizi'},
|
||||
],
|
||||
};
|
||||
};
|
||||
@@ -1,6 +1,6 @@
|
||||
module.exports = {
|
||||
list: [
|
||||
{_id: 1, descr: 'Di Persona', icon:'fas fa-people-carry', color:'green-8' },
|
||||
{_id: 2, descr: 'On Line', icon:'fas fa-desktop', color: 'indigo-7'},
|
||||
{_id: 1, descr: '👤 Di Persona', icon:'fas fa-people-carry', color:'green-8' },
|
||||
{_id: 2, descr: '💻 On Line', icon:'fas fa-desktop', color: 'indigo-7'},
|
||||
],
|
||||
};
|
||||
|
||||
@@ -776,6 +776,7 @@ router.post('/import', authenticate, async (req, res) => {
|
||||
let imported = 0;
|
||||
let errors = 0;
|
||||
|
||||
|
||||
const ripopola = true;
|
||||
|
||||
if (ripopola) {
|
||||
@@ -838,6 +839,7 @@ router.post('/import', authenticate, async (req, res) => {
|
||||
let indprod = 0;
|
||||
let newprod = 0;
|
||||
|
||||
|
||||
if (numprod) {
|
||||
// Rimuove prima tutti i valori precedenti
|
||||
let risupdate = await ProductInfo.updateMany({ idapp }, {
|
||||
@@ -875,7 +877,7 @@ router.post('/import', authenticate, async (req, res) => {
|
||||
// split versioneGM in array with separated ","
|
||||
let arrversGM = versGM.split(",").map(x => x.trim());
|
||||
|
||||
const recproductInfoAttuale = await ProductInfo.findOne({ idapp, code: productInfo.code });
|
||||
const recproductInfoAttuale = await ProductInfo.findOne({ idapp, code: product.isbn });
|
||||
|
||||
let productInfo = {
|
||||
idapp: product.idapp,
|
||||
@@ -900,13 +902,18 @@ router.post('/import', authenticate, async (req, res) => {
|
||||
|
||||
// Aggiorna la collana solo se non è stata già impostata nel record attuale
|
||||
if (recproductInfoAttuale && !recproductInfoAttuale.idCollana && product.DescrizioneCollana) {
|
||||
productInfo.idCollana = product.IdCollana;
|
||||
const idCollanaNum = parseInt(product.IdCollana)
|
||||
productInfo.idCollana = idCollanaNum;
|
||||
|
||||
reccollana = await Collana.findOne({ idapp, idCollana }).lean();
|
||||
reccollana = await Collana.findOne({ idapp, idCollana: idCollanaNum }).lean();
|
||||
if (!reccollana) {
|
||||
// Non esiste questa collana, quindi la creo !
|
||||
reccoll = new Collana({ idapp, idCollana: product.IdCollana, descrizione: product.DescrizioneCollana });
|
||||
ris = await reccoll.save();
|
||||
try {
|
||||
// Non esiste questa collana, quindi la creo !
|
||||
reccoll = new Collana({ idapp, idCollana: idCollanaNum, descrizione: product.DescrizioneCollana });
|
||||
ris = await reccoll.save();
|
||||
} catch (e) {
|
||||
console.error('Err', e);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -76,6 +76,7 @@ const Gasordine = require('../models/gasordine');
|
||||
const Product = require('../models/product');
|
||||
const Author = require('../models/author');
|
||||
const Collana = require('../models/collana');
|
||||
const { Catalog } = require('../models/catalog');
|
||||
const Publisher = require('../models/publisher');
|
||||
const ProductInfo = require('../models/productInfo');
|
||||
const Scontistica = require('../models/scontistica');
|
||||
@@ -1845,6 +1846,7 @@ function load(req, res, version) {
|
||||
let providers = Provider.findAllIdApp(idapp);
|
||||
let catprods = Product.getArrCatProds(idapp, shared_consts.PROD.BOTTEGA);
|
||||
let collane = Collana.findAllIdApp(idapp);
|
||||
let catalogs = Catalog.findAllIdApp(idapp);
|
||||
let catprods_gas = Product.getArrCatProds(idapp, shared_consts.PROD.GAS);
|
||||
let subcatprods = SubCatProd.findAllIdApp(idapp);
|
||||
let gasordines = Gasordine.findAllIdApp(idapp);
|
||||
@@ -1958,6 +1960,7 @@ function load(req, res, version) {
|
||||
publishers,
|
||||
myschedas,
|
||||
collane,
|
||||
catalogs,
|
||||
]).then((arrdata) => {
|
||||
// console.table(arrdata);
|
||||
let myuser = req.user;
|
||||
@@ -2054,6 +2057,7 @@ function load(req, res, version) {
|
||||
publishers: arrdata[50],
|
||||
myschedas: arrdata[51],
|
||||
collane: arrdata[52],
|
||||
catalogs: arrdata[53],
|
||||
});
|
||||
|
||||
const prova = 1;
|
||||
|
||||
@@ -277,7 +277,7 @@ const Menu = {
|
||||
'Inv e NO 7 Req',
|
||||
MSGSTAFF: emoji.get('incoming_envelope') + ' Invia a STAFF',
|
||||
MSGAPPARTIENE_CIRCUITI_RIS: 'Invia a Utenti dei Circuiti RIS',
|
||||
MSGPAOLO: emoji.get('incoming_envelope') + ' Invia a PAOLO',
|
||||
MSGPAOLO: emoji.get('incoming_envelope') + ' Invia a SURYA',
|
||||
RESTART_SRV: emoji.get('incoming_envelope') + 'Restart-NodeJs',
|
||||
REBOOT_SRV: emoji.get('incoming_envelope') + 'Reboot-VPS!',
|
||||
EXECSH: emoji.get('incoming_envelope') + 'ExecSH',
|
||||
@@ -487,7 +487,7 @@ const txt = {
|
||||
emoji.get('dizzy'),
|
||||
MSG_ASK_USERNAME_BO: 'Scrivete nel messaggio l\'username (SENZA SPAZI) o la email con cui vi siete registrati sul sito di %s:',
|
||||
MSG_ASK_USERNAME_INVITANTE: 'Scrivi nel messaggio <b>l\'USERNAME TELEGRAM</b> di chi ti ha INVITATO',
|
||||
MSG_NEW_REG: '<br><br>⁉️🙈 Per aiuto scrivi sulla <a href="https://t.me/riso_gruppo">Chat RISO</a><br>oppure direttamente a Paolo (@surya1977) ☀️.',
|
||||
MSG_NEW_REG: '<br><br>⁉️🙈 Per aiuto scrivi sulla <a href="https://t.me/riso_gruppo">Chat RISO</a><br>oppure direttamente a Surya (@surya1977) ☀️.',
|
||||
MSG_ERRORE_INVITANTE_NOT_FOUND: 'L\'username dell\'invitante appena digitato non sembra essere corretto! Ti ricordo che dev\'essere l\'username con cui si è registrato su %s',
|
||||
MSG_ERRORE_USERNAME: 'Attenzione! Devi inserire solo lo username (40 caratteri massimo)',
|
||||
MSG_ERRORE_USERNAME_NOT_FOUND: 'Per Completare la Verifica Telegram BOT, dovete ora scrivere qui sotto nel messaggio l\'Username (senza spazi) OPPURE la email con cui vi siete registrati sul sito',
|
||||
@@ -696,7 +696,7 @@ const txt_pt = {
|
||||
|
||||
const TelegramBot = require('node-telegram-bot-api');
|
||||
|
||||
const ADMIN_IDTELEGRAM_TEST = 5356627050; // 5022837609; //Surya Arena
|
||||
const ADMIN_IDTELEGRAM_TEST = 5356627050; // 5022837609; //Surya A.
|
||||
|
||||
const MyTelegramBot = {
|
||||
|
||||
@@ -1897,7 +1897,7 @@ class Telegram {
|
||||
noanswer = true;
|
||||
let myfaq = this.geturlfaq();
|
||||
risp = 'Ciao {username}, Io mi chiamo BOT e sono il tuo assistente Virtuale ' + emo.ROBOT_FACE + emo.JOY2 + '\n' +
|
||||
'Usa il menu qui sotto per interagire col BOT\n' +
|
||||
'Usa il menu qui sotto per interagire col BOT, cliccando sul bottone in basso, con 4 quadratini dentro\n' +
|
||||
'\nPer <strong>AIUTO</strong>, clicca qui:\n👉🏻👉🏻<a href="' + myfaq +
|
||||
'">FAQ di AIUTO</a> (risposte alle domande più frequenti)\n\nSe non trovi risposta allora contatta la <a href="' +
|
||||
tools.getTelegramSupportChat(this.idapp) + '">Chat di HELP</a>.\nGrazie';
|
||||
|
||||
@@ -17,8 +17,8 @@ let jsonUser1 = {
|
||||
email: 'paolo.arena77@gmail.com',
|
||||
password: '$2a$12$hTv40mdq.x35Up7HQ9faae1JgHrohcvp45vt8eMkGhQv/Zv.8.MIG',
|
||||
username: 'paoloar77',
|
||||
name: 'Paolo',
|
||||
surname: 'Arena',
|
||||
name: 'Surya',
|
||||
surname: '',
|
||||
idapp: '1',
|
||||
lang: 'it',
|
||||
keyappid: 'KKPPAA5KJK435J3KSS9F9D8S9F8SD98F9SDF',
|
||||
|
||||
@@ -23,6 +23,7 @@ const { Contribtype } = require('../models/contribtype');
|
||||
const { PaymentType } = require('../models/paymenttype');
|
||||
const { Discipline } = require('../models/discipline');
|
||||
const { Skill } = require('../models/skill');
|
||||
const { Catalog } = require('../models/catalog');
|
||||
const { Good } = require('../models/good');
|
||||
const { SubSkill } = require('../models/subskill');
|
||||
const { MySkill } = require('../models/myskill');
|
||||
@@ -218,6 +219,8 @@ module.exports = {
|
||||
mytable = Graduatoria;
|
||||
else if (tablename === 'skills')
|
||||
mytable = Skill;
|
||||
else if (tablename === 'catalogs')
|
||||
mytable = Catalog;
|
||||
else if (tablename === 'goods')
|
||||
mytable = Good;
|
||||
else if (tablename === 'subskills')
|
||||
|
||||
@@ -162,9 +162,10 @@ module.exports = {
|
||||
TABLES_CIRCUITS: 'circuits',
|
||||
TABLES_MYGROUPS: 'mygroups',
|
||||
TABLES_ATTIVITAS: 'attivitas',
|
||||
TABLES_CATALOG: 'catalogs',
|
||||
|
||||
MYTABS: [{ id: 0, table: 'none' },
|
||||
{ id: 1, table: 'myskills' },
|
||||
{ id: 1, table: this.TABLES_MYSKILLS },
|
||||
{ id: 2, table: 'mybachecas' },
|
||||
{ id: 3, table: 'myhosps' },
|
||||
{ id: 4, table: 'mygoods' },
|
||||
@@ -209,7 +210,7 @@ module.exports = {
|
||||
TABLES_GETCOMPLETEREC: ['myskills', 'mybachecas', 'myhosps', 'mygoods', 'attivitas'],
|
||||
|
||||
//++Todo: per abilitare gli utenti ad inserire un Circuito aggiungere 'circuits' alla lista TABLES_PERM_NEWREC
|
||||
TABLES_PERM_NEWREC: ['skills', 'goods', 'subskills', 'mygroups', 'myhosps'],
|
||||
TABLES_PERM_NEWREC: ['skills', 'goods', 'subskills', 'mygroups', 'myhosps', 'catalogs'],
|
||||
|
||||
TABLES_REACTIONS: ['mybachecas', 'myhosps', 'myskills', 'mygoods', 'attivitas'],
|
||||
|
||||
@@ -222,7 +223,7 @@ module.exports = {
|
||||
TABLES_GROUPS_NOTIFICATION: ['mygroups'],
|
||||
TABLES_CIRCUITS_NOTIFICATION: ['circuits'],
|
||||
|
||||
TABLES_ENABLE_GETTABLE_FOR_NOT_LOGGED: ['attivitas'],
|
||||
TABLES_ENABLE_GETTABLE_FOR_NOT_LOGGED: ['attivitas', 'catalogs'],
|
||||
|
||||
TABLES_NUM_AS_ID_NUMBER: [],
|
||||
|
||||
@@ -255,7 +256,7 @@ module.exports = {
|
||||
],
|
||||
TABLES_USER_ID: ['mygroups', 'myskills', 'mybachecas', 'myhosps', 'mygoods'],
|
||||
TABLES_CREATEDBY: ['mygroups', 'circuits', 'attivitas'],
|
||||
TABLES_UPDATE_LASTMODIFIED: ['myskills', 'mybachecas', 'myhosps', 'mygoods', 'bots', 'mygroups', 'circuits', 'attivitas', 'myelems', 'mypages', 'productinfos', 'products'],
|
||||
TABLES_UPDATE_LASTMODIFIED: ['myskills', 'mybachecas', 'myhosps', 'mygoods', 'bots', 'mygroups', 'circuits', 'attivitas', 'myelems', 'mypages', 'productinfos', 'products', 'catalogs'],
|
||||
|
||||
TABLES_FIELDS_DESCR_AND_CITY_AND_USER: ['myskills', 'mybachecas', 'myhosps', 'mygoods'],
|
||||
|
||||
@@ -265,24 +266,24 @@ module.exports = {
|
||||
TABLES_POPULATE_DATA: [
|
||||
{
|
||||
table: 'adtypegoods',
|
||||
key: 'descr',
|
||||
keyOFF: 'descr',
|
||||
}, {
|
||||
table: 'adtypes',
|
||||
key: 'descr',
|
||||
keyOFF: 'descr',
|
||||
},
|
||||
{ table: 'catgrps', key: 'descr' },
|
||||
{
|
||||
table: 'contribtypes',
|
||||
key: 'descr',
|
||||
},
|
||||
{ table: 'goods', key: 'descr' },
|
||||
{ table: 'goods', key: 'descr', key2: 'idSectorGood' },
|
||||
{ table: 'levels', key: 'descr' },
|
||||
{ table: 'cities', key: 'comune' },
|
||||
{ table: 'provinces', key: 'descr' },
|
||||
{ table: 'sectorgoods', key: 'descr' },
|
||||
{ table: 'sectors', key: 'descr' },
|
||||
{ table: 'skills', key: 'descr' },
|
||||
{ table: 'statusSkills', key: 'descr' },
|
||||
{ table: 'sectorgoods', keyOLD: 'descr' },
|
||||
{ table: 'sectors', keyOLD: 'descr' },
|
||||
{ table: 'skills', key: 'descr', key2: 'idSector' },
|
||||
{ table: 'statusSkills', keyOLD: 'descr' },
|
||||
// { table: 'catais', key: 'descr' },
|
||||
// { table: 'queryais', key: 'descr' },
|
||||
],
|
||||
@@ -1040,6 +1041,8 @@ module.exports = {
|
||||
return add + 'grp' + add
|
||||
} else if (table === 'circuits') {
|
||||
return add + 'circuit' + add
|
||||
} else if (table === 'catalogs') {
|
||||
return add + 'catalogs' + add
|
||||
}
|
||||
|
||||
return ''
|
||||
|
||||
@@ -1 +1 @@
|
||||
1.1.18
|
||||
1.1.20
|
||||
Reference in New Issue
Block a user