Built motion from commit e2351160.|2.5.50
[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 _0x6825=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','create','options','raw','CreateWhatsappQueueReport','UpdateWhatsappQueueReport','WhatsappQueueReport','where','attributes','limit','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x5bcdba,_0x2cf1d8){var _0x40f17c=function(_0x1f74b4){while(--_0x1f74b4){_0x5bcdba['push'](_0x5bcdba['shift']());}};_0x40f17c(++_0x2cf1d8);}(_0x6825,0x16f));var _0x5682=function(_0xd917e4,_0x237257){_0xd917e4=_0xd917e4-0x0;var _0x307fbe=_0x6825[_0xd917e4];return _0x307fbe;};'use strict';var _=require(_0x5682('0x0'));var util=require(_0x5682('0x1'));var moment=require(_0x5682('0x2'));var BPromise=require(_0x5682('0x3'));var rs=require(_0x5682('0x4'));var fs=require('fs');var Redis=require(_0x5682('0x5'));var db=require(_0x5682('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x5682('0x7'));var config=require(_0x5682('0x8'));var jayson=require(_0x5682('0x9'));var client=jayson[_0x5682('0xa')][_0x5682('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x37d1aa,_0x2c2ba5,_0x1bc7af){return new BPromise(function(_0x52c7ec,_0x29db8e){return client[_0x5682('0xc')](_0x37d1aa,_0x1bc7af)[_0x5682('0xd')](function(_0xdaa186){logger[_0x5682('0xe')](_0x5682('0xf'),_0x2c2ba5,_0x5682('0x10'));logger['debug'](_0x5682('0x11'),_0x2c2ba5,'request\x20sent',JSON[_0x5682('0x12')](_0xdaa186));if(_0xdaa186[_0x5682('0x13')]){if(_0xdaa186[_0x5682('0x13')][_0x5682('0x14')]===0x1f4){logger[_0x5682('0x13')](_0x5682('0xf'),_0x2c2ba5,_0xdaa186[_0x5682('0x13')]['message']);return _0x29db8e(_0xdaa186[_0x5682('0x13')][_0x5682('0x15')]);}logger[_0x5682('0x13')](_0x5682('0xf'),_0x2c2ba5,_0xdaa186[_0x5682('0x13')]['message']);return _0x52c7ec(_0xdaa186[_0x5682('0x13')][_0x5682('0x15')]);}else{logger[_0x5682('0xe')]('WhatsappQueueReport,\x20%s,\x20%s',_0x2c2ba5,_0x5682('0x10'));_0x52c7ec(_0xdaa186[_0x5682('0x16')]['message']);}})[_0x5682('0x17')](function(_0x2831e4){logger['error'](_0x5682('0xf'),_0x2c2ba5,_0x2831e4);_0x29db8e(_0x2831e4);});});}exports['CreateWhatsappQueueReport']=function(_0x426911){var _0x10cff4=this;return new Promise(function(_0x200fe2,_0x18e1fb){return db['WhatsappQueueReport'][_0x5682('0x18')](_0x426911['body'],{'raw':_0x426911['options']?_0x426911[_0x5682('0x19')][_0x5682('0x1a')]===undefined?!![]:![]:!![]})[_0x5682('0xd')](function(_0x3caa32){logger[_0x5682('0xe')](_0x5682('0x1b'),_0x426911);logger['debug'](_0x5682('0x1b'),_0x426911,JSON[_0x5682('0x12')](_0x3caa32));_0x200fe2(_0x3caa32);})['catch'](function(_0x4309e9){logger[_0x5682('0x13')](_0x5682('0x1b'),_0x4309e9[_0x5682('0x15')],_0x426911);_0x18e1fb(_0x10cff4[_0x5682('0x13')](0x1f4,_0x4309e9[_0x5682('0x15')]));});});};exports[_0x5682('0x1c')]=function(_0x3a4dc4){var _0xd4f3fc=this;return new Promise(function(_0x3367f7,_0x2b8ac6){return db[_0x5682('0x1d')]['update'](_0x3a4dc4['body'],{'raw':_0x3a4dc4['options']?_0x3a4dc4[_0x5682('0x19')][_0x5682('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3a4dc4[_0x5682('0x19')]?_0x3a4dc4['options'][_0x5682('0x1e')]||null:null,'attributes':_0x3a4dc4[_0x5682('0x19')]?_0x3a4dc4[_0x5682('0x19')][_0x5682('0x1f')]||null:null,'limit':_0x3a4dc4[_0x5682('0x19')]?_0x3a4dc4[_0x5682('0x19')][_0x5682('0x20')]||null:null})[_0x5682('0xd')](function(_0x20e9c5){logger[_0x5682('0xe')]('UpdateWhatsappQueueReport',_0x3a4dc4);logger[_0x5682('0x21')](_0x5682('0x1c'),_0x3a4dc4,JSON[_0x5682('0x12')](_0x20e9c5));_0x3367f7(_0x20e9c5);})[_0x5682('0x17')](function(_0x3d6eae){logger[_0x5682('0x13')](_0x5682('0x1c'),_0x3d6eae['message'],_0x3a4dc4);_0x2b8ac6(_0xd4f3fc[_0x5682('0x13')](0x1f4,_0x3d6eae[_0x5682('0x15')]));});});};