Ver 0.2.8
Added msg Server error in every pages Nuovo Gruppo non funziona. Corretto altre funzioni del Gruppo Errore del server" Network Error", fare pagina test con altri host per vedere se da lo stesso msg, con IP
This commit is contained in:
@@ -50,7 +50,7 @@ const authenticate = (req, res, next) => {
|
|||||||
// tools.mylog('userid', user._id);
|
// tools.mylog('userid', user._id);
|
||||||
|
|
||||||
}).catch((e) => {
|
}).catch((e) => {
|
||||||
tools.mylog("ERR =", e);
|
tools.mylog("ERR authenticate invalid Token =", e);
|
||||||
res.status(server_constants.RIS_CODE_HTTP_INVALID_TOKEN).send();
|
res.status(server_constants.RIS_CODE_HTTP_INVALID_TOKEN).send();
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ const tools = require('../tools/general');
|
|||||||
|
|
||||||
const shared_consts = require('../tools/shared_nodejs');
|
const shared_consts = require('../tools/shared_nodejs');
|
||||||
|
|
||||||
|
|
||||||
mongoose.Promise = global.Promise;
|
mongoose.Promise = global.Promise;
|
||||||
mongoose.level = 'F';
|
mongoose.level = 'F';
|
||||||
|
|
||||||
@@ -14,6 +15,9 @@ mongoose.plugin(schema => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
const MyGroupSchema = new Schema({
|
const MyGroupSchema = new Schema({
|
||||||
|
_id: {
|
||||||
|
type: Number,
|
||||||
|
},
|
||||||
idapp: {
|
idapp: {
|
||||||
type: String,
|
type: String,
|
||||||
},
|
},
|
||||||
@@ -105,6 +109,8 @@ MyGroupSchema.statics.getFieldsForSearch = function() {
|
|||||||
MyGroupSchema.statics.executeQueryTable = function(idapp, params) {
|
MyGroupSchema.statics.executeQueryTable = function(idapp, params) {
|
||||||
params.fieldsearch = this.getFieldsForSearch();
|
params.fieldsearch = this.getFieldsForSearch();
|
||||||
|
|
||||||
|
const { User } = require('./user');
|
||||||
|
|
||||||
if (params.options) {
|
if (params.options) {
|
||||||
if (tools.isBitActive(params.options, shared_consts.OPTIONS_SEARCH_USER_ONLY_FULL_WORDS)) {
|
if (tools.isBitActive(params.options, shared_consts.OPTIONS_SEARCH_USER_ONLY_FULL_WORDS)) {
|
||||||
params.fieldsearch = User.getFieldsForSearchUserFriend();
|
params.fieldsearch = User.getFieldsForSearchUserFriend();
|
||||||
@@ -116,6 +122,27 @@ MyGroupSchema.statics.executeQueryTable = function(idapp, params) {
|
|||||||
return tools.executeQueryTable(this, idapp, params);
|
return tools.executeQueryTable(this, idapp, params);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
MyGroupSchema.pre('save', async function(next) {
|
||||||
|
if (this.isNew) {
|
||||||
|
const myrec = await MyGroup.findOne().limit(1).sort({_id: -1});
|
||||||
|
if (!!myrec) {
|
||||||
|
if (myrec._doc._id === 0)
|
||||||
|
this._id = 1;
|
||||||
|
else
|
||||||
|
this._id = myrec._doc._id + 1;
|
||||||
|
|
||||||
|
} else {
|
||||||
|
this._id = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.date_created = new Date();
|
||||||
|
}
|
||||||
|
|
||||||
|
next();
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
MyGroupSchema.statics.findAllIdApp = async function(idapp) {
|
MyGroupSchema.statics.findAllIdApp = async function(idapp) {
|
||||||
const myfind = {idapp};
|
const myfind = {idapp};
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,5 @@ module.exports = {
|
|||||||
list: [
|
list: [
|
||||||
{_id: 1, descr: 'Offro'},
|
{_id: 1, descr: 'Offro'},
|
||||||
{_id: 2, descr: 'Cerco'},
|
{_id: 2, descr: 'Cerco'},
|
||||||
{_id: 3, descr: 'Evento'},
|
|
||||||
],
|
],
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -144,7 +144,7 @@ router.post(process.env.LINKVERIF_REG, (req, res) => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}).catch((e) => {
|
}).catch((e) => {
|
||||||
console.log(e.message);
|
console.log(process.env.LINKVERIF_REG, e.message);
|
||||||
res.status(400).send();
|
res.status(400).send();
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -177,7 +177,7 @@ router.post(process.env.LINK_REQUEST_NEWPASSWORD, (req, res) => {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
}).catch((e) => {
|
}).catch((e) => {
|
||||||
console.log(e.message);
|
console.log(process.env.LINK_REQUEST_NEWPASSWORD, e.message);
|
||||||
res.status(400).send();
|
res.status(400).send();
|
||||||
res.send({code: server_constants.RIS_CODE_ERR, msg: e});
|
res.send({code: server_constants.RIS_CODE_ERR, msg: e});
|
||||||
});
|
});
|
||||||
@@ -218,7 +218,7 @@ router.post(process.env.LINK_UPDATE_PWD, (req, res) => {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
}).catch((e) => {
|
}).catch((e) => {
|
||||||
console.log(e.message);
|
console.log(process.env.LINK_UPDATE_PWD, e.message);
|
||||||
res.status(400).send();
|
res.status(400).send();
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -232,6 +232,7 @@ router.post('/testServer', (req, res) => {
|
|||||||
|
|
||||||
return res.send(ris);
|
return res.send(ris);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
console.error('testServer', e.message);
|
||||||
return res.status(400).send(e);
|
return res.status(400).send(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -339,6 +340,7 @@ router.post('/settable', authenticate, (req, res) => {
|
|||||||
// tools.mylog('rec', rec);
|
// tools.mylog('rec', rec);
|
||||||
|
|
||||||
}).catch((e) => {
|
}).catch((e) => {
|
||||||
|
console.error('settable', e.message);
|
||||||
if (e.code === 11000) {
|
if (e.code === 11000) {
|
||||||
const id = mytablerec._id;
|
const id = mytablerec._id;
|
||||||
delete mytablerec._doc['_id'];
|
delete mytablerec._doc['_id'];
|
||||||
@@ -360,6 +362,7 @@ router.post('/settable', authenticate, (req, res) => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
console.error('settable', e.message);
|
||||||
return res.status(400).send(e);
|
return res.status(400).send(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -423,13 +426,19 @@ router.post('/gettable', authenticate, (req, res) => {
|
|||||||
return res.status(400).send({});
|
return res.status(400).send({});
|
||||||
}
|
}
|
||||||
|
|
||||||
return mytable.executeQueryTable(req.user.idapp, params).then(ris => {
|
try {
|
||||||
return res.send(ris);
|
|
||||||
|
|
||||||
}).catch((e) => {
|
return mytable.executeQueryTable(req.user.idapp, params).then(ris => {
|
||||||
console.log('gettable: ' + e.message);
|
return res.send(ris);
|
||||||
res.status(400).send(e);
|
|
||||||
});
|
}).catch((e) => {
|
||||||
|
console.error('gettable: ' + e.message);
|
||||||
|
res.status(400).send(e);
|
||||||
|
});
|
||||||
|
}catch (e) {
|
||||||
|
console.error(`ERROR gettable ${params.table}: `, e.message, 'params', params);
|
||||||
|
res.status(500).send(e);
|
||||||
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -113,7 +113,7 @@ module.exports = {
|
|||||||
'mybachecas',
|
'mybachecas',
|
||||||
'mygoods',
|
'mygoods',
|
||||||
'mygroups'],
|
'mygroups'],
|
||||||
TABLES_USER_ID: ['myskills', 'mybachecas', 'mygoods'],
|
TABLES_USER_ID: ['mygroups', 'myskills', 'mybachecas', 'mygoods'],
|
||||||
TABLES_UPDATE_LASTMODIFIED: ['myskills', 'mybachecas', 'mygoods', 'mybots'],
|
TABLES_UPDATE_LASTMODIFIED: ['myskills', 'mybachecas', 'mygoods', 'mybots'],
|
||||||
TABLES_FINDER: ['myskills', 'mybachecas', 'mygoods', 'mygroups'],
|
TABLES_FINDER: ['myskills', 'mybachecas', 'mygoods', 'mygroups'],
|
||||||
TABLES_VISU_CMYSRECCARD: ['myskills', 'mybachecas', 'mygoods'],
|
TABLES_VISU_CMYSRECCARD: ['myskills', 'mybachecas', 'mygoods'],
|
||||||
|
|||||||
Reference in New Issue
Block a user