Built motion from commit b5413ace.|2.6.9
[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 _0x04e4=['WhatsappQueueReport,\x20%s,\x20%s','message','result','catch','create','body','options','raw','CreateWhatsappQueueReport','WhatsappQueueReport','update','attributes','limit','UpdateWhatsappQueueReport','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','client','request','then','info','request\x20sent','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x153012,_0x5c4456){var _0x2589a5=function(_0xbe8fb9){while(--_0xbe8fb9){_0x153012['push'](_0x153012['shift']());}};_0x2589a5(++_0x5c4456);}(_0x04e4,0xce));var _0x404e=function(_0x3cdd54,_0x1ed991){_0x3cdd54=_0x3cdd54-0x0;var _0x4a20b8=_0x04e4[_0x3cdd54];return _0x4a20b8;};'use strict';var _=require(_0x404e('0x0'));var util=require(_0x404e('0x1'));var moment=require(_0x404e('0x2'));var BPromise=require(_0x404e('0x3'));var rs=require(_0x404e('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x404e('0x5'))['db'];var utils=require(_0x404e('0x6'));var logger=require('../../config/logger')(_0x404e('0x7'));var config=require('../../config/environment');var jayson=require(_0x404e('0x8'));var client=jayson[_0x404e('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1be87a,_0xee2144,_0x2d3816){return new BPromise(function(_0x1cf79b,_0x5de728){return client[_0x404e('0xa')](_0x1be87a,_0x2d3816)[_0x404e('0xb')](function(_0x1266f5){logger[_0x404e('0xc')]('WhatsappQueueReport,\x20%s,\x20%s',_0xee2144,_0x404e('0xd'));logger[_0x404e('0xe')](_0x404e('0xf'),_0xee2144,_0x404e('0xd'),JSON[_0x404e('0x10')](_0x1266f5));if(_0x1266f5['error']){if(_0x1266f5['error']['code']===0x1f4){logger[_0x404e('0x11')](_0x404e('0x12'),_0xee2144,_0x1266f5[_0x404e('0x11')][_0x404e('0x13')]);return _0x5de728(_0x1266f5['error'][_0x404e('0x13')]);}logger[_0x404e('0x11')](_0x404e('0x12'),_0xee2144,_0x1266f5[_0x404e('0x11')][_0x404e('0x13')]);return _0x1cf79b(_0x1266f5['error'][_0x404e('0x13')]);}else{logger[_0x404e('0xc')](_0x404e('0x12'),_0xee2144,_0x404e('0xd'));_0x1cf79b(_0x1266f5[_0x404e('0x14')][_0x404e('0x13')]);}})[_0x404e('0x15')](function(_0x40069c){logger[_0x404e('0x11')](_0x404e('0x12'),_0xee2144,_0x40069c);_0x5de728(_0x40069c);});});}exports['CreateWhatsappQueueReport']=function(_0xd5ca4){var _0x32e33d=this;return new Promise(function(_0x3322ac,_0x4b0d1a){return db['WhatsappQueueReport'][_0x404e('0x16')](_0xd5ca4[_0x404e('0x17')],{'raw':_0xd5ca4[_0x404e('0x18')]?_0xd5ca4[_0x404e('0x18')][_0x404e('0x19')]===undefined?!![]:![]:!![]})[_0x404e('0xb')](function(_0x2b4cf3){logger[_0x404e('0xc')](_0x404e('0x1a'),_0xd5ca4);logger[_0x404e('0xe')]('CreateWhatsappQueueReport',_0xd5ca4,JSON[_0x404e('0x10')](_0x2b4cf3));_0x3322ac(_0x2b4cf3);})[_0x404e('0x15')](function(_0x1b4bd3){logger[_0x404e('0x11')](_0x404e('0x1a'),_0x1b4bd3[_0x404e('0x13')],_0xd5ca4);_0x4b0d1a(_0x32e33d[_0x404e('0x11')](0x1f4,_0x1b4bd3['message']));});});};exports['UpdateWhatsappQueueReport']=function(_0x195858){var _0x1e26bb=this;return new Promise(function(_0x2c367a,_0x581f57){return db[_0x404e('0x1b')][_0x404e('0x1c')](_0x195858[_0x404e('0x17')],{'raw':_0x195858[_0x404e('0x18')]?_0x195858[_0x404e('0x18')][_0x404e('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x195858[_0x404e('0x18')]?_0x195858['options']['where']||null:null,'attributes':_0x195858[_0x404e('0x18')]?_0x195858[_0x404e('0x18')][_0x404e('0x1d')]||null:null,'limit':_0x195858[_0x404e('0x18')]?_0x195858[_0x404e('0x18')][_0x404e('0x1e')]||null:null})[_0x404e('0xb')](function(_0x3bcd65){logger[_0x404e('0xc')]('UpdateWhatsappQueueReport',_0x195858);logger[_0x404e('0xe')](_0x404e('0x1f'),_0x195858,JSON['stringify'](_0x3bcd65));_0x2c367a(_0x3bcd65);})[_0x404e('0x15')](function(_0x24436c){logger['error'](_0x404e('0x1f'),_0x24436c[_0x404e('0x13')],_0x195858);_0x581f57(_0x1e26bb['error'](0x1f4,_0x24436c['message']));});});};