Pagina con i link dei Canali territoriali di RISO

Lista Tabelle "Aggiungi" da errore userId...
Aggiunto "Servizi" e alcune sue sottocategorie
Aggiunto anche la conversione della foto piccola alla Foto Profilo
This commit is contained in:
paoloar77
2022-03-09 14:53:09 +01:00
parent 82e3ed7175
commit e79c22a038
13 changed files with 265 additions and 311 deletions

View File

@@ -86,6 +86,24 @@ MsgTemplateSchema.statics.getMsgByLang = async function (idapp, typemsg, lang) {
return { body: '', title: '' };
};
MsgTemplateSchema.statics.getMsgByTitleAndLang = async function (idapp, title, lang) {
const MsgTemplate = this;
try {
const mymsg = await MsgTemplate.findOne({ idapp, title });
if (!!mymsg) {
if ((!!mymsg["msg_" + lang]) && (!!mymsg["title_" + lang])) {
return { body: mymsg["msg_" + lang], title: mymsg["title_" + lang] }
}
}
} catch (e) {
return { body: '', title: '' };
}
return { body: '', title: '' };
};
MsgTemplateSchema.statics.findAllIdApp = async function (idapp) {
const MsgTemplate = this;

View File

@@ -21,14 +21,20 @@ const ProvinceSchema = new Schema({
_id: {
type: Number,
},
reg: {
type: String,
},
prov: {
type: String,
unique: true,
// unique: true,
maxlength: 3,
},
descr: {
type: String,
},
link_grp: {
type: String,
},
}, { _id : false });
@@ -75,7 +81,7 @@ ProvinceSchema.statics.executeQueryPickup = async function(idapp, params) {
ProvinceSchema.statics.findAllIdApp = async function(idapp) {
const myfind = {};
return Province.find(myfind);
return Province.find(myfind).sort({reg: 1, prov: 1});
};
const Province = mongoose.model('Province', ProvinceSchema);

View File

@@ -2076,9 +2076,17 @@ UserSchema.statics.SetTelegramIdSuccess = async function(idapp, id, teleg_id) {
idapp,
_id: id,
}, {$set: fields_to_update}, {new: false}).lean().then((record) => {
return record;
if (record) {
return User.findOne({
idapp,
_id: id
}).lean();
}
});
return null;
};
UserSchema.statics.setUsernameTelegram = async function(