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

@ -27,16 +27,23 @@ Meteor.methods({
let username;
if (assignedTo == "self") {
let userInfo = Meteor.users.findOne({ _id: this.userId });
username = userInfo.profile.fullname;
assignedToId = this.userId;
const uInfo = async() => {
let userInfo = await Meteor.users.findOneAsync({ _id: this.userId });
if (!userInfo) {
console.log("No matching user info found.")
} else {
username = userInfo.profile.fullname;
assignedToId = this.userId;
}
}
uInfo();
} else {
username = assignedTo;
}
for (i=0; i < taskDateArr.length; i++) {
for (j=0; j < taskNameArr.length; j++) {
TaskItems.insert({
TaskItems.insertAsync({
taskName: taskNameArr[j].id,
taskDate: taskDateArr[i],
actualDate: actDate[i],
@ -62,14 +69,21 @@ Meteor.methods({
let username;
if (assignedTo == "self") {
let userInfo = Meteor.users.findOne({ _id: this.userId });
username = userInfo.profile.fullname;
assignedToId = this.userId;
const uInfo = async() => {
let userInfo = await Meteor.users.findOneAsync({ _id: this.userId });
if (!userInfo) {
console.log("No matching user info found.")
} else {
username = userInfo.profile.fullname;
assignedToId = this.userId;
}
}
uInfo();
} else {
username = assignedTo;
}
return TaskItems.insert({
return TaskItems.insertAsync({
taskName: taskName,
taskDate: taskDate,
actualDate: actDate,
@ -91,7 +105,7 @@ Meteor.methods({
throw new Meteor.Error('You are not allowed to edit tasks. Make sure you are logged in with valid user credentials.');
}
return TaskItems.update({ _id: taskId }, {
return TaskItems.updateAsync({ _id: taskId }, {
$set: {
taskName: taskName,
taskDate: taskDate,
@ -108,7 +122,7 @@ Meteor.methods({
throw new Meteor.Error('You are not allowed to delete tasks. Make sure you are logged in with valid user credentials.');
}
return TaskItems.remove({ _id: taskId });
return TaskItems.removeAsync({ _id: taskId });
},
'markTask.complete' (taskId) {
check(taskId, String);
@ -117,7 +131,7 @@ Meteor.methods({
throw new Meteor.Error('You are not allowed to mark tasks complete. Make sure you are logged in with valid user credentials.');
}
return TaskItems.update({ _id: taskId }, {
return TaskItems.updateAsync({ _id: taskId }, {
$set: {
isComplete: true,
completedOn: new Date(),
@ -132,7 +146,7 @@ Meteor.methods({
throw new Meteor.Error('You are not allowed to mark tasks not complete. Make sure you are logged in with valid user credentials.');
}
return TaskItems.update({ _id: taskId }, {
return TaskItems.updateAsync({ _id: taskId }, {
$set: {
isComplete: false,
markedUncomplteOn: new Date(),
@ -174,6 +188,6 @@ Meteor.methods({
break;
}
return TaskItems.remove({ actualDate: { $lt: new Date((new Date()) - upToDate )}});
return TaskItems.removeAsync({ actualDate: { $lt: new Date((new Date()) - upToDate )}});
}
});