Built motion from commit b5996064.|2.6.21
[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 _0xf4f4=['attributes','limit','UpdateWhatsappQueueReport','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','CreateWhatsappQueueReport','WhatsappQueueReport','create','body','options','raw','then','debug','update'];(function(_0x513aa5,_0x1fba79){var _0x1a1a7c=function(_0x240e3f){while(--_0x240e3f){_0x513aa5['push'](_0x513aa5['shift']());}};_0x1a1a7c(++_0x1fba79);}(_0xf4f4,0x12c));var _0x4f4f=function(_0x38517b,_0x2c26fa){_0x38517b=_0x38517b-0x0;var _0x3b1976=_0xf4f4[_0x38517b];return _0x3b1976;};'use strict';var _=require(_0x4f4f('0x0'));var util=require(_0x4f4f('0x1'));var moment=require(_0x4f4f('0x2'));var BPromise=require(_0x4f4f('0x3'));var rs=require(_0x4f4f('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4f4f('0x5'))['db'];var utils=require(_0x4f4f('0x6'));var logger=require(_0x4f4f('0x7'))(_0x4f4f('0x8'));var config=require(_0x4f4f('0x9'));var jayson=require(_0x4f4f('0xa'));var client=jayson['client'][_0x4f4f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x21d829,_0x2b1f64,_0x5788e0){return new BPromise(function(_0x3947c7,_0x2e83fa){return client['request'](_0x21d829,_0x5788e0)['then'](function(_0x3dbbb8){logger[_0x4f4f('0xc')](_0x4f4f('0xd'),_0x2b1f64,_0x4f4f('0xe'));logger['debug'](_0x4f4f('0xf'),_0x2b1f64,_0x4f4f('0xe'),JSON[_0x4f4f('0x10')](_0x3dbbb8));if(_0x3dbbb8[_0x4f4f('0x11')]){if(_0x3dbbb8[_0x4f4f('0x11')][_0x4f4f('0x12')]===0x1f4){logger[_0x4f4f('0x11')](_0x4f4f('0xd'),_0x2b1f64,_0x3dbbb8[_0x4f4f('0x11')]['message']);return _0x2e83fa(_0x3dbbb8[_0x4f4f('0x11')][_0x4f4f('0x13')]);}logger['error'](_0x4f4f('0xd'),_0x2b1f64,_0x3dbbb8[_0x4f4f('0x11')]['message']);return _0x3947c7(_0x3dbbb8[_0x4f4f('0x11')]['message']);}else{logger[_0x4f4f('0xc')](_0x4f4f('0xd'),_0x2b1f64,_0x4f4f('0xe'));_0x3947c7(_0x3dbbb8['result'][_0x4f4f('0x13')]);}})[_0x4f4f('0x14')](function(_0x4e2050){logger[_0x4f4f('0x11')](_0x4f4f('0xd'),_0x2b1f64,_0x4e2050);_0x2e83fa(_0x4e2050);});});}exports[_0x4f4f('0x15')]=function(_0x1a42c9){var _0x4f5429=this;return new Promise(function(_0x48718f,_0x8fa1bb){return db[_0x4f4f('0x16')][_0x4f4f('0x17')](_0x1a42c9[_0x4f4f('0x18')],{'raw':_0x1a42c9[_0x4f4f('0x19')]?_0x1a42c9['options'][_0x4f4f('0x1a')]===undefined?!![]:![]:!![]})[_0x4f4f('0x1b')](function(_0x3f098f){logger['info']('CreateWhatsappQueueReport',_0x1a42c9);logger[_0x4f4f('0x1c')](_0x4f4f('0x15'),_0x1a42c9,JSON[_0x4f4f('0x10')](_0x3f098f));_0x48718f(_0x3f098f);})[_0x4f4f('0x14')](function(_0x1709e6){logger['error']('CreateWhatsappQueueReport',_0x1709e6[_0x4f4f('0x13')],_0x1a42c9);_0x8fa1bb(_0x4f5429[_0x4f4f('0x11')](0x1f4,_0x1709e6[_0x4f4f('0x13')]));});});};exports['UpdateWhatsappQueueReport']=function(_0x1fdf60){var _0x15735d=this;return new Promise(function(_0x2a118a,_0x413742){return db[_0x4f4f('0x16')][_0x4f4f('0x1d')](_0x1fdf60[_0x4f4f('0x18')],{'raw':_0x1fdf60['options']?_0x1fdf60['options'][_0x4f4f('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1fdf60[_0x4f4f('0x19')]?_0x1fdf60[_0x4f4f('0x19')]['where']||null:null,'attributes':_0x1fdf60[_0x4f4f('0x19')]?_0x1fdf60['options'][_0x4f4f('0x1e')]||null:null,'limit':_0x1fdf60[_0x4f4f('0x19')]?_0x1fdf60[_0x4f4f('0x19')][_0x4f4f('0x1f')]||null:null})[_0x4f4f('0x1b')](function(_0x493920){logger['info'](_0x4f4f('0x20'),_0x1fdf60);logger[_0x4f4f('0x1c')](_0x4f4f('0x20'),_0x1fdf60,JSON[_0x4f4f('0x10')](_0x493920));_0x2a118a(_0x493920);})[_0x4f4f('0x14')](function(_0x330fb5){logger[_0x4f4f('0x11')]('UpdateWhatsappQueueReport',_0x330fb5[_0x4f4f('0x13')],_0x1fdf60);_0x413742(_0x15735d['error'](0x1f4,_0x330fb5[_0x4f4f('0x13')]));});});};