Advertisement
Guest User

Untitled

a guest
Mar 30th, 2019
139
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // --- code
  2.     loginRoutes.post('/storeLoginTokens', (req, res) => {
  3.         let email = req.param('email');
  4.         let notificationID = req.param('notificationID');
  5.  
  6.         state.db('User').where('email', '=', email).update({
  7.             notificationID: notificationID
  8.         }).then(function (rows) {
  9.             console.log(rows + " record(s) updated."); // = rows affected
  10.  
  11.             if (rows === 0) {
  12.                 res.status(200).send({
  13.                     response: -1
  14.                 })
  15.             } else if (rows === 1) {
  16.                 res.status(200).send({
  17.                     response: 1
  18.                 })
  19.             } else {
  20.                 res.status(406).send({
  21.                     response: -1
  22.                 })
  23.             }
  24.         })
  25.     });
  26.  
  27. // -- TextRow result
  28. [ TextRow {
  29.     user_id: 1,
  30.     first_name: 'asdfasdf',
  31.     last_name: 'asdfdsf',
  32.     email: 'asdf@asdfsadf.edu',
  33.     username: 'asfasfas',
  34.     password: '1234',
  35.     date_of_birth: 1996-12-21T05:00:00.000Z,
  36.     lat: 1234,
  37.     long: null,
  38.     notificationID: null } ]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement