Aggiunto il filtro per Provincia
This commit is contained in:
@@ -234,7 +234,7 @@ module.exports = {
|
||||
{
|
||||
_id: 23,
|
||||
istat: '087005',
|
||||
comune: 'Aci Sant',
|
||||
comune: 'Aci Sant\'Antonio',
|
||||
prov: 'CT',
|
||||
reg: 'SIC',
|
||||
pref: '095',
|
||||
@@ -421,7 +421,7 @@ module.exports = {
|
||||
{
|
||||
_id: 40,
|
||||
istat: '094001',
|
||||
comune: 'Acquaviva d',
|
||||
comune: 'Acquaviva d\'Isernia',
|
||||
prov: 'IS',
|
||||
reg: 'MOL',
|
||||
pref: '0865',
|
||||
@@ -1191,7 +1191,7 @@ module.exports = {
|
||||
{
|
||||
_id: 110,
|
||||
istat: '016003',
|
||||
comune: 'Albano Sant',
|
||||
comune: 'Albano Sant\'Alessandro',
|
||||
prov: 'BG',
|
||||
reg: 'LOM',
|
||||
pref: '035',
|
||||
@@ -30737,7 +30737,7 @@ module.exports = {
|
||||
{
|
||||
_id: 2796,
|
||||
istat: '033021',
|
||||
comune: 'Fiorenzuola d',
|
||||
comune: 'Fiorenzuola d\'Arda',
|
||||
prov: 'PC',
|
||||
reg: 'EMR',
|
||||
pref: '0523',
|
||||
|
||||
@@ -10,6 +10,8 @@ const tools = require('../tools/general');
|
||||
|
||||
const {ObjectID} = require('mongodb');
|
||||
|
||||
const shared_consts = require('../tools/shared_nodejs');
|
||||
|
||||
// Resolving error Unknown modifier: $pushAll
|
||||
mongoose.plugin(schema => {
|
||||
schema.options.usePushEach = true;
|
||||
@@ -111,8 +113,15 @@ CitySchema.statics.executeQueryPickup = async function(idapp, params) {
|
||||
return [];
|
||||
}
|
||||
|
||||
const ris = await City.find({ comune: { $regex : '^' + strfind, $options: 'i' } }, {comune: 1, prov: 1, reg: 1}).lean();
|
||||
return ris;
|
||||
let filterfindexact = {comune: strfind};
|
||||
const risexact = await City.find(filterfindexact, {comune: 1, prov: 1, reg: 1}).lean();
|
||||
|
||||
let filterfind = {comune: {$regex: '^' + strfind, $options: 'i'}};
|
||||
|
||||
const ris = await City.find(filterfind, {comune: 1, prov: 1, reg: 1}).lean().limit(10);
|
||||
|
||||
|
||||
return [...risexact, ...ris];
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -35,6 +35,9 @@ const MySkillSchema = new Schema({
|
||||
{
|
||||
type: Number,
|
||||
}],
|
||||
idSector: {
|
||||
type: Number,
|
||||
},
|
||||
idContribType: [
|
||||
{
|
||||
type: String,
|
||||
@@ -108,10 +111,11 @@ MySkillSchema.statics.findAllIdApp = async function(idapp) {
|
||||
};
|
||||
|
||||
MySkillSchema.statics.getFieldsForSearch = function() {
|
||||
return [{field: 'idSkill', type: tools.FieldType.Number}
|
||||
,{field: 'note', type: tools.FieldType.String}
|
||||
,{field: 'subTitle', type: tools.FieldType.String}
|
||||
];
|
||||
return [
|
||||
{field: 'idSkill', type: tools.FieldType.Number}
|
||||
, {field: 'note', type: tools.FieldType.String}
|
||||
, {field: 'subTitle', type: tools.FieldType.String},
|
||||
];
|
||||
};
|
||||
|
||||
MySkillSchema.statics.executeQueryTable = function(idapp, params) {
|
||||
@@ -145,7 +149,7 @@ MySkillSchema.statics.executeQueryTable = function(idapp, params) {
|
||||
},
|
||||
};
|
||||
|
||||
params = { ...params, ...otherparams };
|
||||
params = {...params, ...otherparams};
|
||||
|
||||
return tools.executeQueryTable(this, idapp, params);
|
||||
};
|
||||
|
||||
83
src/server/models/province.js
Executable file
83
src/server/models/province.js
Executable file
@@ -0,0 +1,83 @@
|
||||
const mongoose = require('mongoose').set('debug', false);
|
||||
const Schema = mongoose.Schema;
|
||||
|
||||
const escapeStringRegexp = require('escape-string-regexp');
|
||||
|
||||
mongoose.Promise = global.Promise;
|
||||
mongoose.level = 'F';
|
||||
|
||||
const tools = require('../tools/general');
|
||||
|
||||
const {ObjectID} = require('mongodb');
|
||||
|
||||
const shared_consts = require('../tools/shared_nodejs');
|
||||
|
||||
// Resolving error Unknown modifier: $pushAll
|
||||
mongoose.plugin(schema => {
|
||||
schema.options.usePushEach = true;
|
||||
});
|
||||
|
||||
const ProvinceSchema = new Schema({
|
||||
_id: {
|
||||
type: Number,
|
||||
},
|
||||
prov: {
|
||||
type: String,
|
||||
unique: true,
|
||||
maxlength: 3,
|
||||
},
|
||||
descr: {
|
||||
type: String,
|
||||
},
|
||||
}, { _id : false });
|
||||
|
||||
|
||||
ProvinceSchema.statics.getFieldsForSearch = function() {
|
||||
return [
|
||||
{field: 'prov', type: tools.FieldType.string},
|
||||
{field: 'descr', type: tools.FieldType.string},
|
||||
];
|
||||
};
|
||||
|
||||
ProvinceSchema.statics.executeQueryTable = function(idapp, params) {
|
||||
params.fieldsearch = this.getFieldsForSearch();
|
||||
|
||||
const strfind = params.search;
|
||||
|
||||
if (strfind === '') {
|
||||
return [];
|
||||
}
|
||||
|
||||
return tools.executeQueryTable(this, 0, params);
|
||||
};
|
||||
|
||||
ProvinceSchema.statics.executeQueryPickup = async function(idapp, params) {
|
||||
|
||||
const strfind = params.search;
|
||||
|
||||
if (strfind === '') {
|
||||
return [];
|
||||
}
|
||||
|
||||
let filterfindexact = {descr: strfind};
|
||||
const risexact = await Province.find(filterfindexact).lean();
|
||||
|
||||
let filterfind = {};
|
||||
|
||||
filterfind = {descr: {$regex: '^' + strfind, $options: 'i'}};
|
||||
|
||||
const ris = await Province.find(filterfind).lean().limit(10);
|
||||
|
||||
return [...risexact, ...ris];
|
||||
|
||||
};
|
||||
|
||||
ProvinceSchema.statics.findAllIdApp = async function(idapp) {
|
||||
const myfind = {};
|
||||
|
||||
return Province.find(myfind);
|
||||
};
|
||||
|
||||
const Province = mongoose.model('Province', ProvinceSchema);
|
||||
|
||||
module.exports = {Province};
|
||||
@@ -35,9 +35,6 @@ const SectorSchema = new Schema({
|
||||
theme: {
|
||||
type: String,
|
||||
},
|
||||
main: {
|
||||
type: Boolean,
|
||||
}
|
||||
});
|
||||
|
||||
SectorSchema.pre('save', async function (next) {
|
||||
|
||||
@@ -47,6 +47,9 @@ const UserSchema = new mongoose.Schema({
|
||||
type: String,
|
||||
required: true,
|
||||
},
|
||||
group: {
|
||||
type: Number,
|
||||
},
|
||||
index: {
|
||||
type: Number,
|
||||
},
|
||||
@@ -222,6 +225,9 @@ const UserSchema = new mongoose.Schema({
|
||||
username_telegram: {
|
||||
type: String,
|
||||
},
|
||||
website: {
|
||||
type: String,
|
||||
},
|
||||
teleg_id: {
|
||||
type: Number,
|
||||
},
|
||||
@@ -1196,6 +1202,7 @@ UserSchema.statics.getUserProfileByUsername = async function(idapp, username) {
|
||||
'profile.biografia': 1,
|
||||
'profile.teleg_id': 1,
|
||||
'profile.username_telegram': 1,
|
||||
'profile.website': 1,
|
||||
'profile.img': 1,
|
||||
'profile.sex': 1,
|
||||
'profile.dateofbirth': 1,
|
||||
@@ -1414,6 +1421,7 @@ function getWhatToShow(idapp, username) {
|
||||
'profile.qualifica': 1,
|
||||
'profile.biografia': 1,
|
||||
'profile.username_telegram': 1,
|
||||
'profile.website': 1,
|
||||
'profile.img': 1,
|
||||
'profile.sex': 1,
|
||||
'profile.dateofbirth': 1,
|
||||
|
||||
89016
src/server/populate/cities.js
Normal file
89016
src/server/populate/cities.js
Normal file
File diff suppressed because it is too large
Load Diff
54
src/server/populate/populate.js
Normal file
54
src/server/populate/populate.js
Normal file
@@ -0,0 +1,54 @@
|
||||
const tools = require('../tools/general');
|
||||
const Path = require('path')
|
||||
|
||||
module.exports = {
|
||||
|
||||
insertIntoDb(tablename, table) {
|
||||
|
||||
try {
|
||||
const pathfile = Path.join(__dirname, tablename + '.js');
|
||||
if (tools.isFileExists(pathfile)) {
|
||||
const mydbfile = require(pathfile);
|
||||
|
||||
if (mydbfile && mydbfile.list) {
|
||||
return table.insertMany(mydbfile.list, {ordered: false}).
|
||||
then((ris) => {
|
||||
console.log('Populate table ', tablename);
|
||||
return !!ris;
|
||||
});
|
||||
}
|
||||
}
|
||||
}catch (e){
|
||||
console.log('error insertIntoDb', e);
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
popolaTabelleNuove() {
|
||||
|
||||
let ris = null;
|
||||
// Sectors
|
||||
const { Sector } = require('../models/sector');
|
||||
this.insertIntoDb('sectors', Sector)
|
||||
|
||||
// Skills (Competenze)
|
||||
const { Skill } = require('../models/skill');
|
||||
this.insertIntoDb('skills', Skill)
|
||||
|
||||
// SubSectors
|
||||
const { SubSkill } = require('../models/subskill');
|
||||
this.insertIntoDb('subskills', SubSkill)
|
||||
|
||||
// Cities
|
||||
const { City } = require('../models/city');
|
||||
ris = this.insertIntoDb('cities', City)
|
||||
|
||||
// Province
|
||||
const { Province } = require('../models/province');
|
||||
ris = this.insertIntoDb('provinces', Province)
|
||||
|
||||
|
||||
},
|
||||
|
||||
};
|
||||
|
||||
114
src/server/populate/provinces.js
Normal file
114
src/server/populate/provinces.js
Normal file
@@ -0,0 +1,114 @@
|
||||
module.exports = {
|
||||
list: [
|
||||
{_id: 1, prov: 'AG', descr: 'Agrigento'},
|
||||
{_id: 2, prov: 'AL', descr: 'Alessandria'},
|
||||
{_id: 3, prov: 'AN', descr: 'Ancona'},
|
||||
{_id: 4, prov: 'AO', descr: 'Aosta'},
|
||||
{_id: 5, prov: 'AR', descr: 'Arezzo'},
|
||||
{_id: 6, prov: 'AP', descr: 'Ascoli Piceno'},
|
||||
{_id: 7, prov: 'AT', descr: 'Asti'},
|
||||
{_id: 8, prov: 'AV', descr: 'Avellino'},
|
||||
{_id: 9, prov: 'BA', descr: 'Bari'},
|
||||
{_id: 10, prov: 'BT', descr: 'Barletta-Andria-Trani'},
|
||||
{_id: 11, prov: 'BL', descr: 'Belluno'},
|
||||
{_id: 12, prov: 'BN', descr: 'Benevento'},
|
||||
{_id: 13, prov: 'BG', descr: 'Bergamo'},
|
||||
{_id: 14, prov: 'BI', descr: 'Biella'},
|
||||
{_id: 15, prov: 'BO', descr: 'Bologna'},
|
||||
{_id: 16, prov: 'BZ', descr: 'Bolzano'},
|
||||
{_id: 17, prov: 'BS', descr: 'Brescia'},
|
||||
{_id: 18, prov: 'BR', descr: 'Brindisi'},
|
||||
{_id: 19, prov: 'CA', descr: 'Cagliari'},
|
||||
{_id: 20, prov: 'CL', descr: 'Caltanissetta'},
|
||||
{_id: 21, prov: 'CB', descr: 'Campobasso'},
|
||||
{_id: 22, prov: 'CI', descr: 'Carbonia-Iglesias'},
|
||||
{_id: 23, prov: 'CE', descr: 'Caserta'},
|
||||
{_id: 24, prov: 'CT', descr: 'Catania'},
|
||||
{_id: 25, prov: 'CZ', descr: 'Catanzaro'},
|
||||
{_id: 26, prov: 'CH', descr: 'Chieti'},
|
||||
{_id: 27, prov: 'CO', descr: 'Como'},
|
||||
{_id: 28, prov: 'CS', descr: 'Cosenza'},
|
||||
{_id: 29, prov: 'CR', descr: 'Cremona'},
|
||||
{_id: 30, prov: 'KR', descr: 'Crotone'},
|
||||
{_id: 31, prov: 'CN', descr: 'Cuneo'},
|
||||
{_id: 32, prov: 'EN', descr: 'Enna'},
|
||||
{_id: 33, prov: 'FM', descr: 'Fermo'},
|
||||
{_id: 34, prov: 'FE', descr: 'Ferrara'},
|
||||
{_id: 35, prov: 'FI', descr: 'Firenze'},
|
||||
{_id: 36, prov: 'FG', descr: 'Foggia'},
|
||||
{_id: 37, prov: 'FC', descr: 'Forli-Cesena'},
|
||||
{_id: 38, prov: 'FR', descr: 'Frosinone'},
|
||||
{_id: 39, prov: 'GE', descr: 'Genova'},
|
||||
{_id: 40, prov: 'GO', descr: 'Gorizia'},
|
||||
{_id: 41, prov: 'GR', descr: 'Grosseto'},
|
||||
{_id: 42, prov: 'IM', descr: 'Imperia'},
|
||||
{_id: 43, prov: 'IS', descr: 'Isernia'},
|
||||
{_id: 44, prov: 'SP', descr: 'La Spezia'},
|
||||
{_id: 45, prov: 'AQ', descr: 'L'},
|
||||
{_id: 46, prov: 'LT', descr: 'Latina'},
|
||||
{_id: 47, prov: 'LE', descr: 'Lecce'},
|
||||
{_id: 48, prov: 'LC', descr: 'Lecco'},
|
||||
{_id: 49, prov: 'LI', descr: 'Livorno'},
|
||||
{_id: 50, prov: 'LO', descr: 'Lodi'},
|
||||
{_id: 51, prov: 'LU', descr: 'Lucca'},
|
||||
{_id: 52, prov: 'MC', descr: 'Macerata'},
|
||||
{_id: 53, prov: 'MN', descr: 'Mantova'},
|
||||
{_id: 54, prov: 'MS', descr: 'Massa-Carrara'},
|
||||
{_id: 55, prov: 'MT', descr: 'Matera'},
|
||||
{_id: 56, prov: 'ME', descr: 'Messina'},
|
||||
{_id: 57, prov: 'MI', descr: 'Milano'},
|
||||
{_id: 58, prov: 'MO', descr: 'Modena'},
|
||||
{_id: 59, prov: 'MB', descr: 'Monza e della Brianza'},
|
||||
{_id: 60, prov: 'NA', descr: 'Napoli'},
|
||||
{_id: 61, prov: 'NO', descr: 'Novara'},
|
||||
{_id: 62, prov: 'NU', descr: 'Nuoro'},
|
||||
{_id: 63, prov: 'OT', descr: 'Olbia-Tempio'},
|
||||
{_id: 64, prov: 'OR', descr: 'Oristano'},
|
||||
{_id: 65, prov: 'PD', descr: 'Padova'},
|
||||
{_id: 66, prov: 'PA', descr: 'Palermo'},
|
||||
{_id: 67, prov: 'PR', descr: 'Parma'},
|
||||
{_id: 68, prov: 'PV', descr: 'Pavia'},
|
||||
{_id: 69, prov: 'PG', descr: 'Perugia'},
|
||||
{_id: 70, prov: 'PU', descr: 'Pesaro e Urbino'},
|
||||
{_id: 71, prov: 'PE', descr: 'Pescara'},
|
||||
{_id: 72, prov: 'PC', descr: 'Piacenza'},
|
||||
{_id: 73, prov: 'PI', descr: 'Pisa'},
|
||||
{_id: 74, prov: 'PT', descr: 'Pistoia'},
|
||||
{_id: 75, prov: 'PN', descr: 'Pordenone'},
|
||||
{_id: 76, prov: 'PZ', descr: 'Potenza'},
|
||||
{_id: 77, prov: 'PO', descr: 'Prato'},
|
||||
{_id: 78, prov: 'RG', descr: 'Ragusa'},
|
||||
{_id: 79, prov: 'RA', descr: 'Ravenna'},
|
||||
{_id: 80, prov: 'RC', descr: 'Reggio Calabria'},
|
||||
{_id: 81, prov: 'RE', descr: 'Reggio Emilia'},
|
||||
{_id: 82, prov: 'RI', descr: 'Rieti'},
|
||||
{_id: 83, prov: 'RN', descr: 'Rimini'},
|
||||
{_id: 84, prov: 'RM', descr: 'Roma'},
|
||||
{_id: 85, prov: 'RO', descr: 'Rovigo'},
|
||||
{_id: 86, prov: 'SA', descr: 'Salerno'},
|
||||
{_id: 87, prov: 'VS', descr: 'Medio Campidano'},
|
||||
{_id: 88, prov: 'SS', descr: 'Sassari'},
|
||||
{_id: 89, prov: 'SV', descr: 'Savona'},
|
||||
{_id: 90, prov: 'SI', descr: 'Siena'},
|
||||
{_id: 91, prov: 'SR', descr: 'Siracusa'},
|
||||
{_id: 92, prov: 'SO', descr: 'Sondrio'},
|
||||
{_id: 93, prov: 'TA', descr: 'Taranto'},
|
||||
{_id: 94, prov: 'TE', descr: 'Teramo'},
|
||||
{_id: 95, prov: 'TR', descr: 'Terni'},
|
||||
{_id: 96, prov: 'TO', descr: 'Torino'},
|
||||
{_id: 97, prov: 'OG', descr: 'Ogliastra'},
|
||||
{_id: 98, prov: 'TP', descr: 'Trapani'},
|
||||
{_id: 99, prov: 'TN', descr: 'Trento'},
|
||||
{_id: 100, prov: 'TV', descr: 'Treviso'},
|
||||
{_id: 101, prov: 'TS', descr: 'Trieste'},
|
||||
{_id: 102, prov: 'UD', descr: 'Udine'},
|
||||
{_id: 103, prov: 'VA', descr: 'Varese'},
|
||||
{_id: 104, prov: 'VE', descr: 'Venezia'},
|
||||
{_id: 105, prov: 'VB', descr: 'Verbano-Cusio-Ossola'},
|
||||
{_id: 106, prov: 'VC', descr: 'Vercelli'},
|
||||
{_id: 107, prov: 'VR', descr: 'Verona'},
|
||||
{_id: 108, prov: 'VV', descr: 'Vibo Valentia'},
|
||||
{_id: 109, prov: 'VI', descr: 'Vicenza'},
|
||||
{_id: 110, prov: 'VT', descr: 'Viterbo'},
|
||||
],
|
||||
};
|
||||
56
src/server/populate/sectors.js
Normal file
56
src/server/populate/sectors.js
Normal file
@@ -0,0 +1,56 @@
|
||||
module.exports = {
|
||||
list: [
|
||||
{
|
||||
_id: 1,
|
||||
descr: "Abitare",
|
||||
},
|
||||
{
|
||||
_id: 2,
|
||||
descr: "Alimentazione",
|
||||
},
|
||||
{
|
||||
_id: 30,
|
||||
descr: "Assistenza Legale",
|
||||
},
|
||||
{
|
||||
_id: 1,
|
||||
descr: "Autodeterminazione",
|
||||
},
|
||||
{
|
||||
_id: 1,
|
||||
descr: "Gruppi Locali",
|
||||
},
|
||||
{
|
||||
_id: 1,
|
||||
descr: "Istruzione",
|
||||
},
|
||||
{
|
||||
_id: 1,
|
||||
descr: "Lavoro",
|
||||
},
|
||||
{
|
||||
_id: 1,
|
||||
descr: "Mobilità",
|
||||
},
|
||||
{
|
||||
_id: 1,
|
||||
descr: "Salute",
|
||||
},
|
||||
{
|
||||
_id: 1,
|
||||
descr: "Sport",
|
||||
},
|
||||
{
|
||||
_id: 1,
|
||||
descr: "Tecnologia",
|
||||
},
|
||||
{
|
||||
_id: 1,
|
||||
descr: "",
|
||||
},
|
||||
{
|
||||
_id: 1,
|
||||
descr: "",
|
||||
},
|
||||
]
|
||||
}
|
||||
@@ -21,6 +21,8 @@ const {Graduatoria} = require('../models/graduatoria');
|
||||
const mongoose = require('mongoose').set('debug', false);
|
||||
const cfgserver = mongoose.model('cfgserver');
|
||||
|
||||
const uuidv4 = require('uuid/v4'); // I chose v4 ‒ you can select others
|
||||
|
||||
const ftp = require('../ftp/FTPClient'),
|
||||
formidable = require('formidable'),
|
||||
folder = path.join(__dirname, 'upload');
|
||||
@@ -48,6 +50,7 @@ const {SubSkill} = require('../models/subskill');
|
||||
const {MySkill} = require('../models/myskill');
|
||||
const {StatusSkill} = require('../models/statusSkill');
|
||||
const {City} = require('../models/city');
|
||||
const {Province} = require('../models/province');
|
||||
const {Sector} = require('../models/sector');
|
||||
const {Level} = require('../models/level');
|
||||
const Pickup = require('../models/pickup');
|
||||
@@ -313,14 +316,16 @@ function getTableByTableName(tablename) {
|
||||
mytable = StatusSkill;
|
||||
else if (tablename === 'cities')
|
||||
mytable = City;
|
||||
else if (tablename === 'provinces')
|
||||
mytable = Province;
|
||||
else if (tablename === 'sectors')
|
||||
mytable = Sector;
|
||||
else if (tablename === 'levels')
|
||||
mytable = Level;
|
||||
else if (shared_consts.TablePickup.includes(tablename))
|
||||
mytable = Pickup;
|
||||
else if (shared_consts.TableCities.includes(tablename))
|
||||
mytable = City;
|
||||
//else if (shared_consts.TableCities.includes(tablename))
|
||||
// mytable = City;
|
||||
|
||||
return mytable;
|
||||
}
|
||||
@@ -1602,16 +1607,29 @@ function uploadFile(req, res, version) {
|
||||
|
||||
// Create Dir if doesn't exist:
|
||||
tools.mkdirpath(mydir);
|
||||
|
||||
let filename = file.name;
|
||||
let ext = path.extname(filename);
|
||||
|
||||
//++Todo: Modifica del nomefile... da passare al frontend
|
||||
//if (mydir.includes('profile')) {
|
||||
// filename = uuidv4() + ext;
|
||||
//}
|
||||
|
||||
file.name = filename
|
||||
let newname = mydir + '/' + file.name;
|
||||
let resized_img = mydir + '/' + server_constants.PREFIX_IMG + file.name;
|
||||
let resized_img = mydir + '/' + server_constants.PREFIX_IMG + filename;
|
||||
|
||||
console.log('move from ', file.path, 'to :', newname);
|
||||
|
||||
// For local: ... resolve this... sending through the static folder...
|
||||
// res.sendFile(path.resolve(file.name));
|
||||
// res.sendFile(path.resolve(filename));
|
||||
|
||||
oldpath = file.path
|
||||
file.path = newname;
|
||||
|
||||
// Move in the folder application !
|
||||
tools.move(file.path, newname, (err) => {
|
||||
tools.move(oldpath, newname, (err) => {
|
||||
if (err)
|
||||
console.log('err:', err);
|
||||
|
||||
@@ -1644,7 +1662,8 @@ function uploadFile(req, res, version) {
|
||||
})
|
||||
|
||||
})();
|
||||
res.end();
|
||||
// res.end();
|
||||
// return res.send({filename: newname });
|
||||
|
||||
});
|
||||
|
||||
@@ -1654,6 +1673,10 @@ function uploadFile(req, res, version) {
|
||||
}
|
||||
});
|
||||
|
||||
form.on('end', function() {
|
||||
console.log('-> upload done');
|
||||
});
|
||||
|
||||
form.on('aborted', () => {
|
||||
console.error('Request aborted by the user');
|
||||
res.status(400).send();
|
||||
@@ -1670,7 +1693,7 @@ function uploadFile(req, res, version) {
|
||||
}
|
||||
|
||||
router.post('/upload/:dir', authenticate, (req, res) => {
|
||||
uploadFile(req, res, 0);
|
||||
return uploadFile(req, res, 0);
|
||||
|
||||
});
|
||||
|
||||
@@ -1679,7 +1702,7 @@ router.post('/uploadnew/:vers/:dir/', authenticate, (req, res) => {
|
||||
let version = tools.getVersionint(versionstr);
|
||||
|
||||
try {
|
||||
uploadFile(req, res, version);
|
||||
return uploadFile(req, res, version);
|
||||
|
||||
} catch (e) {
|
||||
console.log('error', e);
|
||||
|
||||
@@ -73,6 +73,7 @@ router.post('/', async (req, res) => {
|
||||
'email',
|
||||
'password',
|
||||
'username',
|
||||
'group',
|
||||
'name',
|
||||
'surname',
|
||||
'idapp',
|
||||
|
||||
@@ -11,6 +11,7 @@ const cors = require('cors');
|
||||
const fs = require('fs');
|
||||
|
||||
//const throttle = require('express-throttle-bandwidth');
|
||||
// app.use(throttle(1024 * 128)) // throttling bandwidth
|
||||
|
||||
const port = process.env.PORT;
|
||||
|
||||
@@ -60,6 +61,8 @@ mongoose.set('debug', process.env.DEBUG);
|
||||
const cfgserver = mongoose.model('cfgserver');
|
||||
const { ObjectID } = require('mongodb');
|
||||
|
||||
const populate = require('./populate/populate');
|
||||
|
||||
const printf = require('util').format;
|
||||
|
||||
myLoad().then(ris => {
|
||||
@@ -253,6 +256,8 @@ async function mystart() {
|
||||
|
||||
await resetProcessingJob();
|
||||
|
||||
populate.popolaTabelleNuove();
|
||||
|
||||
faitest();
|
||||
|
||||
|
||||
|
||||
@@ -2044,6 +2044,10 @@ module.exports = {
|
||||
return namesurname;
|
||||
},
|
||||
|
||||
isFileExists(filename) {
|
||||
return fs.existsSync(filename)
|
||||
},
|
||||
|
||||
getiPAddressUser(req) {
|
||||
try {
|
||||
const striniziale = '::ffff:';
|
||||
|
||||
@@ -58,7 +58,6 @@ module.exports = {
|
||||
SITES_KEY_TO_CRYPTED: ['email_pwd'],
|
||||
|
||||
TablePickup: ['countries', 'phones'],
|
||||
TableCities: ['cities', 'province'],
|
||||
|
||||
PaymentTypes: [
|
||||
'Nessuno',
|
||||
@@ -67,6 +66,8 @@ module.exports = {
|
||||
'In Contanti alla CNM'
|
||||
],
|
||||
|
||||
PARAM_SHOW_PROVINCE: 1,
|
||||
|
||||
TABLES_ID_NUMBER: ['permissions', 'levels', 'statusSkills', 'sectors', 'skills', 'subskills', 'cities', 'myskills'],
|
||||
TABLES_USER_ID: ['myskills'],
|
||||
TABLES_UPDATE_LASTMODIFIED: ['myskills', 'mybots'],
|
||||
@@ -163,7 +164,7 @@ module.exports = {
|
||||
|
||||
|
||||
fieldsUserToChange() {
|
||||
return ['_id', 'index', 'username', 'email', 'name', 'surname', 'perm', 'date_reg', 'verified_email', 'verified_by_aportador', 'ipaddr', 'lasttimeonline', 'profile', 'calcstat', 'news_on', 'aportador_solidario', 'made_gift', 'ind_order', 'old_order', 'numinvitati', 'numinvitatiattivi', 'qualified']
|
||||
return ['_id', 'index', 'username', 'group', 'email', 'name', 'surname', 'perm', 'date_reg', 'verified_email', 'verified_by_aportador', 'ipaddr', 'lasttimeonline', 'profile', 'calcstat', 'news_on', 'aportador_solidario', 'made_gift', 'ind_order', 'old_order', 'numinvitati', 'numinvitatiattivi', 'qualified']
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user