Built motion from commit f6d7e26c.|2.6.14
[motion2.git] / server / api / whatsappQueueReport / whatsappQueueReport.rpc.js
1 // *************************************************************************
2 // *                                                                       *
3 // * xCALLY Motion -  The Omnichannel Contact Center                       *
4 // * Copyright (c) Xenialab s.r.l. All Rights Reserved                     *
5 // *                                                                       *
6 // *************************************************************************
7 // *                                                                       *
8 // * Email: info@xcally.com                                                *
9 // * Website: https://www.xcally.com                                       *
10 // *                                                                       *
11 // *************************************************************************
12 // *                                                                       *
13 // * The SOFTWARE PRODUCT is protected by copyright laws and international *
14 // * copyright treaties, as well as other intellectual property laws and   *
15 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                         *
16 // *                                                                       *
17 // *************************************************************************
18 var _0x9dc3=['CreateWhatsappQueueReport','UpdateWhatsappQueueReport','update','where','attributes','limit','then','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','info','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','WhatsappQueueReport','create','body','options','raw'];(function(_0x228061,_0x376725){var _0x419a7e=function(_0x13668c){while(--_0x13668c){_0x228061['push'](_0x228061['shift']());}};_0x419a7e(++_0x376725);}(_0x9dc3,0x93));var _0x39dc=function(_0x40063e,_0x542fae){_0x40063e=_0x40063e-0x0;var _0x2b6c67=_0x9dc3[_0x40063e];return _0x2b6c67;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x39dc('0x0'));var BPromise=require(_0x39dc('0x1'));var rs=require(_0x39dc('0x2'));var fs=require('fs');var Redis=require(_0x39dc('0x3'));var db=require(_0x39dc('0x4'))['db'];var utils=require(_0x39dc('0x5'));var logger=require(_0x39dc('0x6'))(_0x39dc('0x7'));var config=require('../../config/environment');var jayson=require(_0x39dc('0x8'));var client=jayson[_0x39dc('0x9')][_0x39dc('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4087a2,_0x131683,_0xf87f56){return new BPromise(function(_0x4fe9f8,_0x2a79b3){return client[_0x39dc('0xb')](_0x4087a2,_0xf87f56)['then'](function(_0xacb1ef){logger[_0x39dc('0xc')](_0x39dc('0xd'),_0x131683,_0x39dc('0xe'));logger[_0x39dc('0xf')](_0x39dc('0x10'),_0x131683,_0x39dc('0xe'),JSON[_0x39dc('0x11')](_0xacb1ef));if(_0xacb1ef[_0x39dc('0x12')]){if(_0xacb1ef[_0x39dc('0x12')][_0x39dc('0x13')]===0x1f4){logger[_0x39dc('0x12')](_0x39dc('0xd'),_0x131683,_0xacb1ef[_0x39dc('0x12')][_0x39dc('0x14')]);return _0x2a79b3(_0xacb1ef[_0x39dc('0x12')][_0x39dc('0x14')]);}logger[_0x39dc('0x12')]('WhatsappQueueReport,\x20%s,\x20%s',_0x131683,_0xacb1ef[_0x39dc('0x12')][_0x39dc('0x14')]);return _0x4fe9f8(_0xacb1ef['error'][_0x39dc('0x14')]);}else{logger[_0x39dc('0xc')](_0x39dc('0xd'),_0x131683,_0x39dc('0xe'));_0x4fe9f8(_0xacb1ef[_0x39dc('0x15')]['message']);}})[_0x39dc('0x16')](function(_0x49efc8){logger[_0x39dc('0x12')]('WhatsappQueueReport,\x20%s,\x20%s',_0x131683,_0x49efc8);_0x2a79b3(_0x49efc8);});});}exports['CreateWhatsappQueueReport']=function(_0x502d93){var _0x5bbcfb=this;return new Promise(function(_0x33d3ad,_0x4c3928){return db[_0x39dc('0x17')][_0x39dc('0x18')](_0x502d93[_0x39dc('0x19')],{'raw':_0x502d93['options']?_0x502d93[_0x39dc('0x1a')][_0x39dc('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x4be48a){logger[_0x39dc('0xc')]('CreateWhatsappQueueReport',_0x502d93);logger[_0x39dc('0xf')](_0x39dc('0x1c'),_0x502d93,JSON[_0x39dc('0x11')](_0x4be48a));_0x33d3ad(_0x4be48a);})[_0x39dc('0x16')](function(_0x3974d6){logger['error']('CreateWhatsappQueueReport',_0x3974d6[_0x39dc('0x14')],_0x502d93);_0x4c3928(_0x5bbcfb[_0x39dc('0x12')](0x1f4,_0x3974d6['message']));});});};exports[_0x39dc('0x1d')]=function(_0x2c6466){var _0x48aa87=this;return new Promise(function(_0x4c61e3,_0x16cad1){return db[_0x39dc('0x17')][_0x39dc('0x1e')](_0x2c6466[_0x39dc('0x19')],{'raw':_0x2c6466[_0x39dc('0x1a')]?_0x2c6466['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2c6466[_0x39dc('0x1a')]?_0x2c6466[_0x39dc('0x1a')][_0x39dc('0x1f')]||null:null,'attributes':_0x2c6466['options']?_0x2c6466[_0x39dc('0x1a')][_0x39dc('0x20')]||null:null,'limit':_0x2c6466[_0x39dc('0x1a')]?_0x2c6466[_0x39dc('0x1a')][_0x39dc('0x21')]||null:null})[_0x39dc('0x22')](function(_0x149867){logger[_0x39dc('0xc')](_0x39dc('0x1d'),_0x2c6466);logger['debug'](_0x39dc('0x1d'),_0x2c6466,JSON[_0x39dc('0x11')](_0x149867));_0x4c61e3(_0x149867);})[_0x39dc('0x16')](function(_0x324f5b){logger[_0x39dc('0x12')](_0x39dc('0x1d'),_0x324f5b[_0x39dc('0x14')],_0x2c6466);_0x16cad1(_0x48aa87[_0x39dc('0x12')](0x1f4,_0x324f5b[_0x39dc('0x14')]));});});};