File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -56,15 +56,6 @@ const Balance = require('~/models/Balance');
5656 silentExit ( 1 ) ;
5757 }
5858
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-
6859 // Validate the user
6960 const user = await User . findOne ( { email } ) . lean ( ) ;
7061 if ( ! user ) {
@@ -74,6 +65,22 @@ const Balance = require('~/models/Balance');
7465 console . purple ( `Found user: ${ user . email } ` ) ;
7566 }
7667
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+
7784 /**
7885 * Now that we have all the variables we need, lets set the balance
7986 */
You can’t perform that action at this time.
0 commit comments