Built motion from commit (unavailable).|2.5.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 _0xb429=['stringify','error','message','request\x20sent','catch','WhatsappQueueReport','create','body','options','CreateWhatsappQueueReport','UpdateWhatsappQueueReport','update','raw','attributes','limit','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','WhatsappQueueReport,\x20%s,\x20%s','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s'];(function(_0x566081,_0x289bcd){var _0x463fdc=function(_0x18e4ce){while(--_0x18e4ce){_0x566081['push'](_0x566081['shift']());}};_0x463fdc(++_0x289bcd);}(_0xb429,0x19b));var _0x9b42=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xb429[_0x2b4411];return _0x8e41ef;};'use strict';var _=require(_0x9b42('0x0'));var util=require(_0x9b42('0x1'));var moment=require(_0x9b42('0x2'));var BPromise=require('bluebird');var rs=require(_0x9b42('0x3'));var fs=require('fs');var Redis=require(_0x9b42('0x4'));var db=require(_0x9b42('0x5'))['db'];var utils=require(_0x9b42('0x6'));var logger=require(_0x9b42('0x7'))('rpc');var config=require(_0x9b42('0x8'));var jayson=require(_0x9b42('0x9'));var client=jayson[_0x9b42('0xa')][_0x9b42('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x25a248,_0x5f0744,_0x37fb8e){return new BPromise(function(_0x4cf666,_0x43b3cc){return client[_0x9b42('0xc')](_0x25a248,_0x37fb8e)[_0x9b42('0xd')](function(_0x19675b){logger[_0x9b42('0xe')](_0x9b42('0xf'),_0x5f0744,'request\x20sent');logger[_0x9b42('0x10')](_0x9b42('0x11'),_0x5f0744,'request\x20sent',JSON[_0x9b42('0x12')](_0x19675b));if(_0x19675b['error']){if(_0x19675b['error']['code']===0x1f4){logger[_0x9b42('0x13')](_0x9b42('0xf'),_0x5f0744,_0x19675b[_0x9b42('0x13')][_0x9b42('0x14')]);return _0x43b3cc(_0x19675b[_0x9b42('0x13')][_0x9b42('0x14')]);}logger['error']('WhatsappQueueReport,\x20%s,\x20%s',_0x5f0744,_0x19675b['error']['message']);return _0x4cf666(_0x19675b[_0x9b42('0x13')][_0x9b42('0x14')]);}else{logger[_0x9b42('0xe')](_0x9b42('0xf'),_0x5f0744,_0x9b42('0x15'));_0x4cf666(_0x19675b['result'][_0x9b42('0x14')]);}})[_0x9b42('0x16')](function(_0x38a500){logger[_0x9b42('0x13')]('WhatsappQueueReport,\x20%s,\x20%s',_0x5f0744,_0x38a500);_0x43b3cc(_0x38a500);});});}exports['CreateWhatsappQueueReport']=function(_0x26fa36){var _0x187ab3=this;return new Promise(function(_0x1f3809,_0x334f34){return db[_0x9b42('0x17')][_0x9b42('0x18')](_0x26fa36[_0x9b42('0x19')],{'raw':_0x26fa36['options']?_0x26fa36[_0x9b42('0x1a')]['raw']===undefined?!![]:![]:!![]})[_0x9b42('0xd')](function(_0x29f622){logger[_0x9b42('0xe')](_0x9b42('0x1b'),_0x26fa36);logger['debug']('CreateWhatsappQueueReport',_0x26fa36,JSON[_0x9b42('0x12')](_0x29f622));_0x1f3809(_0x29f622);})['catch'](function(_0x550d89){logger[_0x9b42('0x13')](_0x9b42('0x1b'),_0x550d89[_0x9b42('0x14')],_0x26fa36);_0x334f34(_0x187ab3[_0x9b42('0x13')](0x1f4,_0x550d89['message']));});});};exports[_0x9b42('0x1c')]=function(_0x1b5ee6){var _0xb6fade=this;return new Promise(function(_0x268484,_0x2aa24a){return db[_0x9b42('0x17')][_0x9b42('0x1d')](_0x1b5ee6[_0x9b42('0x19')],{'raw':_0x1b5ee6[_0x9b42('0x1a')]?_0x1b5ee6[_0x9b42('0x1a')][_0x9b42('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1b5ee6[_0x9b42('0x1a')]?_0x1b5ee6['options']['where']||null:null,'attributes':_0x1b5ee6[_0x9b42('0x1a')]?_0x1b5ee6[_0x9b42('0x1a')][_0x9b42('0x1f')]||null:null,'limit':_0x1b5ee6[_0x9b42('0x1a')]?_0x1b5ee6[_0x9b42('0x1a')][_0x9b42('0x20')]||null:null})[_0x9b42('0xd')](function(_0x5a2aff){logger[_0x9b42('0xe')](_0x9b42('0x1c'),_0x1b5ee6);logger['debug'](_0x9b42('0x1c'),_0x1b5ee6,JSON[_0x9b42('0x12')](_0x5a2aff));_0x268484(_0x5a2aff);})[_0x9b42('0x16')](function(_0x45b3d3){logger['error']('UpdateWhatsappQueueReport',_0x45b3d3[_0x9b42('0x14')],_0x1b5ee6);_0x2aa24a(_0xb6fade[_0x9b42('0x13')](0x1f4,_0x45b3d3[_0x9b42('0x14')]));});});};