Built motion from commit 511216ff.|2.6.34
[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 _0xa973=['UpdateWhatsappQueueReport','update','body','where','attributes','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','WhatsappQueueReport','create','options','raw','then','CreateWhatsappQueueReport','debug'];(function(_0x45783c,_0x49c56d){var _0x1161da=function(_0x3c5d41){while(--_0x3c5d41){_0x45783c['push'](_0x45783c['shift']());}};_0x1161da(++_0x49c56d);}(_0xa973,0x1ef));var _0x3a97=function(_0x9572ff,_0x188aba){_0x9572ff=_0x9572ff-0x0;var _0x398c8a=_0xa973[_0x9572ff];return _0x398c8a;};'use strict';var _=require(_0x3a97('0x0'));var util=require(_0x3a97('0x1'));var moment=require(_0x3a97('0x2'));var BPromise=require(_0x3a97('0x3'));var rs=require(_0x3a97('0x4'));var fs=require('fs');var Redis=require(_0x3a97('0x5'));var db=require(_0x3a97('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x3a97('0x7'))(_0x3a97('0x8'));var config=require(_0x3a97('0x9'));var jayson=require(_0x3a97('0xa'));var client=jayson[_0x3a97('0xb')][_0x3a97('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x167392,_0x3bad8a,_0x33f689){return new BPromise(function(_0x8ce879,_0xb5423d){return client['request'](_0x167392,_0x33f689)['then'](function(_0x71a4c5){logger[_0x3a97('0xd')](_0x3a97('0xe'),_0x3bad8a,_0x3a97('0xf'));logger['debug'](_0x3a97('0x10'),_0x3bad8a,_0x3a97('0xf'),JSON[_0x3a97('0x11')](_0x71a4c5));if(_0x71a4c5[_0x3a97('0x12')]){if(_0x71a4c5[_0x3a97('0x12')][_0x3a97('0x13')]===0x1f4){logger['error'](_0x3a97('0xe'),_0x3bad8a,_0x71a4c5[_0x3a97('0x12')][_0x3a97('0x14')]);return _0xb5423d(_0x71a4c5[_0x3a97('0x12')][_0x3a97('0x14')]);}logger[_0x3a97('0x12')](_0x3a97('0xe'),_0x3bad8a,_0x71a4c5[_0x3a97('0x12')][_0x3a97('0x14')]);return _0x8ce879(_0x71a4c5[_0x3a97('0x12')][_0x3a97('0x14')]);}else{logger[_0x3a97('0xd')](_0x3a97('0xe'),_0x3bad8a,_0x3a97('0xf'));_0x8ce879(_0x71a4c5[_0x3a97('0x15')][_0x3a97('0x14')]);}})[_0x3a97('0x16')](function(_0xb3d645){logger[_0x3a97('0x12')]('WhatsappQueueReport,\x20%s,\x20%s',_0x3bad8a,_0xb3d645);_0xb5423d(_0xb3d645);});});}exports['CreateWhatsappQueueReport']=function(_0x4fffac){var _0x446344=this;return new Promise(function(_0x28b340,_0x2eaefd){return db[_0x3a97('0x17')][_0x3a97('0x18')](_0x4fffac['body'],{'raw':_0x4fffac[_0x3a97('0x19')]?_0x4fffac[_0x3a97('0x19')][_0x3a97('0x1a')]===undefined?!![]:![]:!![]})[_0x3a97('0x1b')](function(_0xdfe1da){logger[_0x3a97('0xd')](_0x3a97('0x1c'),_0x4fffac);logger[_0x3a97('0x1d')](_0x3a97('0x1c'),_0x4fffac,JSON[_0x3a97('0x11')](_0xdfe1da));_0x28b340(_0xdfe1da);})[_0x3a97('0x16')](function(_0x5b4a0c){logger['error'](_0x3a97('0x1c'),_0x5b4a0c[_0x3a97('0x14')],_0x4fffac);_0x2eaefd(_0x446344[_0x3a97('0x12')](0x1f4,_0x5b4a0c[_0x3a97('0x14')]));});});};exports[_0x3a97('0x1e')]=function(_0x5da384){var _0x42d094=this;return new Promise(function(_0x40aed7,_0x2a58bc){return db[_0x3a97('0x17')][_0x3a97('0x1f')](_0x5da384[_0x3a97('0x20')],{'raw':_0x5da384[_0x3a97('0x19')]?_0x5da384['options'][_0x3a97('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5da384[_0x3a97('0x19')]?_0x5da384[_0x3a97('0x19')][_0x3a97('0x21')]||null:null,'attributes':_0x5da384[_0x3a97('0x19')]?_0x5da384[_0x3a97('0x19')][_0x3a97('0x22')]||null:null,'limit':_0x5da384[_0x3a97('0x19')]?_0x5da384['options']['limit']||null:null})[_0x3a97('0x1b')](function(_0x4e6c50){logger[_0x3a97('0xd')](_0x3a97('0x1e'),_0x5da384);logger[_0x3a97('0x1d')](_0x3a97('0x1e'),_0x5da384,JSON[_0x3a97('0x11')](_0x4e6c50));_0x40aed7(_0x4e6c50);})[_0x3a97('0x16')](function(_0x42e550){logger[_0x3a97('0x12')](_0x3a97('0x1e'),_0x42e550[_0x3a97('0x14')],_0x5da384);_0x2a58bc(_0x42d094[_0x3a97('0x12')](0x1f4,_0x42e550[_0x3a97('0x14')]));});});};