File tree Expand file tree Collapse file tree 1 file changed +16
-9
lines changed Expand file tree Collapse file tree 1 file changed +16
-9
lines changed Original file line number Diff line number Diff line change @@ -56,15 +56,6 @@ const Balance = require('~/models/Balance');
56
56
silentExit ( 1 ) ;
57
57
}
58
58
59
- if ( ! amount ) {
60
- amount = await askQuestion ( 'amount:' ) ;
61
- }
62
- // Validate the amount
63
- if ( ! amount ) {
64
- console . red ( 'Error: Please specify an amount!' ) ;
65
- silentExit ( 1 ) ;
66
- }
67
-
68
59
// Validate the user
69
60
const user = await User . findOne ( { email } ) . lean ( ) ;
70
61
if ( ! user ) {
@@ -74,6 +65,22 @@ const Balance = require('~/models/Balance');
74
65
console . purple ( `Found user: ${ user . email } ` ) ;
75
66
}
76
67
68
+ let balance = await Balance . findOne ( { user : user . _id } ) . lean ( ) ;
69
+ if ( ! balance ) {
70
+ console . purple ( 'User has no balance!' ) ;
71
+ } else {
72
+ console . purple ( `Current Balance: ${ balance . tokenCredits } ` ) ;
73
+ }
74
+
75
+ if ( ! amount ) {
76
+ amount = await askQuestion ( 'amount:' ) ;
77
+ }
78
+ // Validate the amount
79
+ if ( ! amount ) {
80
+ console . red ( 'Error: Please specify an amount!' ) ;
81
+ silentExit ( 1 ) ;
82
+ }
83
+
77
84
/**
78
85
* Now that we have all the variables we need, lets set the balance
79
86
*/
You can’t perform that action at this time.
0 commit comments