Built motion from commit 37e1ed56.|2.6.29
[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 _0xcc0f=['error','code','message','result','catch','WhatsappQueueReport','options','raw','CreateWhatsappQueueReport','UpdateWhatsappQueueReport','update','body','where','attributes','limit','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','http','then','info','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x1f96ee,_0x398125){var _0x19796c=function(_0x312bdb){while(--_0x312bdb){_0x1f96ee['push'](_0x1f96ee['shift']());}};_0x19796c(++_0x398125);}(_0xcc0f,0x14f));var _0xfcc0=function(_0x5bc57b,_0x7698b4){_0x5bc57b=_0x5bc57b-0x0;var _0x56333f=_0xcc0f[_0x5bc57b];return _0x56333f;};'use strict';var _=require(_0xfcc0('0x0'));var util=require(_0xfcc0('0x1'));var moment=require('moment');var BPromise=require(_0xfcc0('0x2'));var rs=require(_0xfcc0('0x3'));var fs=require('fs');var Redis=require(_0xfcc0('0x4'));var db=require(_0xfcc0('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xfcc0('0x6'))(_0xfcc0('0x7'));var config=require(_0xfcc0('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xfcc0('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x442516,_0x511160,_0xafde14){return new BPromise(function(_0x2fcf3b,_0x3c4691){return client['request'](_0x442516,_0xafde14)[_0xfcc0('0xa')](function(_0x59c54f){logger[_0xfcc0('0xb')](_0xfcc0('0xc'),_0x511160,_0xfcc0('0xd'));logger[_0xfcc0('0xe')](_0xfcc0('0xf'),_0x511160,_0xfcc0('0xd'),JSON[_0xfcc0('0x10')](_0x59c54f));if(_0x59c54f[_0xfcc0('0x11')]){if(_0x59c54f['error'][_0xfcc0('0x12')]===0x1f4){logger['error'](_0xfcc0('0xc'),_0x511160,_0x59c54f[_0xfcc0('0x11')]['message']);return _0x3c4691(_0x59c54f[_0xfcc0('0x11')]['message']);}logger['error'](_0xfcc0('0xc'),_0x511160,_0x59c54f[_0xfcc0('0x11')][_0xfcc0('0x13')]);return _0x2fcf3b(_0x59c54f[_0xfcc0('0x11')]['message']);}else{logger[_0xfcc0('0xb')](_0xfcc0('0xc'),_0x511160,'request\x20sent');_0x2fcf3b(_0x59c54f[_0xfcc0('0x14')][_0xfcc0('0x13')]);}})[_0xfcc0('0x15')](function(_0x111b2d){logger['error'](_0xfcc0('0xc'),_0x511160,_0x111b2d);_0x3c4691(_0x111b2d);});});}exports['CreateWhatsappQueueReport']=function(_0x4e08c6){var _0x4aca0c=this;return new Promise(function(_0x2d4b49,_0x3688d8){return db[_0xfcc0('0x16')]['create'](_0x4e08c6['body'],{'raw':_0x4e08c6[_0xfcc0('0x17')]?_0x4e08c6[_0xfcc0('0x17')][_0xfcc0('0x18')]===undefined?!![]:![]:!![]})[_0xfcc0('0xa')](function(_0x3303a5){logger[_0xfcc0('0xb')](_0xfcc0('0x19'),_0x4e08c6);logger['debug'](_0xfcc0('0x19'),_0x4e08c6,JSON[_0xfcc0('0x10')](_0x3303a5));_0x2d4b49(_0x3303a5);})[_0xfcc0('0x15')](function(_0x42314a){logger['error'](_0xfcc0('0x19'),_0x42314a['message'],_0x4e08c6);_0x3688d8(_0x4aca0c[_0xfcc0('0x11')](0x1f4,_0x42314a[_0xfcc0('0x13')]));});});};exports[_0xfcc0('0x1a')]=function(_0x6551a4){var _0x201f69=this;return new Promise(function(_0x161e16,_0x3433cc){return db[_0xfcc0('0x16')][_0xfcc0('0x1b')](_0x6551a4[_0xfcc0('0x1c')],{'raw':_0x6551a4[_0xfcc0('0x17')]?_0x6551a4[_0xfcc0('0x17')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x6551a4[_0xfcc0('0x17')]?_0x6551a4[_0xfcc0('0x17')][_0xfcc0('0x1d')]||null:null,'attributes':_0x6551a4['options']?_0x6551a4[_0xfcc0('0x17')][_0xfcc0('0x1e')]||null:null,'limit':_0x6551a4[_0xfcc0('0x17')]?_0x6551a4[_0xfcc0('0x17')][_0xfcc0('0x1f')]||null:null})['then'](function(_0xa2dee4){logger[_0xfcc0('0xb')](_0xfcc0('0x1a'),_0x6551a4);logger[_0xfcc0('0xe')]('UpdateWhatsappQueueReport',_0x6551a4,JSON[_0xfcc0('0x10')](_0xa2dee4));_0x161e16(_0xa2dee4);})[_0xfcc0('0x15')](function(_0xab1f91){logger[_0xfcc0('0x11')](_0xfcc0('0x1a'),_0xab1f91[_0xfcc0('0x13')],_0x6551a4);_0x3433cc(_0x201f69[_0xfcc0('0x11')](0x1f4,_0xab1f91[_0xfcc0('0x13')]));});});};