Lista Doni Navi

This commit is contained in:
Paolo Arena
2020-03-21 10:28:26 +01:00
parent fbc85ce06a
commit b2696d1898
139 changed files with 463 additions and 80 deletions

9
src/server/models/settings.js Normal file → Executable file
View File

@@ -43,7 +43,8 @@ const SettingsSchema = new Schema({
});
SettingsSchema.statics.getFieldsForSearch = function () {
return ['key', 'value_str']
return [{ field: 'key', type: tools.FieldType.string },
{ field: 'value_str', type: tools.FieldType.string }, { field: 'value_num', type: tools.FieldType.number }]
};
SettingsSchema.statics.executeQueryTable = function (idapp, params) {
@@ -108,7 +109,7 @@ SettingsSchema.statics.setKeyNum = async function (idapp, key, value) {
return await myrec.save();
} else {
myrec = await Settings.findOneAndUpdate({ idapp, key }, { $set: { value_num: value } }, { new: false});
myrec = await Settings.findOneAndUpdate({ idapp, key }, { $set: { value_num: value } }, { new: false });
}
};
@@ -117,7 +118,7 @@ SettingsSchema.statics.setKeyNum = async function (idapp, key, value) {
SettingsSchema.statics.getKeyNum = async function (idapp, key, mydefault) {
const Settings = this;
const ret = await Settings.findOne({ idapp, key});
const ret = await Settings.findOne({ idapp, key });
if (!!ret) {
return ret.value_num;
} else {
@@ -126,6 +127,6 @@ SettingsSchema.statics.getKeyNum = async function (idapp, key, mydefault) {
};
const Settings = mongoose.model('Settings', SettingsSchema);
const Settings = mongoose.model('Settings', SettingsSchema);
module.exports = { Settings };