Built motion from commit 25580385.|2.6.2
[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 _0x4f03=['then','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','stringify','code','error','message','info','result','catch','CreateWhatsappQueueReport','WhatsappQueueReport','create','body','options','raw','where','attributes','limit','UpdateWhatsappQueueReport','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request'];(function(_0x482c5c,_0x5d8108){var _0x10826a=function(_0x2f02ad){while(--_0x2f02ad){_0x482c5c['push'](_0x482c5c['shift']());}};_0x10826a(++_0x5d8108);}(_0x4f03,0xb6));var _0x34f0=function(_0x536068,_0x3de52c){_0x536068=_0x536068-0x0;var _0x4a5db2=_0x4f03[_0x536068];return _0x4a5db2;};'use strict';var _=require('lodash');var util=require(_0x34f0('0x0'));var moment=require(_0x34f0('0x1'));var BPromise=require(_0x34f0('0x2'));var rs=require(_0x34f0('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x34f0('0x4'))['db'];var utils=require(_0x34f0('0x5'));var logger=require(_0x34f0('0x6'))('rpc');var config=require(_0x34f0('0x7'));var jayson=require(_0x34f0('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x233b54,_0x329a5f,_0xc7a87c){return new BPromise(function(_0xb22892,_0x5e8ccd){return client[_0x34f0('0x9')](_0x233b54,_0xc7a87c)[_0x34f0('0xa')](function(_0x33c2a1){logger['info'](_0x34f0('0xb'),_0x329a5f,_0x34f0('0xc'));logger[_0x34f0('0xd')](_0x34f0('0xe'),_0x329a5f,_0x34f0('0xc'),JSON[_0x34f0('0xf')](_0x33c2a1));if(_0x33c2a1['error']){if(_0x33c2a1['error'][_0x34f0('0x10')]===0x1f4){logger[_0x34f0('0x11')](_0x34f0('0xb'),_0x329a5f,_0x33c2a1[_0x34f0('0x11')][_0x34f0('0x12')]);return _0x5e8ccd(_0x33c2a1['error'][_0x34f0('0x12')]);}logger[_0x34f0('0x11')]('WhatsappQueueReport,\x20%s,\x20%s',_0x329a5f,_0x33c2a1[_0x34f0('0x11')]['message']);return _0xb22892(_0x33c2a1[_0x34f0('0x11')][_0x34f0('0x12')]);}else{logger[_0x34f0('0x13')]('WhatsappQueueReport,\x20%s,\x20%s',_0x329a5f,_0x34f0('0xc'));_0xb22892(_0x33c2a1[_0x34f0('0x14')][_0x34f0('0x12')]);}})[_0x34f0('0x15')](function(_0x3b1ffb){logger['error'](_0x34f0('0xb'),_0x329a5f,_0x3b1ffb);_0x5e8ccd(_0x3b1ffb);});});}exports[_0x34f0('0x16')]=function(_0x511323){var _0x2a6c71=this;return new Promise(function(_0x19ffc3,_0x58046c){return db[_0x34f0('0x17')][_0x34f0('0x18')](_0x511323[_0x34f0('0x19')],{'raw':_0x511323[_0x34f0('0x1a')]?_0x511323['options'][_0x34f0('0x1b')]===undefined?!![]:![]:!![]})[_0x34f0('0xa')](function(_0x1e40ff){logger['info'](_0x34f0('0x16'),_0x511323);logger[_0x34f0('0xd')](_0x34f0('0x16'),_0x511323,JSON[_0x34f0('0xf')](_0x1e40ff));_0x19ffc3(_0x1e40ff);})[_0x34f0('0x15')](function(_0x210a97){logger[_0x34f0('0x11')]('CreateWhatsappQueueReport',_0x210a97[_0x34f0('0x12')],_0x511323);_0x58046c(_0x2a6c71[_0x34f0('0x11')](0x1f4,_0x210a97[_0x34f0('0x12')]));});});};exports['UpdateWhatsappQueueReport']=function(_0x3f85c7){var _0x420003=this;return new Promise(function(_0x5a9c20,_0x4475e5){return db['WhatsappQueueReport']['update'](_0x3f85c7['body'],{'raw':_0x3f85c7[_0x34f0('0x1a')]?_0x3f85c7[_0x34f0('0x1a')][_0x34f0('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3f85c7[_0x34f0('0x1a')]?_0x3f85c7['options'][_0x34f0('0x1c')]||null:null,'attributes':_0x3f85c7[_0x34f0('0x1a')]?_0x3f85c7['options'][_0x34f0('0x1d')]||null:null,'limit':_0x3f85c7[_0x34f0('0x1a')]?_0x3f85c7['options'][_0x34f0('0x1e')]||null:null})[_0x34f0('0xa')](function(_0xa0eb2c){logger[_0x34f0('0x13')](_0x34f0('0x1f'),_0x3f85c7);logger['debug'](_0x34f0('0x1f'),_0x3f85c7,JSON[_0x34f0('0xf')](_0xa0eb2c));_0x5a9c20(_0xa0eb2c);})[_0x34f0('0x15')](function(_0x2bc180){logger[_0x34f0('0x11')](_0x34f0('0x1f'),_0x2bc180['message'],_0x3f85c7);_0x4475e5(_0x420003[_0x34f0('0x11')](0x1f4,_0x2bc180[_0x34f0('0x12')]));});});};