mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-16 22:27:26 +01:00
Always use .exec() for .find*() and .update() (#8361)
* add exec where missing in /models * ix taskManager query * fix top-level controllers * fix api-v3 controllers
This commit is contained in:
@@ -58,7 +58,7 @@ api.checkout = {
|
||||
if (sub) {
|
||||
if (sub.discount) {
|
||||
if (!req.query.coupon) throw new BadRequest(res.t('couponCodeRequired'));
|
||||
coupon = await Coupon.findOne({_id: cc.validate(req.query.coupon), event: sub.key});
|
||||
coupon = await Coupon.findOne({_id: cc.validate(req.query.coupon), event: sub.key}).exec();
|
||||
if (!coupon) throw new BadRequest(res.t('invalidCoupon'));
|
||||
}
|
||||
|
||||
@@ -114,7 +114,7 @@ api.checkout = {
|
||||
};
|
||||
|
||||
if (gift) {
|
||||
let member = await User.findById(gift.uuid);
|
||||
let member = await User.findById(gift.uuid).exec();
|
||||
gift.member = member;
|
||||
if (gift.type === 'subscription') method = 'createSubscription';
|
||||
data.paymentMethod = 'Stripe (Gift)';
|
||||
|
||||
Reference in New Issue
Block a user