mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-17 14:47:53 +01:00
feat(admin): track hourglasses as transactions
This commit is contained in:
@@ -577,3 +577,22 @@ schema.methods.updateBalance = async function updateBalance (amount,
|
||||
currentAmount: this.balance,
|
||||
});
|
||||
};
|
||||
|
||||
schema.methods.updateHourglasses = async function updateHourglasses (
|
||||
amount,
|
||||
transactionType,
|
||||
reference,
|
||||
referenceText,
|
||||
) {
|
||||
this.purchased.plan.consecutive.trinkets += amount;
|
||||
|
||||
await Transaction.create({
|
||||
currency: 'hourglasses',
|
||||
userId: this._id,
|
||||
transactionType,
|
||||
amount,
|
||||
reference,
|
||||
referenceText,
|
||||
currentAmount: this.purchased.plan.consecutive.trinkets,
|
||||
});
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user