ff4e88b873efe065413946f8c0a7afb7c553db7b
[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 _0x85ce=['client','http','then','info','request\x20sent','debug','error','code','WhatsappQueueReport,\x20%s,\x20%s','message','result','catch','CreateWhatsappQueueReport','WhatsappQueueReport','create','body','options','raw','UpdateWhatsappQueueReport','where','limit','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x3be00a,_0x2b0509){var _0x13937c=function(_0x25b637){while(--_0x25b637){_0x3be00a['push'](_0x3be00a['shift']());}};_0x13937c(++_0x2b0509);}(_0x85ce,0x1c3));var _0xe85c=function(_0x3925e4,_0x311807){_0x3925e4=_0x3925e4-0x0;var _0x219068=_0x85ce[_0x3925e4];return _0x219068;};'use strict';var _=require(_0xe85c('0x0'));var util=require(_0xe85c('0x1'));var moment=require(_0xe85c('0x2'));var BPromise=require(_0xe85c('0x3'));var rs=require(_0xe85c('0x4'));var fs=require('fs');var Redis=require(_0xe85c('0x5'));var db=require(_0xe85c('0x6'))['db'];var utils=require(_0xe85c('0x7'));var logger=require(_0xe85c('0x8'))(_0xe85c('0x9'));var config=require(_0xe85c('0xa'));var jayson=require('jayson/promise');var client=jayson[_0xe85c('0xb')][_0xe85c('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5542e1,_0x2a95d3,_0x185079){return new BPromise(function(_0x25b67e,_0x54c30d){return client['request'](_0x5542e1,_0x185079)[_0xe85c('0xd')](function(_0x4951e9){logger[_0xe85c('0xe')]('WhatsappQueueReport,\x20%s,\x20%s',_0x2a95d3,_0xe85c('0xf'));logger[_0xe85c('0x10')]('WhatsappQueueReport,\x20%s,\x20%s,\x20%s',_0x2a95d3,_0xe85c('0xf'),JSON['stringify'](_0x4951e9));if(_0x4951e9['error']){if(_0x4951e9[_0xe85c('0x11')][_0xe85c('0x12')]===0x1f4){logger['error'](_0xe85c('0x13'),_0x2a95d3,_0x4951e9[_0xe85c('0x11')][_0xe85c('0x14')]);return _0x54c30d(_0x4951e9['error'][_0xe85c('0x14')]);}logger[_0xe85c('0x11')](_0xe85c('0x13'),_0x2a95d3,_0x4951e9[_0xe85c('0x11')][_0xe85c('0x14')]);return _0x25b67e(_0x4951e9[_0xe85c('0x11')]['message']);}else{logger[_0xe85c('0xe')](_0xe85c('0x13'),_0x2a95d3,_0xe85c('0xf'));_0x25b67e(_0x4951e9[_0xe85c('0x15')][_0xe85c('0x14')]);}})[_0xe85c('0x16')](function(_0x11195f){logger[_0xe85c('0x11')](_0xe85c('0x13'),_0x2a95d3,_0x11195f);_0x54c30d(_0x11195f);});});}exports[_0xe85c('0x17')]=function(_0x245385){var _0x152661=this;return new Promise(function(_0x2100b5,_0x75279){return db[_0xe85c('0x18')][_0xe85c('0x19')](_0x245385[_0xe85c('0x1a')],{'raw':_0x245385['options']?_0x245385[_0xe85c('0x1b')][_0xe85c('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x5dae00){logger[_0xe85c('0xe')](_0xe85c('0x17'),_0x245385);logger['debug'](_0xe85c('0x17'),_0x245385,JSON['stringify'](_0x5dae00));_0x2100b5(_0x5dae00);})[_0xe85c('0x16')](function(_0x5acdf6){logger[_0xe85c('0x11')](_0xe85c('0x17'),_0x5acdf6['message'],_0x245385);_0x75279(_0x152661['error'](0x1f4,_0x5acdf6[_0xe85c('0x14')]));});});};exports[_0xe85c('0x1d')]=function(_0x3e0f21){var _0x5a42e8=this;return new Promise(function(_0x59cd6c,_0x3c6127){return db[_0xe85c('0x18')]['update'](_0x3e0f21[_0xe85c('0x1a')],{'raw':_0x3e0f21[_0xe85c('0x1b')]?_0x3e0f21[_0xe85c('0x1b')][_0xe85c('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3e0f21['options']?_0x3e0f21[_0xe85c('0x1b')][_0xe85c('0x1e')]||null:null,'attributes':_0x3e0f21[_0xe85c('0x1b')]?_0x3e0f21[_0xe85c('0x1b')]['attributes']||null:null,'limit':_0x3e0f21[_0xe85c('0x1b')]?_0x3e0f21['options'][_0xe85c('0x1f')]||null:null})[_0xe85c('0xd')](function(_0x254546){logger['info'](_0xe85c('0x1d'),_0x3e0f21);logger[_0xe85c('0x10')](_0xe85c('0x1d'),_0x3e0f21,JSON[_0xe85c('0x20')](_0x254546));_0x59cd6c(_0x254546);})[_0xe85c('0x16')](function(_0x5621a4){logger[_0xe85c('0x11')](_0xe85c('0x1d'),_0x5621a4[_0xe85c('0x14')],_0x3e0f21);_0x3c6127(_0x5a42e8[_0xe85c('0x11')](0x1f4,_0x5621a4[_0xe85c('0x14')]));});});};