versione 1.2.14 :

- aggiornati i file di configurazione, ENV e script non funzionanti., package.
- corretto custom-service-worker.js con CORS
- ottimizzato il server, la chiamata Load iniziale (senza promise, con async/await).
This commit is contained in:
Surya Paolo
2025-03-12 21:03:02 +01:00
parent d106a59bb5
commit 7827e49760
19 changed files with 594 additions and 1549 deletions

View File

@@ -124,7 +124,7 @@ sendNotifSchema.index({ sender: 1 });*/
sendNotifSchema.index({ idapp: 1, typedir: 1, typeid: 1, status: 1, sender: 1 });
sendNotifSchema.statics.setNotifAsRead = function (idapp, username, idnotif) {
sendNotifSchema.statics.setNotifAsRead = async function (idapp, username, idnotif) {
const SendNotif = this;
if (!username)
@@ -133,7 +133,7 @@ sendNotifSchema.statics.setNotifAsRead = function (idapp, username, idnotif) {
try {
if (idnotif) {
return SendNotif.findOneAndUpdate({
return await SendNotif.findOneAndUpdate({
$and: [
{ idapp },
{ dest: username },
@@ -154,11 +154,11 @@ sendNotifSchema.statics.setNotifAsRead = function (idapp, username, idnotif) {
}
};
sendNotifSchema.statics.getRecNotif = function (id) {
sendNotifSchema.statics.getRecNotif = async function (id) {
const SendNotif = this;
try {
return SendNotif.findById(id).lean();
return await SendNotif.findById(id).lean();
} catch (e) {
return null;
}
@@ -602,7 +602,7 @@ sendNotifSchema.statics.getDescrAndLinkByRecNotif = async function (recnotif, us
recnotif.tag = recnotif.tag ? recnotif.tag : tag;
if (!recnotif.descr) {
if (!recnotif.descr) {
recnotif.descr = newdescr;
}
@@ -895,10 +895,9 @@ sendNotifSchema.statics.updateStatusAndDescr = async function (myrecnotif, onlys
// Cerca il record e se lo trova lo aggiorna
const myrec = await SendNotif.findOneAndUpdate(query, { $set: fields_to_update }, {
new: false,
returnNewDocument: true,
});
const myrec = await SendNotif.findOneAndUpdate(query,
{ $set: fields_to_update },
{ returnDocument: "after" }).lean();
if (myrec) {
return { myrecout: myrec, save: true };