Built motion from commit 538092ac.|2.6.10
[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 _0x461b=['message','result','CreateWhatsappQueueReport','create','body','options','raw','then','stringify','catch','update','where','attributes','limit','info','UpdateWhatsappQueueReport','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','debug','error','code'];(function(_0x35ace7,_0x2ae60c){var _0x16f594=function(_0xa3819e){while(--_0xa3819e){_0x35ace7['push'](_0x35ace7['shift']());}};_0x16f594(++_0x2ae60c);}(_0x461b,0xbf));var _0xb461=function(_0x6cf19c,_0x2f3f02){_0x6cf19c=_0x6cf19c-0x0;var _0xce14f3=_0x461b[_0x6cf19c];return _0xce14f3;};'use strict';var _=require(_0xb461('0x0'));var util=require(_0xb461('0x1'));var moment=require(_0xb461('0x2'));var BPromise=require(_0xb461('0x3'));var rs=require(_0xb461('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb461('0x5'))['db'];var utils=require(_0xb461('0x6'));var logger=require(_0xb461('0x7'))(_0xb461('0x8'));var config=require(_0xb461('0x9'));var jayson=require(_0xb461('0xa'));var client=jayson[_0xb461('0xb')][_0xb461('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x11bdba,_0x3ba98c,_0x291481){return new BPromise(function(_0x4eba3e,_0xba86ae){return client[_0xb461('0xd')](_0x11bdba,_0x291481)['then'](function(_0x43ff6c){logger['info'](_0xb461('0xe'),_0x3ba98c,_0xb461('0xf'));logger[_0xb461('0x10')]('WhatsappQueueReport,\x20%s,\x20%s,\x20%s',_0x3ba98c,_0xb461('0xf'),JSON['stringify'](_0x43ff6c));if(_0x43ff6c[_0xb461('0x11')]){if(_0x43ff6c[_0xb461('0x11')][_0xb461('0x12')]===0x1f4){logger[_0xb461('0x11')]('WhatsappQueueReport,\x20%s,\x20%s',_0x3ba98c,_0x43ff6c[_0xb461('0x11')][_0xb461('0x13')]);return _0xba86ae(_0x43ff6c[_0xb461('0x11')][_0xb461('0x13')]);}logger['error']('WhatsappQueueReport,\x20%s,\x20%s',_0x3ba98c,_0x43ff6c[_0xb461('0x11')][_0xb461('0x13')]);return _0x4eba3e(_0x43ff6c[_0xb461('0x11')][_0xb461('0x13')]);}else{logger['info'](_0xb461('0xe'),_0x3ba98c,'request\x20sent');_0x4eba3e(_0x43ff6c[_0xb461('0x14')][_0xb461('0x13')]);}})['catch'](function(_0x33852a){logger[_0xb461('0x11')]('WhatsappQueueReport,\x20%s,\x20%s',_0x3ba98c,_0x33852a);_0xba86ae(_0x33852a);});});}exports[_0xb461('0x15')]=function(_0x3de515){var _0x3ec677=this;return new Promise(function(_0x3a9a51,_0x52e2ab){return db['WhatsappQueueReport'][_0xb461('0x16')](_0x3de515[_0xb461('0x17')],{'raw':_0x3de515['options']?_0x3de515[_0xb461('0x18')][_0xb461('0x19')]===undefined?!![]:![]:!![]})[_0xb461('0x1a')](function(_0x2eb55b){logger['info'](_0xb461('0x15'),_0x3de515);logger['debug'](_0xb461('0x15'),_0x3de515,JSON[_0xb461('0x1b')](_0x2eb55b));_0x3a9a51(_0x2eb55b);})[_0xb461('0x1c')](function(_0xb188e3){logger[_0xb461('0x11')](_0xb461('0x15'),_0xb188e3[_0xb461('0x13')],_0x3de515);_0x52e2ab(_0x3ec677['error'](0x1f4,_0xb188e3['message']));});});};exports['UpdateWhatsappQueueReport']=function(_0xc0033b){var _0x24f5c3=this;return new Promise(function(_0x4d670a,_0x226ffd){return db['WhatsappQueueReport'][_0xb461('0x1d')](_0xc0033b[_0xb461('0x17')],{'raw':_0xc0033b[_0xb461('0x18')]?_0xc0033b[_0xb461('0x18')][_0xb461('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xc0033b[_0xb461('0x18')]?_0xc0033b[_0xb461('0x18')][_0xb461('0x1e')]||null:null,'attributes':_0xc0033b[_0xb461('0x18')]?_0xc0033b[_0xb461('0x18')][_0xb461('0x1f')]||null:null,'limit':_0xc0033b['options']?_0xc0033b[_0xb461('0x18')][_0xb461('0x20')]||null:null})[_0xb461('0x1a')](function(_0x8b8488){logger[_0xb461('0x21')](_0xb461('0x22'),_0xc0033b);logger[_0xb461('0x10')](_0xb461('0x22'),_0xc0033b,JSON[_0xb461('0x1b')](_0x8b8488));_0x4d670a(_0x8b8488);})[_0xb461('0x1c')](function(_0x535e9d){logger[_0xb461('0x11')]('UpdateWhatsappQueueReport',_0x535e9d[_0xb461('0x13')],_0xc0033b);_0x226ffd(_0x24f5c3[_0xb461('0x11')](0x1f4,_0x535e9d[_0xb461('0x13')]));});});};