Version 1.0.1 with RIS Circuit Money Exchange !
This commit is contained in:
@@ -338,10 +338,12 @@ router.post('/settable', authenticate, async (req, res) => {
|
||||
if (alreadyexist) {
|
||||
return res.send({code: server_constants.RIS_CODE_REC_ALREADY_EXIST_NAME});
|
||||
}
|
||||
alreadyexist = await Circuit.findOne({idapp, symbol: mydata.symbol});
|
||||
/*alreadyexist = await Circuit.findOne({idapp, symbol: mydata.symbol});
|
||||
if (alreadyexist) {
|
||||
return res.send({code: server_constants.RIS_CODE_REC_ALREADY_EXIST_SYMBOL});
|
||||
}
|
||||
|
||||
*/
|
||||
}
|
||||
|
||||
if (shared_consts.TABLES_UPDATE_LASTMODIFIED.includes(params.table)) {
|
||||
@@ -393,7 +395,7 @@ router.post('/settable', authenticate, async (req, res) => {
|
||||
}
|
||||
if (shared_consts.TABLES_CIRCUITS_NOTIFICATION.includes(params.table)) {
|
||||
typedir = shared_consts.TypeNotifs.TYPEDIR_CIRCUITS;
|
||||
typeid = shared_consts.TypeNotifs.ID_GROUP_NEW_REC;
|
||||
typeid = shared_consts.TypeNotifs.ID_CIRCUIT_NEW_REC;
|
||||
circuitnameDest = myrec ? myrec.name : '';
|
||||
setnotif = true;
|
||||
}
|
||||
@@ -409,18 +411,18 @@ router.post('/settable', authenticate, async (req, res) => {
|
||||
return await User.setGroupsCmd(mydata.idapp, req.user.username,
|
||||
myrec.groupname,
|
||||
shared_consts.GROUPSCMD.SETGROUP, true, req.user.username).then((ris) => {
|
||||
return res.send(myrec);
|
||||
return res.send({rec: myrec, ris});
|
||||
});
|
||||
} else if (params.table === shared_consts.TAB_MYCIRCUITS && isnewrec) {
|
||||
// nuovo Record:
|
||||
// aggiungi il creatore al Circuito stesso
|
||||
return await User.setCircuitCmd(mydata.idapp, req.user.username, myrec.name,
|
||||
shared_consts.CIRCUITCMD.SET, true, req.user.username, extrarec).then((ris) => {
|
||||
return res.send(myrec);
|
||||
return res.send({rec: myrec, ris});
|
||||
});
|
||||
}
|
||||
|
||||
return res.send(myrec);
|
||||
return res.send({rec: myrec, ris: null});
|
||||
}).catch(async (e) => {
|
||||
console.error('settable', e.message);
|
||||
if (e.code === 11000) {
|
||||
@@ -432,7 +434,7 @@ router.post('/settable', authenticate, async (req, res) => {
|
||||
}
|
||||
return await mytablestrutt.findByIdAndUpdate(id, {$set: myfields}).
|
||||
then(async (rec) => {
|
||||
return res.send(rec);
|
||||
return res.send({rec});
|
||||
}).
|
||||
catch((err) => {
|
||||
tools.mylog('error: ', err.message);
|
||||
|
||||
Reference in New Issue
Block a user