- fix notifiche

This commit is contained in:
Surya Paolo
2024-05-10 00:58:38 +02:00
parent 3b1b2b9c83
commit 1d5002ea0f
6 changed files with 26 additions and 28 deletions

View File

@@ -161,7 +161,7 @@ sendNotifSchema.statics.getRecNotif = function (id) {
};
sendNotifSchema.statics.findAllNotifByUsernameIdAndIdApp = function (username, lastdataread, idapp, limitrecord, typedir) {
sendNotifSchema.statics.findAllNotifByUsernameIdAndIdApp = function (username, lastdataread, idapp, limitrecord, qualinotif) {
const SendNotif = this;
if (!lastdataread)
@@ -173,8 +173,13 @@ sendNotifSchema.statics.findAllNotifByUsernameIdAndIdApp = function (username, l
{ datenotif: { $gt: new Date(lastdataread) } }
];
if (typedir) {
arrfilter.push({typedir});
if (qualinotif) {
if (qualinotif === shared_consts.QualiNotifs.CIRCUITS) {
arrfilter.push({ typedir: shared_consts.TypeNotifs.TYPEDIR_CIRCUITS });
} else {
arrfilter.push({ typedir: { $ne: shared_consts.TypeNotifs.TYPEDIR_CIRCUITS } });
}
}
return SendNotif.find({