Lista Amici

Richieste di Fiducia
Accettati
Rifiutati
This commit is contained in:
paoloar77
2022-01-07 01:18:01 +01:00
parent 181af3c895
commit 3b6218d2ba
11 changed files with 1254 additions and 663 deletions

View File

@@ -107,6 +107,12 @@ router.post('/', async (req, res) => {
user.lasttimeonline = new Date();
user.date_reg = new Date();
user.aportador_iniziale = user.aportador_solidario;
if (!tools.getAskToVerifyReg(body.idapp)) {
// Se non devo chiedere di verificare all'Invitato, allora lo verifico direttamente
user.verified_by_aportador = true;
}
/* if (user.idapp === tools.AYNI) {
user.profile.paymenttypes = ['paypal'];
} */
@@ -319,7 +325,7 @@ router.patch('/:id', authenticate, (req, res) => {
});
});
router.post('/profile', (req, res) => {
router.post('/profile', authenticate, (req, res) => {
const username = req.body['username'];
idapp = req.body.idapp;
locale = req.body.locale;
@@ -470,6 +476,45 @@ router.post('/import_extralist', async (req, res) => {
res.send(ris);
});
router.post('/friends', authenticate, (req, res) => {
const username = req.user.username;
idapp = req.body.idapp;
locale = req.body.locale;
return User.getFriendsByUsername(idapp, username).then((ris) => {
res.send(ris);
}).catch((e) => {
tools.mylog('ERRORE IN Profile: ' + e.message);
res.status(400).send();
});
});
router.post('/friends/cmd', authenticate, (req, res) => {
const usernameLogged = req.user.username;
const idapp = req.body.idapp;
const locale = req.body.locale;
const usernameOrig = req.body.usernameOrig;
const usernameDest = req.body.usernameDest;
const cmd = req.body.cmd;
const value = req.body.value;
if (!User.isAdmin(req.user.perm) || !User.isManager(req.user.perm)) {
// If without permissions, exit
if (usernameOrig !== usernameLogged) {
return res.status(404).send({code: server_constants.RIS_CODE_ERR_UNAUTHORIZED, msg: ''});
}
}
return User.setFriendsCmd(idapp, usernameOrig, usernameDest, cmd, value).then((ris) => {
res.send(ris);
}).catch((e) => {
tools.mylog('ERRORE IN Friends/cmd: ' + e.message);
res.status(400).send();
});
});
async function eseguiDbOp(idapp, mydata, locale) {
let ris = await User.DbOp(idapp, mydata);