- Billettera

- Lista Ingressi
 - Send a Tutti la propria Lavagna.
This commit is contained in:
Paolo Arena
2020-02-19 16:09:16 +01:00
parent eccb5bbb57
commit 26715cda44
23 changed files with 1740 additions and 226 deletions

View File

@@ -49,6 +49,8 @@ router.post('/', async (req, res) => {
const body = _.pick(req.body, ['email', 'password', 'username', 'name', 'surname', 'idapp', 'keyappid', 'lang', 'profile', 'aportador_solidario']);
const user = new User(body);
body.email = body.email.toLowerCase();
// tools.mylog("LANG PASSATO = " + user.lang, "IDAPP", user.idapp);
user.linkreg = reg.getlinkregByEmail(body.idapp, body.email, body.username);
@@ -104,16 +106,13 @@ router.post('/', async (req, res) => {
let recextra = null;
recextra = await ExtraList.findByCellAndNameSurname(user.idapp, user.profile.cell, user.name, user.surname);
let nomeaportador_corretto = "";
if (recextra) {
nomeaportador_corretto = recextra.aportador_solidario_name_surname;
if (nomeaportador_corretto === '')
nomeaportador_corretto = recextra.aportador_solidario_originale_name_surname;
}
// recextra = await ExtraList.findByCellAndNameSurname(user.idapp, user.profile.cell, user.name, user.surname);
// let nomeaportador_corretto = "";
// if (recextra) {
// nomeaportador_corretto = recextra.aportador_solidario_name_surname;
// if (nomeaportador_corretto === '')
// nomeaportador_corretto = recextra.aportador_solidario_originale_name_surname;
// }
const lastuser = await User.getLastUser(user.idapp);
const lastextra = await ExtraList.getLastUser(user.idapp);
@@ -130,6 +129,27 @@ router.post('/', async (req, res) => {
if (lastindorder > 0)
user.ind_order = lastindorder + 1;
const numero = user.name.slice(-1);
if ((numero === '2') || (numero === '3') || (numero === '4')) {
recorig = await User.findByCellAndNameSurname(user.idapp, user.profile.cell, user.name.slice(0, -1), user.surname);
if (!!recorig) {
user.profile.teleg_id = recorig.profile.teleg_id;
user.profile.saw_zoom_presentation = recorig.profile.saw_zoom_presentation;
user.profile.saw_and_accepted = recorig.profile.saw_and_accepted;
user.profile.email_paypal = recorig.profile.email_paypal;
user.profile.paymenttypes = recorig.profile.paymenttypes;
let msgseconda = '!!! REGISTRATA ';
if (numero === '2')
msgseconda += 'SECONDA';
else if (numero === '3')
msgseconda += 'TERZA';
else if (numero === '4')
msgseconda += 'QUARTA';
msgseconda += ' UTENZA di ' + recorig.name + ' ' + recorig.surname + ' (' + recorig.username + ') : ' + user.name + ' ' + user.surname + ' (' + user.username + ') ';
telegrambot.sendMsgTelegramToTheManagers(user.idapp, msgseconda);
}
}
namesurname_aportador_reg = await User.getNameSurnameByUsername(user.idapp, user.aportador_solidario);
@@ -184,7 +204,7 @@ router.post('/', async (req, res) => {
return await user.save()
.then(async () => {
return await User.findByUsername(user.idapp, user.username)
return await User.findByUsername(user.idapp, user.username, false)
.then((usertrovato) => {
// tools.mylog("TROVATO USERNAME ? ", user.username, usertrovato);
@@ -228,7 +248,7 @@ router.get('/:idapp/:username', (req, res) => {
var username = req.params.username;
const idapp = req.params.idapp;
User.findByUsername(idapp, username).then((user) => {
User.findByUsername(idapp, username, false).then((user) => {
if (!user) {
return res.status(404).send();
}
@@ -331,6 +351,7 @@ router.post('/login', (req, res) => {
code: server_constants.RIS_CODE_OK,
subsExistonDb: myris.subsExistonDb
});
// tools.mylog("TROVATOOO!");
// tools.mylog('FINE LOGIN')