- fix: Errore se premevo "Aggiungi" e poi "Annulla" poi la tabella non si aggiornava piu.
This commit is contained in:
@@ -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,
|
||||
|
||||
@@ -1448,6 +1448,10 @@ async function eseguiDbOp(idapp, mydata, locale, req, res) {
|
||||
|
||||
} else if (mydata.dbop === 'SvuotaTuttiGliAccessiOnlineConToken') {
|
||||
await User.SvuotaTuttiGliAccessiOnlineConToken(idapp);
|
||||
} else if (mydata.dbop === 'SettaAdTypeOffro_In_Hosps') {
|
||||
const { MyHosp } = require('../models/myhosp');
|
||||
|
||||
await MyHosp.SettaAdTypeOffro_In_Hosps(idapp);
|
||||
} else if (mydata.dbop === 'removeRegulations') {
|
||||
await Circuit.updateMany({}, { $set: { regulation: '' } });
|
||||
|
||||
|
||||
@@ -5134,7 +5134,12 @@ module.exports = {
|
||||
else if (myrec.adType === shared_consts.AdType.CERCO)
|
||||
tiposcambio = 'Cerco';
|
||||
} else if (tablerec === shared_consts.TABLES_MYHOSPS) {
|
||||
iconascambio = this.getIconByAdType(myrec.adType);
|
||||
if (myrec.adType === shared_consts.AdType.CERCO)
|
||||
tiposcambio = 'Cerco';
|
||||
else
|
||||
tiposcambio = 'Offro';
|
||||
|
||||
if (myrec.typeHosp === shared_consts.TYPEHOSP_OSPITALITA)
|
||||
tiposcambio += ' Ospitalità';
|
||||
else if (myrec.typeHosp === shared_consts.TYPEHOSP_SCAMBIOCASA)
|
||||
|
||||
@@ -857,6 +857,7 @@ module.exports = {
|
||||
} else if (table === this.TABLES_MYHOSPS) {
|
||||
proj = {
|
||||
visibile: 1,
|
||||
adType: 1,
|
||||
typeHosp: 1,
|
||||
numMaxPeopleHosp: 1,
|
||||
accomodation: 1,
|
||||
|
||||
Reference in New Issue
Block a user