- Gruppi
This commit is contained in:
@@ -1,10 +1,9 @@
|
||||
const mongoose = require('mongoose').set('debug', false)
|
||||
const Subscription = mongoose.model('subscribers');
|
||||
|
||||
const { ListaIngresso } = require('../../models/listaingresso');
|
||||
//const { ListaIngresso } = require('../../models/listaingresso');
|
||||
const { Graduatoria } = require('../../models/graduatoria');
|
||||
const { User } = require('../../models/user');
|
||||
const { Nave } = require('../../models/nave');
|
||||
|
||||
const { ObjectID } = require('mongodb');
|
||||
|
||||
@@ -20,11 +19,11 @@ module.exports = {
|
||||
|
||||
let ris = null;
|
||||
|
||||
const { ListaIngresso } = require('../../models/listaingresso');
|
||||
// const { ListaIngresso } = require('../../models/listaingresso');
|
||||
|
||||
if (tablename === 'users') {
|
||||
|
||||
await ListaIngresso.deleteUserInListaIngresso(rec.idapp, rec.username);
|
||||
// await ListaIngresso.deleteUserInListaIngresso(rec.idapp, rec.username);
|
||||
|
||||
// Controlla se aveva invitati, li regala a quello sopra
|
||||
const arrap = await User.getDownlineByUsername(rec.idapp, rec.username);
|
||||
@@ -43,28 +42,6 @@ module.exports = {
|
||||
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 dalla Graduatoria di ' + rec.name + ' ' + rec.surname + ' (ind_order=' + rec.ind_order + ', num_tess=' + rec.num_tess + ') [Num = ' + rec.index + `] (da ${req.user.name} ${req.user.surname} )` ;
|
||||
await telegrambot.sendMsgTelegramToTheManagers(rec.idapp, msg);
|
||||
tools.writeSostituzioniLog(msg);
|
||||
}
|
||||
|
||||
// Elimina anche la Nave se è temporanea!
|
||||
const arrnave = await Nave.find({ idapp: rec.idapp, ind_order: rec.ind_order, num_tess: rec.num_tess });
|
||||
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) {
|
||||
|
||||
Reference in New Issue
Block a user