Built motion from commit 9d0783e6.|2.6.13
[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 _0xc2af=['where','attributes','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','stringify','code','error','WhatsappQueueReport,\x20%s,\x20%s','message','result','catch','CreateWhatsappQueueReport','create','body','options','debug','UpdateWhatsappQueueReport','WhatsappQueueReport','update','raw'];(function(_0x7277f,_0x86fcf9){var _0xf31450=function(_0x1d571d){while(--_0x1d571d){_0x7277f['push'](_0x7277f['shift']());}};_0xf31450(++_0x86fcf9);}(_0xc2af,0x1bc));var _0xfc2a=function(_0xe94b0b,_0x3e28d5){_0xe94b0b=_0xe94b0b-0x0;var _0x2be2c7=_0xc2af[_0xe94b0b];return _0x2be2c7;};'use strict';var _=require(_0xfc2a('0x0'));var util=require('util');var moment=require(_0xfc2a('0x1'));var BPromise=require('bluebird');var rs=require(_0xfc2a('0x2'));var fs=require('fs');var Redis=require(_0xfc2a('0x3'));var db=require(_0xfc2a('0x4'))['db'];var utils=require(_0xfc2a('0x5'));var logger=require(_0xfc2a('0x6'))(_0xfc2a('0x7'));var config=require(_0xfc2a('0x8'));var jayson=require(_0xfc2a('0x9'));var client=jayson['client'][_0xfc2a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4c193b,_0x4330c3,_0x5cc7fc){return new BPromise(function(_0x1b96b1,_0x1427a6){return client[_0xfc2a('0xb')](_0x4c193b,_0x5cc7fc)[_0xfc2a('0xc')](function(_0x4c826a){logger[_0xfc2a('0xd')]('WhatsappQueueReport,\x20%s,\x20%s',_0x4330c3,_0xfc2a('0xe'));logger['debug'](_0xfc2a('0xf'),_0x4330c3,_0xfc2a('0xe'),JSON[_0xfc2a('0x10')](_0x4c826a));if(_0x4c826a['error']){if(_0x4c826a['error'][_0xfc2a('0x11')]===0x1f4){logger[_0xfc2a('0x12')](_0xfc2a('0x13'),_0x4330c3,_0x4c826a[_0xfc2a('0x12')][_0xfc2a('0x14')]);return _0x1427a6(_0x4c826a[_0xfc2a('0x12')][_0xfc2a('0x14')]);}logger[_0xfc2a('0x12')](_0xfc2a('0x13'),_0x4330c3,_0x4c826a['error']['message']);return _0x1b96b1(_0x4c826a[_0xfc2a('0x12')][_0xfc2a('0x14')]);}else{logger['info'](_0xfc2a('0x13'),_0x4330c3,_0xfc2a('0xe'));_0x1b96b1(_0x4c826a[_0xfc2a('0x15')][_0xfc2a('0x14')]);}})[_0xfc2a('0x16')](function(_0xa93aa7){logger[_0xfc2a('0x12')](_0xfc2a('0x13'),_0x4330c3,_0xa93aa7);_0x1427a6(_0xa93aa7);});});}exports[_0xfc2a('0x17')]=function(_0x1e1524){var _0x43edb3=this;return new Promise(function(_0x39bcb2,_0x27fb82){return db['WhatsappQueueReport'][_0xfc2a('0x18')](_0x1e1524[_0xfc2a('0x19')],{'raw':_0x1e1524['options']?_0x1e1524[_0xfc2a('0x1a')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x3e88fe){logger[_0xfc2a('0xd')](_0xfc2a('0x17'),_0x1e1524);logger[_0xfc2a('0x1b')](_0xfc2a('0x17'),_0x1e1524,JSON['stringify'](_0x3e88fe));_0x39bcb2(_0x3e88fe);})[_0xfc2a('0x16')](function(_0x4908d7){logger['error']('CreateWhatsappQueueReport',_0x4908d7[_0xfc2a('0x14')],_0x1e1524);_0x27fb82(_0x43edb3['error'](0x1f4,_0x4908d7['message']));});});};exports[_0xfc2a('0x1c')]=function(_0x10396d){var _0x2c732c=this;return new Promise(function(_0x7c9bb5,_0x55ed0a){return db[_0xfc2a('0x1d')][_0xfc2a('0x1e')](_0x10396d[_0xfc2a('0x19')],{'raw':_0x10396d['options']?_0x10396d[_0xfc2a('0x1a')][_0xfc2a('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x10396d['options']?_0x10396d['options'][_0xfc2a('0x20')]||null:null,'attributes':_0x10396d['options']?_0x10396d[_0xfc2a('0x1a')][_0xfc2a('0x21')]||null:null,'limit':_0x10396d[_0xfc2a('0x1a')]?_0x10396d[_0xfc2a('0x1a')]['limit']||null:null})['then'](function(_0x5f4165){logger[_0xfc2a('0xd')](_0xfc2a('0x1c'),_0x10396d);logger['debug'](_0xfc2a('0x1c'),_0x10396d,JSON[_0xfc2a('0x10')](_0x5f4165));_0x7c9bb5(_0x5f4165);})[_0xfc2a('0x16')](function(_0xec7c14){logger[_0xfc2a('0x12')](_0xfc2a('0x1c'),_0xec7c14[_0xfc2a('0x14')],_0x10396d);_0x55ed0a(_0x2c732c[_0xfc2a('0x12')](0x1f4,_0xec7c14[_0xfc2a('0x14')]));});});};