Built motion from commit 10af8726.|2.6.34
[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 _0xf026=['message','result','CreateWhatsappQueueReport','create','options','raw','debug','stringify','catch','UpdateWhatsappQueueReport','update','body','attributes','limit','moment','randomstring','../../mysqldb','../../config/utils','jayson/promise','client','http','then','info','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x2f4dfd,_0x3c3e24){var _0x6c69ba=function(_0x179711){while(--_0x179711){_0x2f4dfd['push'](_0x2f4dfd['shift']());}};_0x6c69ba(++_0x3c3e24);}(_0xf026,0x1ce));var _0x6f02=function(_0x30033a,_0x5ce4a6){_0x30033a=_0x30033a-0x0;var _0x5e3518=_0xf026[_0x30033a];return _0x5e3518;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x6f02('0x0'));var BPromise=require('bluebird');var rs=require(_0x6f02('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6f02('0x2'))['db'];var utils=require(_0x6f02('0x3'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x6f02('0x4'));var client=jayson[_0x6f02('0x5')][_0x6f02('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x52d7d4,_0xcd3724,_0x166ed9){return new BPromise(function(_0x473b90,_0x538e3f){return client['request'](_0x52d7d4,_0x166ed9)[_0x6f02('0x7')](function(_0x3618f7){logger[_0x6f02('0x8')](_0x6f02('0x9'),_0xcd3724,_0x6f02('0xa'));logger['debug'](_0x6f02('0xb'),_0xcd3724,_0x6f02('0xa'),JSON['stringify'](_0x3618f7));if(_0x3618f7['error']){if(_0x3618f7[_0x6f02('0xc')][_0x6f02('0xd')]===0x1f4){logger[_0x6f02('0xc')](_0x6f02('0x9'),_0xcd3724,_0x3618f7[_0x6f02('0xc')][_0x6f02('0xe')]);return _0x538e3f(_0x3618f7[_0x6f02('0xc')]['message']);}logger['error'](_0x6f02('0x9'),_0xcd3724,_0x3618f7[_0x6f02('0xc')][_0x6f02('0xe')]);return _0x473b90(_0x3618f7['error'][_0x6f02('0xe')]);}else{logger['info']('WhatsappQueueReport,\x20%s,\x20%s',_0xcd3724,_0x6f02('0xa'));_0x473b90(_0x3618f7[_0x6f02('0xf')][_0x6f02('0xe')]);}})['catch'](function(_0x515077){logger[_0x6f02('0xc')](_0x6f02('0x9'),_0xcd3724,_0x515077);_0x538e3f(_0x515077);});});}exports[_0x6f02('0x10')]=function(_0x3f350f){var _0x3128c9=this;return new Promise(function(_0x3ed8ae,_0x202862){return db['WhatsappQueueReport'][_0x6f02('0x11')](_0x3f350f['body'],{'raw':_0x3f350f['options']?_0x3f350f[_0x6f02('0x12')][_0x6f02('0x13')]===undefined?!![]:![]:!![]})['then'](function(_0x3b061e){logger[_0x6f02('0x8')]('CreateWhatsappQueueReport',_0x3f350f);logger[_0x6f02('0x14')]('CreateWhatsappQueueReport',_0x3f350f,JSON[_0x6f02('0x15')](_0x3b061e));_0x3ed8ae(_0x3b061e);})[_0x6f02('0x16')](function(_0xaa6cdc){logger[_0x6f02('0xc')](_0x6f02('0x10'),_0xaa6cdc['message'],_0x3f350f);_0x202862(_0x3128c9[_0x6f02('0xc')](0x1f4,_0xaa6cdc[_0x6f02('0xe')]));});});};exports[_0x6f02('0x17')]=function(_0x472fa4){var _0x9d08f7=this;return new Promise(function(_0x541d31,_0x222d55){return db['WhatsappQueueReport'][_0x6f02('0x18')](_0x472fa4[_0x6f02('0x19')],{'raw':_0x472fa4[_0x6f02('0x12')]?_0x472fa4[_0x6f02('0x12')][_0x6f02('0x13')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x472fa4[_0x6f02('0x12')]?_0x472fa4[_0x6f02('0x12')]['where']||null:null,'attributes':_0x472fa4['options']?_0x472fa4[_0x6f02('0x12')][_0x6f02('0x1a')]||null:null,'limit':_0x472fa4[_0x6f02('0x12')]?_0x472fa4[_0x6f02('0x12')][_0x6f02('0x1b')]||null:null})[_0x6f02('0x7')](function(_0x5adecb){logger['info'](_0x6f02('0x17'),_0x472fa4);logger[_0x6f02('0x14')](_0x6f02('0x17'),_0x472fa4,JSON[_0x6f02('0x15')](_0x5adecb));_0x541d31(_0x5adecb);})[_0x6f02('0x16')](function(_0x2d58b6){logger[_0x6f02('0xc')](_0x6f02('0x17'),_0x2d58b6['message'],_0x472fa4);_0x222d55(_0x9d08f7[_0x6f02('0xc')](0x1f4,_0x2d58b6['message']));});});};