Built motion from commit 3c2ce842.|2.6.31
[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 _0x8c63=['error','code','message','catch','CreateWhatsappQueueReport','WhatsappQueueReport','create','body','options','raw','debug','UpdateWhatsappQueueReport','update','where','limit','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x3815e1,_0x21c0e9){var _0x52aa7e=function(_0x45fdfb){while(--_0x45fdfb){_0x3815e1['push'](_0x3815e1['shift']());}};_0x52aa7e(++_0x21c0e9);}(_0x8c63,0xb9));var _0x38c6=function(_0x14204e,_0x111bca){_0x14204e=_0x14204e-0x0;var _0x20c40a=_0x8c63[_0x14204e];return _0x20c40a;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x38c6('0x0'));var BPromise=require(_0x38c6('0x1'));var rs=require(_0x38c6('0x2'));var fs=require('fs');var Redis=require(_0x38c6('0x3'));var db=require(_0x38c6('0x4'))['db'];var utils=require(_0x38c6('0x5'));var logger=require(_0x38c6('0x6'))(_0x38c6('0x7'));var config=require(_0x38c6('0x8'));var jayson=require(_0x38c6('0x9'));var client=jayson[_0x38c6('0xa')][_0x38c6('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2374a8,_0x5e41e9,_0x31dd1b){return new BPromise(function(_0x5ce733,_0x26ada8){return client[_0x38c6('0xc')](_0x2374a8,_0x31dd1b)[_0x38c6('0xd')](function(_0x2c8987){logger[_0x38c6('0xe')](_0x38c6('0xf'),_0x5e41e9,_0x38c6('0x10'));logger['debug'](_0x38c6('0x11'),_0x5e41e9,_0x38c6('0x10'),JSON[_0x38c6('0x12')](_0x2c8987));if(_0x2c8987[_0x38c6('0x13')]){if(_0x2c8987[_0x38c6('0x13')][_0x38c6('0x14')]===0x1f4){logger['error'](_0x38c6('0xf'),_0x5e41e9,_0x2c8987[_0x38c6('0x13')][_0x38c6('0x15')]);return _0x26ada8(_0x2c8987[_0x38c6('0x13')][_0x38c6('0x15')]);}logger[_0x38c6('0x13')](_0x38c6('0xf'),_0x5e41e9,_0x2c8987[_0x38c6('0x13')][_0x38c6('0x15')]);return _0x5ce733(_0x2c8987[_0x38c6('0x13')][_0x38c6('0x15')]);}else{logger[_0x38c6('0xe')]('WhatsappQueueReport,\x20%s,\x20%s',_0x5e41e9,_0x38c6('0x10'));_0x5ce733(_0x2c8987['result'][_0x38c6('0x15')]);}})[_0x38c6('0x16')](function(_0x515beb){logger[_0x38c6('0x13')](_0x38c6('0xf'),_0x5e41e9,_0x515beb);_0x26ada8(_0x515beb);});});}exports[_0x38c6('0x17')]=function(_0x48091f){var _0x165433=this;return new Promise(function(_0x97a4e7,_0x592894){return db[_0x38c6('0x18')][_0x38c6('0x19')](_0x48091f[_0x38c6('0x1a')],{'raw':_0x48091f['options']?_0x48091f[_0x38c6('0x1b')][_0x38c6('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x99eb0b){logger['info'](_0x38c6('0x17'),_0x48091f);logger[_0x38c6('0x1d')](_0x38c6('0x17'),_0x48091f,JSON[_0x38c6('0x12')](_0x99eb0b));_0x97a4e7(_0x99eb0b);})[_0x38c6('0x16')](function(_0x357945){logger[_0x38c6('0x13')]('CreateWhatsappQueueReport',_0x357945[_0x38c6('0x15')],_0x48091f);_0x592894(_0x165433[_0x38c6('0x13')](0x1f4,_0x357945[_0x38c6('0x15')]));});});};exports[_0x38c6('0x1e')]=function(_0x3ab52d){var _0x18ed6f=this;return new Promise(function(_0x2913c5,_0x5a6495){return db['WhatsappQueueReport'][_0x38c6('0x1f')](_0x3ab52d[_0x38c6('0x1a')],{'raw':_0x3ab52d['options']?_0x3ab52d[_0x38c6('0x1b')][_0x38c6('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3ab52d[_0x38c6('0x1b')]?_0x3ab52d['options'][_0x38c6('0x20')]||null:null,'attributes':_0x3ab52d[_0x38c6('0x1b')]?_0x3ab52d['options']['attributes']||null:null,'limit':_0x3ab52d[_0x38c6('0x1b')]?_0x3ab52d['options'][_0x38c6('0x21')]||null:null})[_0x38c6('0xd')](function(_0x22af98){logger[_0x38c6('0xe')](_0x38c6('0x1e'),_0x3ab52d);logger[_0x38c6('0x1d')]('UpdateWhatsappQueueReport',_0x3ab52d,JSON[_0x38c6('0x12')](_0x22af98));_0x2913c5(_0x22af98);})[_0x38c6('0x16')](function(_0x5daff2){logger[_0x38c6('0x13')](_0x38c6('0x1e'),_0x5daff2[_0x38c6('0x15')],_0x3ab52d);_0x5a6495(_0x18ed6f[_0x38c6('0x13')](0x1f4,_0x5daff2[_0x38c6('0x15')]));});});};