default min e max fido e accumulo, per Circuito

This commit is contained in:
Surya Paolo
2023-06-19 00:47:13 +02:00
parent 3393af36aa
commit baf56b59d0
5 changed files with 58 additions and 31 deletions

View File

@@ -413,6 +413,19 @@ router.post('/settable', authenticate, async (req, res) => {
resolve(mytablerec._id && mytable.findById(mytablerec._id))
});
// Controlla se esiste già questo record:
if (shared_consts.TABLES_FIELDS_DESCR_AND_CITY_AND_USER.includes(params.table)) {
if (mytablerec.isNew) {
const trovatoDuplicato = await mytable.findOne({idapp: mytablerec.idapp, descr: mytablerec.descr, idCity: mytablerec.idCity, userId: mytablerec.userId }).lean();
if (trovatoDuplicato) {
// trovatoDuplicato
return res.status(200).send({ code: server_constants.RIS_CODE_REC_DUPLICATED_DESCR_CITY_USER, msg: '' });
}
}
}
return await myPromise
.then(async (doupdate) => {
if (doupdate)