Built motion from commit fe909640.|2.6.8
[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 _0x17bc=['CreateWhatsappQueueReport','WhatsappQueueReport','create','body','options','then','UpdateWhatsappQueueReport','update','where','attributes','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','request','info','request\x20sent','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','WhatsappQueueReport,\x20%s,\x20%s','message','result','catch'];(function(_0x12da0f,_0x518363){var _0x2559e5=function(_0x4f5b18){while(--_0x4f5b18){_0x12da0f['push'](_0x12da0f['shift']());}};_0x2559e5(++_0x518363);}(_0x17bc,0xa5));var _0xc17b=function(_0x1a1e3d,_0x37dbd6){_0x1a1e3d=_0x1a1e3d-0x0;var _0x3b9e16=_0x17bc[_0x1a1e3d];return _0x3b9e16;};'use strict';var _=require(_0xc17b('0x0'));var util=require(_0xc17b('0x1'));var moment=require(_0xc17b('0x2'));var BPromise=require(_0xc17b('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc17b('0x4'));var db=require(_0xc17b('0x5'))['db'];var utils=require(_0xc17b('0x6'));var logger=require('../../config/logger')(_0xc17b('0x7'));var config=require(_0xc17b('0x8'));var jayson=require(_0xc17b('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x57302a,_0x5c4be7,_0x237821){return new BPromise(function(_0x456fc2,_0x5521b2){return client[_0xc17b('0xa')](_0x57302a,_0x237821)['then'](function(_0x1de743){logger[_0xc17b('0xb')]('WhatsappQueueReport,\x20%s,\x20%s',_0x5c4be7,_0xc17b('0xc'));logger[_0xc17b('0xd')](_0xc17b('0xe'),_0x5c4be7,_0xc17b('0xc'),JSON[_0xc17b('0xf')](_0x1de743));if(_0x1de743[_0xc17b('0x10')]){if(_0x1de743[_0xc17b('0x10')]['code']===0x1f4){logger['error'](_0xc17b('0x11'),_0x5c4be7,_0x1de743['error'][_0xc17b('0x12')]);return _0x5521b2(_0x1de743[_0xc17b('0x10')][_0xc17b('0x12')]);}logger[_0xc17b('0x10')]('WhatsappQueueReport,\x20%s,\x20%s',_0x5c4be7,_0x1de743[_0xc17b('0x10')][_0xc17b('0x12')]);return _0x456fc2(_0x1de743[_0xc17b('0x10')][_0xc17b('0x12')]);}else{logger[_0xc17b('0xb')]('WhatsappQueueReport,\x20%s,\x20%s',_0x5c4be7,'request\x20sent');_0x456fc2(_0x1de743[_0xc17b('0x13')][_0xc17b('0x12')]);}})[_0xc17b('0x14')](function(_0x3c9846){logger[_0xc17b('0x10')](_0xc17b('0x11'),_0x5c4be7,_0x3c9846);_0x5521b2(_0x3c9846);});});}exports[_0xc17b('0x15')]=function(_0x575ee0){var _0x1f0e9c=this;return new Promise(function(_0x4c579e,_0x5ec2a3){return db[_0xc17b('0x16')][_0xc17b('0x17')](_0x575ee0[_0xc17b('0x18')],{'raw':_0x575ee0['options']?_0x575ee0[_0xc17b('0x19')]['raw']===undefined?!![]:![]:!![]})[_0xc17b('0x1a')](function(_0x196f5a){logger[_0xc17b('0xb')](_0xc17b('0x15'),_0x575ee0);logger[_0xc17b('0xd')]('CreateWhatsappQueueReport',_0x575ee0,JSON[_0xc17b('0xf')](_0x196f5a));_0x4c579e(_0x196f5a);})[_0xc17b('0x14')](function(_0xf1245){logger[_0xc17b('0x10')]('CreateWhatsappQueueReport',_0xf1245['message'],_0x575ee0);_0x5ec2a3(_0x1f0e9c[_0xc17b('0x10')](0x1f4,_0xf1245['message']));});});};exports[_0xc17b('0x1b')]=function(_0x2da610){var _0x21c0c3=this;return new Promise(function(_0x5a505b,_0x506e71){return db[_0xc17b('0x16')][_0xc17b('0x1c')](_0x2da610['body'],{'raw':_0x2da610[_0xc17b('0x19')]?_0x2da610[_0xc17b('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2da610['options']?_0x2da610['options'][_0xc17b('0x1d')]||null:null,'attributes':_0x2da610[_0xc17b('0x19')]?_0x2da610['options'][_0xc17b('0x1e')]||null:null,'limit':_0x2da610[_0xc17b('0x19')]?_0x2da610[_0xc17b('0x19')]['limit']||null:null})['then'](function(_0x9d819e){logger[_0xc17b('0xb')](_0xc17b('0x1b'),_0x2da610);logger[_0xc17b('0xd')](_0xc17b('0x1b'),_0x2da610,JSON['stringify'](_0x9d819e));_0x5a505b(_0x9d819e);})[_0xc17b('0x14')](function(_0x2ba64b){logger[_0xc17b('0x10')](_0xc17b('0x1b'),_0x2ba64b[_0xc17b('0x12')],_0x2da610);_0x506e71(_0x21c0c3[_0xc17b('0x10')](0x1f4,_0x2ba64b['message']));});});};