- Codice internazionale numero + Country
This commit is contained in:
@@ -47,6 +47,7 @@ const {StatusSkill} = require('../models/statusSkill');
|
||||
const {City} = require('../models/city');
|
||||
const {Sector} = require('../models/sector');
|
||||
const {Level} = require('../models/level');
|
||||
const Pickup = require('../models/pickup');
|
||||
const {Newstosent} = require('../models/newstosent');
|
||||
const {MyPage} = require('../models/mypage');
|
||||
const {CalZoom} = require('../models/calzoom');
|
||||
@@ -259,7 +260,7 @@ function getTableByTableName(tablename) {
|
||||
mytable = Where;
|
||||
else if (tablename === 'myevents')
|
||||
mytable = MyEvent;
|
||||
else if (tablename === 'contribtype')
|
||||
else if (tablename === 'contribtypes')
|
||||
mytable = Contribtype;
|
||||
else if (tablename === 'paymenttypes')
|
||||
mytable = PaymentType;
|
||||
@@ -307,6 +308,8 @@ function getTableByTableName(tablename) {
|
||||
mytable = Sector;
|
||||
else if (tablename === 'levels')
|
||||
mytable = Level;
|
||||
else if (shared_consts.TablePickup.includes(tablename))
|
||||
mytable = Pickup;
|
||||
|
||||
return mytable;
|
||||
}
|
||||
@@ -318,17 +321,6 @@ router.post('/settable', authenticate, (req, res) => {
|
||||
|
||||
mydata.idapp = req.user.idapp;
|
||||
|
||||
if (shared_consts.TABLES_ID_NUMBER.includes(params.table)) {
|
||||
//if (mydata['_id'] === undefined) {
|
||||
// mydata._id = 1;
|
||||
//}
|
||||
} else if (params.table === 'hours') {
|
||||
|
||||
} else {
|
||||
if (mydata['_id'] === undefined) {
|
||||
mydata._id = new ObjectID();
|
||||
}
|
||||
}
|
||||
|
||||
if (shared_consts.TABLES_USER_ID.includes(params.table)) {
|
||||
mydata.userId = req.user._id;
|
||||
@@ -346,6 +338,15 @@ router.post('/settable', authenticate, (req, res) => {
|
||||
mytablerec.isNew = false;
|
||||
}
|
||||
|
||||
if (shared_consts.TABLES_ID_NUMBER.includes(params.table)) {
|
||||
} else if (params.table === 'hours') {
|
||||
|
||||
} else {
|
||||
if (mydata['_id'] === undefined) {
|
||||
mydata._id = new ObjectID();
|
||||
}
|
||||
}
|
||||
|
||||
return mytablerec.save().then(rec => {
|
||||
// tools.mylog('rec', rec);
|
||||
return res.send(rec);
|
||||
@@ -441,6 +442,25 @@ router.post('/gettable', authenticate, (req, res) => {
|
||||
|
||||
});
|
||||
|
||||
router.post('/pickup', authenticate, (req, res) => {
|
||||
const params = req.body;
|
||||
const mytable = getTableByTableName(params.table);
|
||||
// console.log('mytable', mytable);
|
||||
if (!mytable) {
|
||||
console.log(`Table ${params.table} not found`);
|
||||
return res.status(400).send({});
|
||||
}
|
||||
|
||||
return mytable.executeQueryTable(req.user.idapp, params).then(ris => {
|
||||
return res.send(ris);
|
||||
|
||||
}).catch((e) => {
|
||||
console.log(e.message);
|
||||
res.status(400).send(e);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
router.post('/getpage', async (req, res) => {
|
||||
const params = req.body;
|
||||
const idapp = req.body.idapp;
|
||||
|
||||
Reference in New Issue
Block a user