We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 25a4c42 commit 6252ca7Copy full SHA for 6252ca7
services/user.service.js
@@ -3,6 +3,7 @@ const jwt = require('jsonwebtoken');
3
const bcrypt = require('bcrypt');
4
const nodemailer = require("nodemailer");
5
const helper=require('../utils/helper');
6
+const Transaction=require('../models/transaction.model');
7
8
const expiry_length = parseInt(process.env.EXPIRY) * 86400;
9
const jwt_headers = {
@@ -112,6 +113,13 @@ const addMoney=async(user_id,added_money)=>
112
113
var money=parseFloat(user.money);
114
money+=parseFloat(added_money);
115
user.money=money;
116
+ const transaction={
117
+ user_id:user._id,
118
+ type:'credit',
119
+ amount:parseFloat(added_money),
120
+ remarks:'add_fund',
121
+ };
122
+ await Transaction.create(transaction);
123
await user.save();
124
}
125
0 commit comments