remymumoh

controller

Jun 28th, 2019
131
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. 'use strict';
  2. const sql = require('../util/db.js');
  3.  
  4. //Vibe object constructor
  5. const Vibe = function(task){
  6.     this.task = task.task;
  7.     this.status = task.status;
  8. };
  9.  
  10. Vibe.queryVibe = function getAllSuccess(res)
  11. {
  12.     sql.query(`Select count(*) as total from mfmbs.funds_transfer_transaction`, function (err, total) {
  13.  
  14.         if(err) {
  15.             console.log("error: ", err);
  16.             res(null, err);
  17.         }
  18.         else{
  19.             console.log(total[0].total);
  20.             //res(null, task);
  21.         }
  22.     });
  23.     sql.query("SELECT count(*) as fail FROM  mfmbs.funds_transfer_transaction where DATE(FTTRANTIME)=DATE(NOW()) and ERRMSG LIKE '%Core banking down%'", function (err, fail) {
  24.         if(err){
  25.             console.log("error: ", err);
  26.             res(null, err);
  27.         }else{
  28.             console.log(fail[0].fail);
  29.            // res(null, fail);
  30.  
  31.         }
  32.     });
  33.     sql.query("SELECT count(*) as allToday FROM mfmbs.funds_transfer_transaction where DATE(FTTRANTIME)=DATE(NOW())", function (err, allToday) {
  34.         if(err){
  35.             console.log("error: ", err);
  36.             res(null, err);
  37.         }else{
  38.             console.log(allToday[0].allToday);
  39.  
  40.             //res(null, allToday);
  41.         }
  42.     });
  43.     sql.query("SELECT count(*) as success FROM mfmbs.funds_transfer_transaction where DATE(FTTRANTIME)=DATE(NOW()) and FTRESULT='Success'", function (err, success) {
  44.         if(err){
  45.             console.log("error: ", err);
  46.             res(null, err);
  47.         }else{
  48.             console.log(success[0].success);
  49.             //res(null, success);
  50.  
  51.         }
  52.     });
  53.  
  54. };
  55. module.exports= Vibe;
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×