fix: non riuscivi ad acquistare i RIS al gruppo

- lista linkREG
This commit is contained in:
Surya Paolo
2025-03-23 22:54:04 +01:00
parent d94cbde948
commit 76bacf3f5a
6 changed files with 149 additions and 15 deletions

View File

@@ -393,7 +393,7 @@ router.post('/', async (req, res) => {
} catch (e) {
console.error(e.message);
}
});
router.get('/:idapp/:username', async (req, res) => {
@@ -496,6 +496,28 @@ router.post('/receiveris', authenticate, (req, res) => {
};
});
router.post('/listlinkreg', authenticate, (req, res) => {
const username = req.user ? req.user.username : '';
const groupname = req.body.groupname;
const idapp = req.body.idapp;
try {
if (!username)
return res.send({ code: server_constants.RIS_CODE_ERR });
return User.setLinkReg(idapp, username)
.then(risult => {
res.send({ code: server_constants.RIS_CODE_OK });
}).catch((err) => {
tools.mylog('ERRORE IN listlinkreg: ' + err.message);
res.status(400).send();
});
} catch (e) {
res.status(400).send();
};
});
router.post('/profile', authenticate, (req, res) => {
const usernameOrig = req.user ? req.user.username : '';
const perm = req.user ? req.user.perm : tools.Perm.PERM_NONE;
@@ -1047,7 +1069,7 @@ async function eseguiDbOp(idapp, mydata, locale, req, res) {
// ++ Replace All Circuitname with 'Circuito RIS %s'
await Circuit.replaceAllCircuitNames(idapp);
} else if (mydata.dbop === 'eliminaCatProds') {
await CatProd.deleteMany({ idapp });
await SubCatProd.deleteMany({ idapp });
} else if (mydata.dbop === 'creaUtentiTest') {
@@ -1561,7 +1583,7 @@ async function ConvertiDaIntAStr(mytable) {
const doc = await myrec.save();
ind++;
console.log('++Add (', ind, ')', doc._id);
} catch (err) {
} catch (err) {
const myid = parseInt(err.keyValue._id, 10) + 0;
const canc = await mytable.findOneAndDelete({ _id: myid });
if (canc)