mirror of
https://gitlab.com/bmcgonag/get_my.git
synced 2026-03-27 00:08:49 +00:00
Updating framework to meteor 3 and later
This commit is contained in:
parent
717994508a
commit
cca29bc591
58 changed files with 2332 additions and 1611 deletions
|
|
@ -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 )}});
|
||||
}
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue