AGGIORNAMENTO SITO

👉🏻 E' possibile ora visualizzare la Posizione Reale d'imbarco di quando si verrà aggiunti alle prossime Navi Definitive.
Le posizioni verranno aggiornate ogni ora in automatico!

👉🏻 Ora gli imbarchi comprendono anche le navi provvisorie, pertanto è possibile annullarli oppure cambiare l'Invitante, dalla lista imbarchi.

 👉🏻 E' ora possibile spostare gli invitati solo se si hanno piu' di 2 invitati per ogni Nave già partita.

👨🏻‍💻 Per i Tutor:
👉🏻- Sostituzioni : Cliccando su "Cerca il Primo Disponibile" vi suggerirà in automatico il primo passeggero disponibile per la sostituzione.

This commit is contained in:
Paolo Arena
2020-05-19 00:18:13 +02:00
parent 59910ddec7
commit 140e181fcc
16 changed files with 1483 additions and 533 deletions

View File

@@ -1,14 +1,21 @@
var mongoose = require('mongoose');
const mongoose = require('mongoose');
const Subscription = mongoose.model('subscribers');
const { ListaIngresso } = require('../../models/listaingresso');
const { Graduatoria } = require('../../models/graduatoria');
const { User } = require('../../models/user');
const { Nave } = require('../../models/nave');
const { ObjectID } = require('mongodb');
const tools = require('../../tools/general');
const telegrambot = require('../../telegram/telegrambot');
module.exports = {
doOtherThingsAfterDeleted: async function (tablename, rec) {
doOtherThingsAfterDeleted: async function (tablename, rec, notifBot) {
try {
let ris = null;
if (tablename === 'users') {
await ListaIngresso.deleteUserInListaIngresso(rec.idapp, rec.username);
@@ -23,17 +30,57 @@ module.exports = {
}, { $set: { aportador_solidario: rec.aportador_solidario } }, { new: false });
let msg = 'Spostato ' + user.name + ' ' + user.surname + ' sotto di ' + rec.aportador_solidario;
telegrambot.sendMsgTelegramToTheManagers(idapp, msg);
telegrambot.sendMsgTelegramToTheManagers(rec.idapp, msg);
}
// Delete also all the subscribers record of this User
return Subscription.deleteOne({ userId: rec._id })
ris = Subscription.deleteOne({ userId: rec._id })
}
if (tablename === 'listaingressos') {
// Rimuovi anche nella Tabella Graduatoria
ris = await Graduatoria.deleteOne({ idListaIngresso: ObjectID(rec._id) });
if (!!ris) {
let msg = 'Eliminato Imbarco di ' + rec.name + ' ' + rec.surname + ' [Index = ' + rec.index + ']';
await telegrambot.sendMsgTelegramToTheManagers(rec.idapp, msg);
}
// Elimina anche la Nave se è temporanea!
const arrnave = await Nave.find({ idapp: rec.idapp, ind_order: rec.ind_order });
for (const mynave of arrnave) {
if (!!mynave) {
if (!await Nave.isDefinitiva(rec.idapp, mynave)) {
await Nave.findByIdAndUpdate(mynave.id, { $set: { ind_order: -1 } });
break;
}
}
}
}
if (!!ris) {
if (notifBot) {
// Send Notification to the BOT
let nomerecord = '';
if ((tablename === 'users') || (tablename === 'extralist')) {
nomerecord = rec.name + ' ' + rec.surname + ' (' + rec.username + ')';
}
addtext = 'Eliminato il Record "' + nomerecord + '" dalla tabella ' + tablename + '\n' +
'Eseguito da ' + req.user.name + ' ' + req.user.surname + ' \n';
await telegrambot.sendMsgTelegramToTheManagers(idapp, addtext);
}
}
return ris
} catch (e) {
console.error(e.message);
return false
}
return true;
},
doOtherThingsAfterDuplicated: async function (tablename, myrec, mynewrec) {
try {