- fix notifiche
This commit is contained in:
@@ -161,7 +161,7 @@ sendNotifSchema.statics.getRecNotif = function (id) {
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
sendNotifSchema.statics.findAllNotifByUsernameIdAndIdApp = function (username, lastdataread, idapp, limitrecord, qualinotif) {
|
sendNotifSchema.statics.findAllNotifByUsernameIdAndIdApp = function (username, lastdataread, idapp, limitrecord, qualinotif, arroptionfilter) {
|
||||||
const SendNotif = this;
|
const SendNotif = this;
|
||||||
|
|
||||||
if (!lastdataread)
|
if (!lastdataread)
|
||||||
@@ -179,7 +179,10 @@ sendNotifSchema.statics.findAllNotifByUsernameIdAndIdApp = function (username, l
|
|||||||
} else {
|
} else {
|
||||||
arrfilter.push({ typedir: { $ne: shared_consts.TypeNotifs.TYPEDIR_CIRCUITS } });
|
arrfilter.push({ typedir: { $ne: shared_consts.TypeNotifs.TYPEDIR_CIRCUITS } });
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (arroptionfilter) {
|
||||||
|
arrfilter = [...arrfilter, ...arroptionfilter];
|
||||||
}
|
}
|
||||||
|
|
||||||
return SendNotif.find({
|
return SendNotif.find({
|
||||||
|
|||||||
@@ -159,13 +159,14 @@ async function getNotif(req, res) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const arrnotif = await SendNotif.findAllNotifByUsernameIdAndIdApp(username, lastdataread, idapp, shared_consts.LIMIT_NOTIF_FOR_USER, shared_consts.QualiNotifs.OTHERS);
|
const arrnotif = await SendNotif.findAllNotifByUsernameIdAndIdApp(username, lastdataread, idapp, shared_consts.LIMIT_NOTIF_FOR_USER, shared_consts.QualiNotifs.OTHERS);
|
||||||
const arrnotifcoins = await SendNotif.findAllNotifByUsernameIdAndIdApp(username, lastdataread, idapp, shared_consts.LIMIT_NOTIF_FOR_USER, shared_consts.QualiNotifs.CIRCUITS);
|
const arrnotifcoins_inattesa = await SendNotif.findAllNotifByUsernameIdAndIdApp(username, lastdataread, idapp, shared_consts.LIMIT_NOTIFCOINS_IN_ATTESA_FOR_USER, shared_consts.QualiNotifs.CIRCUITS, [{ status: 0 }]);
|
||||||
|
const arrnotifcoins = await SendNotif.findAllNotifByUsernameIdAndIdApp(username, lastdataread, idapp, shared_consts.LIMIT_NOTIFCOINS_FOR_USER, shared_consts.QualiNotifs.CIRCUITS, [{ status: {$ne: 0 }}]);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//++Todo: Ottimizzare ! Non occorre inviare tutti questi dati !!! Solo per il Circuito ?!
|
//++Todo: Ottimizzare ! Non occorre inviare tutti questi dati !!! Solo per il Circuito ?!
|
||||||
const userprofile = await User.getExtraInfoByUsername(idapp, req.user.username);
|
const userprofile = await User.getExtraInfoByUsername(idapp, req.user.username);
|
||||||
|
|
||||||
return res.send({ arrnotif, arrnotifcoins, userprofile });
|
return res.send({ arrnotif, arrnotifcoins: [...arrnotifcoins, ...arrnotifcoins_inattesa], userprofile });
|
||||||
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.log(e.message);
|
console.log(e.message);
|
||||||
|
|||||||
@@ -3,8 +3,9 @@ module.exports = {
|
|||||||
CHECK_READ_GUIDELINES: 1,
|
CHECK_READ_GUIDELINES: 1,
|
||||||
CHECK_SEE_VIDEO_PRINCIPI: 2,
|
CHECK_SEE_VIDEO_PRINCIPI: 2,
|
||||||
},
|
},
|
||||||
LIMIT_NOTIF_FOR_USER: 100,
|
LIMIT_NOTIF_FOR_USER: 50,
|
||||||
LIMIT_NOTIFCOINS_FOR_USER: 200,
|
LIMIT_NOTIFCOINS_FOR_USER: 50,
|
||||||
|
LIMIT_NOTIFCOINS_IN_ATTESA_FOR_USER: 200,
|
||||||
|
|
||||||
QUERYTYPE_MYGROUP: 1,
|
QUERYTYPE_MYGROUP: 1,
|
||||||
QUERYTYPE_REFUSED_USER_GRP: 2,
|
QUERYTYPE_REFUSED_USER_GRP: 2,
|
||||||
|
|||||||
Reference in New Issue
Block a user