Updating framework to meteor 3 and later

This commit is contained in:
Brian McGonagill 2025-06-21 07:28:59 -05:00
parent 717994508a
commit cca29bc591
58 changed files with 2332 additions and 1611 deletions

View file

@ -9,6 +9,10 @@ UserConfig.allow({
// if use id exists, allow insert
return !!userId;
},
update: function(userId, doc){
// if use id exists, allow insert
return !!userId;
},
});
Meteor.methods({
@ -16,10 +20,10 @@ Meteor.methods({
check(pref, String);
if (!this.userId) {
throw new Meteor.Error('Not able to change registration setting. Make sure you are logged in with valid system administrator credentials.');
throw new Meteor.Error('Not able to change theme setting. Make sure you are logged in with valid system administrator credentials.');
}
return UserConfig.insert({
return UserConfig.insertAsync({
user: this.userId,
darkMode: pref,
dateAdded: Date()
@ -29,23 +33,14 @@ Meteor.methods({
check(pref, String);
if (!this.userId) {
throw new Meteor.Error('Not able to change registration setting. Make sure you are logged in with valid system administrator credentials.');
throw new Meteor.Error('Not able to change theme setting. Make sure you are logged in with valid system administrator credentials.');
}
let myConfig = UserConfig.findOne({ user: this.userId });
if (typeof myConfig == 'undefined') {
Meteor.call('add.darkModePref', pref, function(err, result) {
if (err) {
console.log(" ERROR calling the add functioin for dark mode: " + err);
}
});
} else {
return UserConfig.update({ user: this.userId }, {
$set: {
darkMode: pref,
dateUpdate: Date()
}
});
}
return UserConfig.updateAsync({ user: this.userId }, {
$set: {
darkMode: pref,
dateUpdate: Date()
}
});
}
});