- Nella Lavagna, cliccando sul nome dell'invitato, compaiono le sue informazioni sugli step rimasti, in dettaglio.

- Ogni utente puo' cosi scegliere di regalare un proprio invitato, cliccando sull'invitato, scrivendo l'username del destinatario e premendo il bottone 'Regala Invitato'.
Al destinatario gli arriverà un messaggio sul Bot Telegram che indica che gli è stato regalato un'invitato.
This commit is contained in:
Paolo Arena
2020-02-02 04:06:32 +01:00
parent 512a8c14e2
commit e386d2550b
9 changed files with 150 additions and 32 deletions

View File

@@ -25,14 +25,23 @@ router.post('/', authenticate, async (req, res) => {
return res.status(404).send({ code: server_constants.RIS_CODE_ERR_UNAUTHORIZED, msg: '' });
}
let aportador_solidario = req.user.aportador_solidario;
let aportador_solidario_nome_completo = req.user.aportador_solidario_nome_completo;
// if (User.isAdmin(req.user.perm) || User.isManager(req.user.perm)) {
// const recuser = await User.findByUsername(idapp, username);
// if (recuser) {
// aportador_solidario_nome_completo = recuser.name + ' ' + recuser.surname;
// }
// }
if (username) {
aportador_solidario = await User.getAportadorSolidarioByUsername(idapp, username)
aportador_solidario = await User.getAportadorSolidarioByUsername(idapp, username);
aportador_solidario_nome_completo = await User.getNameSurnameByUsername(idapp, username);
} else {
username = req.user.username;
}
const dashboard = await User.getDashboard(idapp, aportador_solidario, username);
const dashboard = await User.getDashboard(idapp, aportador_solidario, username, aportador_solidario_nome_completo);
if (dashboard)
res.send({ dashboard });
else

View File

@@ -258,6 +258,7 @@ router.post('/gettable', authenticate, (req, res) => {
router.patch('/chval', authenticate, (req, res) => {
// const idapp = req.body.idapp;
const id = req.body.data.id;
const idapp = req.body.idapp;
const mydata = req.body.data;
const mytable = getTableByTableName(mydata.table);
@@ -276,7 +277,12 @@ router.patch('/chval', authenticate, (req, res) => {
if (!rec) {
return res.status(404).send();
} else {
if (mydata.notifBot) {
// Send Notification to the BOT
telegrambot.sendMsgTelegram(idapp, mydata.notifBot.un, mydata.notifBot.txt)
}
res.send({ code: server_constants.RIS_CODE_OK, msg: '' });
}
}).catch((e) => {
@@ -625,7 +631,8 @@ router.post('/upload/:dir', authenticate, (req, res) => {
// Move in the folder application !
tools.move(file.path, newname, (err) => {
console.log('err:', err);
if (err)
console.log('err:', err);
res.end();
});

View File

@@ -285,7 +285,7 @@ router.post('/login', (req, res) => {
await tools.snooze(3000);
const msg = "Tentativo di Login ERRATO [" + body.username + ' , ' + body.password + ']\n' + '[IP: ' + tools.getiPAddressUser(req) + ']';
tools.mylogshow(msg);
telegrambot.sendMsgTelegramToTheManagers(body.idapp, msg);
// telegrambot.sendMsgTelegramToTheManagers(body.idapp, msg);
res.status(404).send({ code: server_constants.RIS_CODE_LOGIN_ERR });
}
return user