- fix: Errore se premevo "Aggiungi" e poi "Annulla" poi la tabella non si aggiornava piu.

This commit is contained in:
Surya Paolo
2024-09-30 00:05:47 +02:00
parent 6289a2e2d2
commit 7dac44e0ff
4 changed files with 29 additions and 3 deletions

View File

@@ -30,6 +30,9 @@ const MyHospSchema = new Schema({
visibile: {
type: Boolean
},
adType: {
type: Number,
},
typeHosp: { // scambio casa / ospitalità
type: Number,
},
@@ -327,6 +330,19 @@ MyHospSchema.statics.getCompleteRecord = function (idapp, id) {
};
MyHospSchema.statics.SettaAdTypeOffro_In_Hosps = function () {
const MyHosp = this;
// Set all records 'adType' to shared_consts.AdType.OFFRO
MyHosp.updateMany({}, { $set: { adType: shared_consts.AdType.OFFRO } }, function (err, result) {
if (err) {
console.error('Error updating adType:', err);
} else {
console.log('Successfully updated adType for', result.nModified, 'records');
}
});
};
MyHospSchema.statics.getProject = function () {
let proj = {
visibile: 1,