SHARE
TWEET

Untitled

a guest Mar 31st, 2019 117 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. return new Promise((resolve, reject) => {
  2.            
  3.            
  4.             client.query('SELECT * FROM users WHERE user_id = $1', [event.key1])
  5.            
  6.             .then(data => {
  7.                
  8.                 userData.push(data.rows);
  9.                
  10.                
  11.                
  12.                 client.query('SELECT * FROM comments WHERE parent_id = $2 ORDER BY points DESC FETCH FIRST 5 ROW ONLY', [event.key2], (error, result) => {
  13.                    if(error){
  14.                        throw error;
  15.                    }else{
  16.  
  17.                        userData.push(result.rows);
  18.                        resolve(userData);
  19.                    }
  20.                    
  21.                 });
  22.                
  23.             })
  24.             .catch(err => {
  25.                 console.log(err);
  26.             });
  27.            
  28.            
  29.         });
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top