- risolto problema cors ?!?
- notifiche transazioni pendenti OK
This commit is contained in:
@@ -487,6 +487,16 @@ CircuitSchema.statics.getInfoCircuitByName = async function (idapp, name) {
|
||||
|
||||
CircuitSchema.statics.getCircuitByName = async function (idapp, name) {
|
||||
|
||||
if (name === 'Circuito RIS Benevento') {
|
||||
name = 'Circuito RIS Campania';
|
||||
} else if (name === 'RIS Pesaro e Urbino') {
|
||||
name = 'Circuito RIS Pesaro e Urbino';
|
||||
} else if (name === 'RIS Catania') {
|
||||
name = 'Circuito RIS Catania';
|
||||
} else if (name === 'RIS Palermo') {
|
||||
name = 'Circuito RIS Palermo';
|
||||
}
|
||||
|
||||
const myfind = {
|
||||
idapp,
|
||||
name,
|
||||
|
||||
@@ -9,6 +9,7 @@ const i18n = require('i18n');
|
||||
const { ObjectID } = require('mongodb');
|
||||
|
||||
const shared_consts = require('../tools/shared_nodejs');
|
||||
const server_constants = require('../tools/server_constants');
|
||||
|
||||
const globalTables = require('../tools/globalTables');
|
||||
|
||||
@@ -109,7 +110,10 @@ const sendNotifSchema = new Schema({
|
||||
},
|
||||
linkaddTelegram: {
|
||||
type: String,
|
||||
}
|
||||
},
|
||||
img: {
|
||||
type: String,
|
||||
},
|
||||
});
|
||||
|
||||
sendNotifSchema.index({ idapp: 1 });
|
||||
@@ -683,7 +687,7 @@ sendNotifSchema.statics.findAllNotifCoinsAllIdAndIdApp = function (idapp) {
|
||||
typeid: shared_consts.TypeNotifs.ID_CIRCUIT_SENDCOINSREQ,
|
||||
status: 0,
|
||||
'extrarec.circuitname': { $ne: "Circuito di TEST" },
|
||||
'extrarec.symbol': { $ne: "RISTeST"},
|
||||
'extrarec.symbol': { $ne: "RISTeST" },
|
||||
}
|
||||
|
||||
return SendNotif.aggregate([
|
||||
@@ -1003,6 +1007,14 @@ sendNotifSchema.statics.createNewNotification = async function (req, res, params
|
||||
myrecnotif.tablerec = table;
|
||||
if (rec && table) {
|
||||
myrecnotif.idrec = rec._id;
|
||||
try {
|
||||
if (rec.photos && rec.photos[0]) {
|
||||
const mydir = server_constants.DIR_UPLOAD + shared_consts.getDirectoryByTable(table, true);
|
||||
myrecnotif.img = mydir + rec.photos[0].imagefile;
|
||||
}
|
||||
} catch (e) {
|
||||
console.error('createNewNotification', e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1279,14 +1291,21 @@ sendNotifSchema.statics.getSumPendingTransactionsDest = async function (idapp, u
|
||||
sendNotifSchema.statics.RemovePendentTransactions = async function (idapp) {
|
||||
const SendNodif = this;
|
||||
|
||||
return await SendNodif.deleteMany(
|
||||
{
|
||||
idapp,
|
||||
typedir: shared_consts.TypeNotifs.TYPEDIR_CIRCUITS,
|
||||
typeid: shared_consts.TypeNotifs.ID_CIRCUIT_SENDCOINSREQ,
|
||||
status: 0,
|
||||
}
|
||||
);
|
||||
try {
|
||||
const result = await SendNodif.deleteMany(
|
||||
{
|
||||
idapp,
|
||||
typedir: shared_consts.TypeNotifs.TYPEDIR_CIRCUITS,
|
||||
typeid: shared_consts.TypeNotifs.ID_CIRCUIT_SENDCOINSREQ,
|
||||
status: 0,
|
||||
}
|
||||
);
|
||||
return result;
|
||||
} catch (error) {
|
||||
console.error('Error deleting documents:', error);
|
||||
throw error;
|
||||
}
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user