Version 1.0.1 with RIS Circuit Money Exchange !
This commit is contained in:
@@ -108,17 +108,13 @@ AccountSchema.statics.getAccountsByUsername = async function(idapp, username) {
|
||||
|
||||
};
|
||||
|
||||
AccountSchema.statics.addtoSaldo = async function(id, amount) {
|
||||
const Account = this;
|
||||
AccountSchema.methods.addtoSaldo = async function(amount) {
|
||||
const account = this;
|
||||
|
||||
if (!id)
|
||||
return false;
|
||||
|
||||
const myaccount = await Account.findById(id);
|
||||
if (myaccount) {
|
||||
myaccount.saldo = myaccount.saldo + amount;
|
||||
myaccount.date_updated = new Date();
|
||||
return await myaccount.save();
|
||||
if (account) {
|
||||
account.saldo = account.saldo + amount;
|
||||
account.date_updated = new Date();
|
||||
return await account.save();
|
||||
}
|
||||
|
||||
return null;
|
||||
@@ -158,11 +154,11 @@ AccountSchema.statics.getAccountByUsernameAndCircuitId = async function(idapp, u
|
||||
if (circuitId)
|
||||
mycircuit = await Circuit.getCircuitById(circuitId);
|
||||
else
|
||||
mycircuit = await Circuit.findOne({name: circuitName}).lean();
|
||||
mycircuit = await Circuit.findOne({name: circuitName});
|
||||
|
||||
|
||||
if (mycircuit) {
|
||||
let myaccount = await Account.findOne(myquery).lean();
|
||||
let myaccount = await Account.findOne(myquery);
|
||||
|
||||
if (!myaccount && createifnotexist) {
|
||||
myaccount = new Account({
|
||||
|
||||
Reference in New Issue
Block a user