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
|
|
@ -24,15 +24,22 @@ Meteor.methods({
|
|||
|
||||
// first does this product already exist?
|
||||
|
||||
let prodExists = Products.findOne({ prodName: pname });
|
||||
|
||||
if (!prodExists) {
|
||||
return Products.insert({
|
||||
prodName: pname,
|
||||
prodOwner: this.userId,
|
||||
prodStore: prodStore,
|
||||
});
|
||||
const productIsIn = async() => {
|
||||
let prodExists = await Products.findOneAsync({ prodName: pname });
|
||||
try {
|
||||
if (!prodExists) {
|
||||
return Products.insertAsync({
|
||||
prodName: pname,
|
||||
prodOwner: this.userId,
|
||||
prodStore: prodStore,
|
||||
});
|
||||
}
|
||||
} catch(error) {
|
||||
console.log(" ERROR adding Pdocut: " + error);
|
||||
}
|
||||
}
|
||||
let prodIn = productIsIn();
|
||||
return prodIn;
|
||||
},
|
||||
'edit.product' (prodId, prodName, prodStore) {
|
||||
check(prodId, String);
|
||||
|
|
@ -45,7 +52,7 @@ Meteor.methods({
|
|||
|
||||
let pname = prodName.charAt(0).toUpperCase() + prodName.slice(1);
|
||||
|
||||
return Products.update({ _id: prodId }, {
|
||||
return Products.updateAsync({ _id: prodId }, {
|
||||
$set: {
|
||||
prodName: pname,
|
||||
prodStore: prodStore,
|
||||
|
|
@ -59,6 +66,6 @@ Meteor.methods({
|
|||
throw new Meteor.Error('You are not allowed to delete products. Make sure you are logged in with valid user credentials.');
|
||||
}
|
||||
|
||||
return Products.remove({ _id: prodId });
|
||||
return Products.removeAsync({ _id: prodId });
|
||||
}
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue