Aggiungere "San Marino" e suoi comuni
Corretto Filtro a mano della ricerca Creare filtro ricerca per trovare la sottocategoria o categoria -> Skill e SubSkill
This commit is contained in:
6
src/server/populate/adtypes.js
Normal file
6
src/server/populate/adtypes.js
Normal file
@@ -0,0 +1,6 @@
|
||||
module.exports = {
|
||||
list: [
|
||||
{_id: 1, descr: 'Offro'},
|
||||
{_id: 2, descr: 'Cerco'},
|
||||
],
|
||||
};
|
||||
@@ -89012,5 +89012,269 @@ module.exports = {
|
||||
abitanti: 'M204',
|
||||
country: 'IT',
|
||||
},
|
||||
{
|
||||
_id: 8094,
|
||||
istat: '',
|
||||
comune: 'Acquaviva',
|
||||
prov: 'RSM',
|
||||
reg: 'RSM',
|
||||
pref: '0549',
|
||||
cap: '47892',
|
||||
abitanti: '',
|
||||
country: 'RSM',
|
||||
},
|
||||
{
|
||||
_id: 8095,
|
||||
istat: '',
|
||||
comune: 'Borgo Maggiore',
|
||||
prov: 'RSM',
|
||||
reg: 'RSM',
|
||||
pref: '0549',
|
||||
cap: '47893',
|
||||
abitanti: '',
|
||||
country: 'RSM',
|
||||
},
|
||||
{
|
||||
_id: 8096,
|
||||
istat: '',
|
||||
comune: 'Ca\' Rigo',
|
||||
prov: 'RSM',
|
||||
reg: 'RSM',
|
||||
pref: '0549',
|
||||
cap: '47893',
|
||||
abitanti: '',
|
||||
country: 'RSM',
|
||||
},
|
||||
{
|
||||
_id: 8097,
|
||||
istat: '',
|
||||
comune: 'Cailungo',
|
||||
prov: 'RSM',
|
||||
reg: 'RSM',
|
||||
pref: '0549',
|
||||
cap: '47893',
|
||||
abitanti: '',
|
||||
country: 'RSM',
|
||||
},
|
||||
{
|
||||
_id: 8098,
|
||||
istat: '',
|
||||
comune: 'Casole',
|
||||
prov: 'RSM',
|
||||
reg: 'RSM',
|
||||
pref: '0549',
|
||||
cap: '47890',
|
||||
abitanti: '',
|
||||
country: 'RSM',
|
||||
},
|
||||
{
|
||||
_id: 8099,
|
||||
istat: '',
|
||||
comune: 'Cerbaiola',
|
||||
prov: 'RSM',
|
||||
reg: 'RSM',
|
||||
pref: '0549',
|
||||
cap: '47898',
|
||||
abitanti: '',
|
||||
country: 'RSM',
|
||||
},
|
||||
{
|
||||
_id: 8100,
|
||||
istat: '',
|
||||
comune: 'Chiesanuova',
|
||||
prov: 'RSM',
|
||||
reg: 'RSM',
|
||||
pref: '0549',
|
||||
cap: '47894',
|
||||
abitanti: '',
|
||||
country: 'RSM',
|
||||
},
|
||||
{
|
||||
_id: 8101,
|
||||
istat: '',
|
||||
comune: 'Città di San Marino',
|
||||
prov: 'RSM',
|
||||
reg: 'RSM',
|
||||
pref: '0549',
|
||||
cap: '47890',
|
||||
abitanti: '',
|
||||
country: 'RSM',
|
||||
},
|
||||
{
|
||||
_id: 8102,
|
||||
istat: '',
|
||||
comune: 'Dogana',
|
||||
prov: 'RSM',
|
||||
reg: 'RSM',
|
||||
pref: '0549',
|
||||
cap: '47891',
|
||||
abitanti: '',
|
||||
country: 'RSM',
|
||||
},
|
||||
{
|
||||
_id: 8103,
|
||||
istat: '',
|
||||
comune: 'Domagnano',
|
||||
prov: 'RSM',
|
||||
reg: 'RSM',
|
||||
pref: '0549',
|
||||
cap: '47895',
|
||||
abitanti: '',
|
||||
country: 'RSM',
|
||||
},
|
||||
{
|
||||
_id: 8104,
|
||||
istat: '',
|
||||
comune: 'Faetano',
|
||||
prov: 'RSM',
|
||||
reg: 'RSM',
|
||||
pref: '0549',
|
||||
cap: '47896',
|
||||
abitanti: '',
|
||||
country: 'RSM',
|
||||
},
|
||||
{
|
||||
_id: 8105,
|
||||
istat: '',
|
||||
comune: 'Falciano',
|
||||
prov: 'RSM',
|
||||
reg: 'RSM',
|
||||
pref: '0549',
|
||||
cap: '47897',
|
||||
abitanti: '',
|
||||
country: 'RSM',
|
||||
},
|
||||
{
|
||||
_id: 8106,
|
||||
istat: '',
|
||||
comune: 'Galazzano',
|
||||
prov: 'RSM',
|
||||
reg: 'RSM',
|
||||
pref: '0549',
|
||||
cap: '47891',
|
||||
abitanti: '',
|
||||
country: 'RSM',
|
||||
},
|
||||
{
|
||||
_id: 8107,
|
||||
istat: '',
|
||||
comune: 'Gualdicciolo',
|
||||
prov: 'RSM',
|
||||
reg: 'RSM',
|
||||
pref: '0549',
|
||||
cap: '47892',
|
||||
abitanti: '',
|
||||
country: 'RSM',
|
||||
},
|
||||
{
|
||||
_id: 8108,
|
||||
istat: '',
|
||||
comune: 'Montegiardino',
|
||||
prov: 'RSM',
|
||||
reg: 'RSM',
|
||||
pref: '0549',
|
||||
cap: '47898',
|
||||
abitanti: '',
|
||||
country: 'RSM',
|
||||
},
|
||||
{
|
||||
_id: 8109,
|
||||
istat: '',
|
||||
comune: 'Murata',
|
||||
prov: 'RSM',
|
||||
reg: 'RSM',
|
||||
pref: '0549',
|
||||
cap: '47890',
|
||||
abitanti: '',
|
||||
country: 'RSM',
|
||||
},
|
||||
{
|
||||
_id: 8110,
|
||||
istat: '',
|
||||
comune: 'Rovereta',
|
||||
prov: 'RSM',
|
||||
reg: 'RSM',
|
||||
pref: '0549',
|
||||
cap: '47891',
|
||||
abitanti: '',
|
||||
country: 'RSM',
|
||||
},
|
||||
{
|
||||
_id: 8111,
|
||||
istat: '',
|
||||
comune: 'San Giovanni',
|
||||
prov: 'RSM',
|
||||
reg: 'RSM',
|
||||
pref: '0549',
|
||||
cap: '47893',
|
||||
abitanti: '',
|
||||
country: 'RSM',
|
||||
},
|
||||
{
|
||||
_id: 8112,
|
||||
istat: '',
|
||||
comune: 'Santa Mustiola',
|
||||
prov: 'RSM',
|
||||
reg: 'RSM',
|
||||
pref: '0549',
|
||||
cap: '47890',
|
||||
abitanti: '',
|
||||
country: 'RSM',
|
||||
},
|
||||
{
|
||||
_id: 8113,
|
||||
istat: '',
|
||||
comune: 'Serravalle',
|
||||
prov: 'RSM',
|
||||
reg: 'RSM',
|
||||
pref: '0549',
|
||||
cap: '47899',
|
||||
abitanti: '',
|
||||
country: 'RSM',
|
||||
},
|
||||
{
|
||||
_id: 8114,
|
||||
istat: '',
|
||||
comune: 'Teglio',
|
||||
prov: 'RSM',
|
||||
reg: 'RSM',
|
||||
pref: '0549',
|
||||
cap: '47894',
|
||||
abitanti: '',
|
||||
country: 'RSM',
|
||||
},
|
||||
{
|
||||
_id: 8115,
|
||||
istat: '',
|
||||
comune: 'Torraccia',
|
||||
prov: 'RSM',
|
||||
reg: 'RSM',
|
||||
pref: '0549',
|
||||
cap: '47895',
|
||||
abitanti: '',
|
||||
country: 'RSM',
|
||||
},
|
||||
{
|
||||
_id: 8116,
|
||||
istat: '',
|
||||
comune: 'Valdragone',
|
||||
prov: 'RSM',
|
||||
reg: 'RSM',
|
||||
pref: '0549',
|
||||
cap: '47893',
|
||||
abitanti: '',
|
||||
country: 'RSM',
|
||||
},
|
||||
{
|
||||
_id: 8117,
|
||||
istat: '',
|
||||
comune: 'Ventoso',
|
||||
prov: 'RSM',
|
||||
reg: 'RSM',
|
||||
pref: '0549',
|
||||
cap: '47893',
|
||||
abitanti: '',
|
||||
country: 'RSM',
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
@@ -5,80 +5,66 @@ module.exports = {
|
||||
{
|
||||
"_id" : ObjectID("615a353c002c8298f4495be7"),
|
||||
"idapp" : "1",
|
||||
"__v" : 0,
|
||||
"label" : "Dono"
|
||||
},
|
||||
|
||||
{
|
||||
"_id" : ObjectID("61bc466567de9a1f54b25494"),
|
||||
"idapp" : "1",
|
||||
"__v" : 0,
|
||||
"label" : "Offerta Libera"
|
||||
},
|
||||
|
||||
{
|
||||
"_id" : ObjectID("61bc454867de9a1f54b25462"),
|
||||
"idapp" : "1",
|
||||
"__v" : 0,
|
||||
"label" : "Baratto"
|
||||
},
|
||||
|
||||
{
|
||||
"_id" : ObjectID("61bc482667de9a1f54b2549b"),
|
||||
"idapp" : "1",
|
||||
"__v" : 0,
|
||||
"label" : "Euro"
|
||||
},
|
||||
{
|
||||
"_id" : ObjectID("61bc482667de9a1f54b2549b"),
|
||||
"idapp" : "1",
|
||||
"__v" : 0,
|
||||
"label" : "Scambio di Beni"
|
||||
"label" : "Baratto (scambio Beni o Servizi)"
|
||||
},
|
||||
{
|
||||
"_id" : ObjectID("61bc482667de9a1f54b2549c"),
|
||||
"idapp" : "1",
|
||||
"__v" : 0,
|
||||
"label" : "Scambio di Lavoro"
|
||||
"label" : "Scambio Lavoro"
|
||||
},
|
||||
{
|
||||
"_id" : ObjectID("61bc482667de9a1f54b2649c"),
|
||||
"idapp" : "1",
|
||||
"label" : "Monete Alternative"
|
||||
},
|
||||
{
|
||||
"_id" : ObjectID("61bc482667de9a1f54b3549e"),
|
||||
"idapp" : "1",
|
||||
"label" : "Euro"
|
||||
},
|
||||
{
|
||||
"_id" : ObjectID("615a353c002c8298f4495bf7"),
|
||||
"idapp" : "12",
|
||||
"__v" : 0,
|
||||
"label" : "Dono"
|
||||
},
|
||||
|
||||
{
|
||||
"_id" : ObjectID("61bc466567de9a1f54b254f4"),
|
||||
"idapp" : "12",
|
||||
"__v" : 0,
|
||||
"label" : "Offerta Libera"
|
||||
},
|
||||
|
||||
{
|
||||
"_id" : ObjectID("61bc454867de9a1f54b254f2"),
|
||||
"idapp" : "12",
|
||||
"__v" : 0,
|
||||
"label" : "Baratto"
|
||||
},
|
||||
|
||||
{
|
||||
"_id" : ObjectID("61bc482667de9a1f54b254fb"),
|
||||
"idapp" : "12",
|
||||
"__v" : 0,
|
||||
"label" : "Euro"
|
||||
},
|
||||
{
|
||||
"_id" : ObjectID("61bc482667de9a1f54b25411"),
|
||||
"idapp" : "12",
|
||||
"__v" : 0,
|
||||
"label" : "Scambio di Beni"
|
||||
"label" : "Baratto (scambio Beni o Servizi)"
|
||||
},
|
||||
{
|
||||
"_id" : ObjectID("61bc482667de9a1f54b25412"),
|
||||
"idapp" : "12",
|
||||
"__v" : 0,
|
||||
"label" : "Scambio di Lavoro"
|
||||
"label" : "Scambio Lavoro"
|
||||
},
|
||||
{
|
||||
"_id" : ObjectID("61bc482667de9a1f64b254ab"),
|
||||
"idapp" : "12",
|
||||
"label" : "Monete Alternative"
|
||||
},
|
||||
{
|
||||
"_id" : ObjectID("61bc482667de9a1f64b254fb"),
|
||||
"idapp" : "12",
|
||||
"label" : "Euro"
|
||||
},
|
||||
]
|
||||
}
|
||||
|
||||
@@ -24,11 +24,17 @@ module.exports = {
|
||||
|
||||
},
|
||||
|
||||
async insertIntoDb_NoDuplicate(tablename, table, field) {
|
||||
async insertIntoDb_NoDuplicate(attiva, tablename, table, field) {
|
||||
|
||||
let numrec = 0;
|
||||
try {
|
||||
|
||||
if (!attiva && await table.countDocuments({}) > 0)
|
||||
return;
|
||||
|
||||
const pathfile = Path.join(__dirname, tablename + '.js');
|
||||
if (tools.isFileExists(pathfile)) {
|
||||
|
||||
const mydbfile = require(pathfile);
|
||||
|
||||
if (mydbfile && mydbfile.list) {
|
||||
@@ -38,10 +44,17 @@ module.exports = {
|
||||
|
||||
var mynewrec = new table(rec);
|
||||
|
||||
if (rec.hasOwnProperty('idapp')) {
|
||||
obj.idapop = rec['idapp'];
|
||||
}
|
||||
|
||||
const exist = await table.find(obj);
|
||||
if (exist.length <= 0) {
|
||||
try {
|
||||
await mynewrec.save();
|
||||
const ris = await mynewrec.save();
|
||||
if (ris) {
|
||||
numrec++;
|
||||
}
|
||||
}catch (e){
|
||||
console.log('error ', e);
|
||||
}
|
||||
@@ -50,12 +63,63 @@ module.exports = {
|
||||
}
|
||||
}
|
||||
|
||||
if (numrec > 0)
|
||||
console.log('*** Insert', numrec, 'record on '+tablename);
|
||||
|
||||
}
|
||||
}
|
||||
}catch (e){
|
||||
console.log('error insertIntoDb', e);
|
||||
}
|
||||
|
||||
|
||||
},
|
||||
|
||||
async rewriteTable(table) {
|
||||
|
||||
let mytab = null;
|
||||
let field = '';
|
||||
|
||||
const {City} = require('../models/city');
|
||||
const {Province} = require('../models/province');
|
||||
const {Sector} = require('../models/sector');
|
||||
const {Skill} = require('../models/skill');
|
||||
const {SubSkill} = require('../models/subskill');
|
||||
const {Contribtype} = require('../models/contribtype');
|
||||
const {Level} = require('../models/level');
|
||||
|
||||
if (table === 'cities') {
|
||||
mytab = City;
|
||||
field = 'comune';
|
||||
} else if (table === 'provinces') {
|
||||
mytab = Province;
|
||||
field = 'descr';
|
||||
} else if (table === 'sectors') {
|
||||
mytab = Sector;
|
||||
field = 'descr';
|
||||
} else if (table === 'skills') {
|
||||
mytab = Skill;
|
||||
field = 'descr';
|
||||
} else if (table === 'subskills') {
|
||||
mytab = SubSkill;
|
||||
field = 'descr';
|
||||
} else if (table === 'contribtypes') {
|
||||
mytab = Contribtype;
|
||||
field = 'label';
|
||||
} else if (table === 'levels') {
|
||||
mytab = Level;
|
||||
field = 'descr';
|
||||
}
|
||||
|
||||
if (mytab) {
|
||||
console.log('Delete ', table)
|
||||
await mytab.deleteMany({});
|
||||
|
||||
await this.insertIntoDb_NoDuplicate(false, table, mytab, field)
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
},
|
||||
|
||||
async popolaTabelleNuove() {
|
||||
@@ -65,45 +129,51 @@ module.exports = {
|
||||
let ris = null;
|
||||
try {
|
||||
|
||||
if (abilita) {
|
||||
// Sectors
|
||||
const {Sector} = require('../models/sector');
|
||||
await this.insertIntoDb_NoDuplicate('sectors', Sector, 'descr')
|
||||
const {City} = require('../models/city');
|
||||
const {Province} = require('../models/province');
|
||||
|
||||
// CatGrps
|
||||
const {CatGrp} = require('../models/catgrp');
|
||||
await this.insertIntoDb_NoDuplicate('catgrps', CatGrp, 'descr')
|
||||
console.log('INIZIO - popolaTabelleNuove')
|
||||
|
||||
// Skills (Competenze)
|
||||
const {Skill} = require('../models/skill');
|
||||
await this.insertIntoDb_NoDuplicate('skills', Skill, 'descr')
|
||||
// Sectors
|
||||
const {Sector} = require('../models/sector');
|
||||
await this.insertIntoDb_NoDuplicate(abilita, 'sectors', Sector, 'descr')
|
||||
|
||||
// SubSectors
|
||||
const {SubSkill} = require('../models/subskill');
|
||||
await this.insertIntoDb_NoDuplicate('subskills', SubSkill, 'descr')
|
||||
// CatGrps
|
||||
const {CatGrp} = require('../models/catgrp');
|
||||
await this.insertIntoDb_NoDuplicate(abilita, 'catgrps', CatGrp, 'descr')
|
||||
|
||||
// Levels
|
||||
const {Level} = require('../models/level');
|
||||
await this.insertIntoDb_NoDuplicate('levels', Level, 'descr')
|
||||
// Skills (Competenze)
|
||||
const {Skill} = require('../models/skill');
|
||||
await this.insertIntoDb_NoDuplicate(abilita, 'skills', Skill, 'descr')
|
||||
|
||||
// Status
|
||||
const {StatusSkill} = require('../models/statusSkill');
|
||||
await this.insertIntoDb_NoDuplicate('statusskills', StatusSkill, 'descr')
|
||||
// SubSectors
|
||||
const {SubSkill} = require('../models/subskill');
|
||||
await this.insertIntoDb_NoDuplicate(abilita, 'subskills', SubSkill, 'descr')
|
||||
|
||||
if (scrivi_citta) {
|
||||
// Cities
|
||||
const {City} = require('../models/city');
|
||||
await this.insertIntoDb('cities', City)
|
||||
// Levels
|
||||
const {Level} = require('../models/level');
|
||||
await this.insertIntoDb_NoDuplicate(abilita, 'levels', Level, 'descr')
|
||||
|
||||
// Province
|
||||
const {Province} = require('../models/province');
|
||||
await this.insertIntoDb('provinces', Province)
|
||||
}
|
||||
// Status
|
||||
const {StatusSkill} = require('../models/statusSkill');
|
||||
await this.insertIntoDb_NoDuplicate(abilita, 'statusskills', StatusSkill, 'descr')
|
||||
|
||||
// Cities
|
||||
await this.insertIntoDb_NoDuplicate(scrivi_citta, 'cities', City, 'comune')
|
||||
|
||||
// Province
|
||||
await this.insertIntoDb_NoDuplicate(scrivi_citta, 'provinces', Province, 'descr')
|
||||
console.log('FINE - Scrivo le Città')
|
||||
|
||||
// Contribtypes
|
||||
const {Contribtype} = require('../models/contribtype');
|
||||
await this.insertIntoDb_NoDuplicate(abilita, 'contribtypes', Contribtype, 'label')
|
||||
|
||||
const {AdType} = require('../models/adtype');
|
||||
await this.insertIntoDb_NoDuplicate(abilita, 'adtypes', AdType, 'descr')
|
||||
|
||||
console.log('FINE - popolaTabelleNuove')
|
||||
|
||||
// Contribtypes
|
||||
const {Contribtype} = require('../models/contribtype');
|
||||
await this.insertIntoDb_NoDuplicate('contribtypes', Contribtype, 'label')
|
||||
}
|
||||
}catch (e) {
|
||||
console.error('Err: ' + e);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user