Built motion from commit (unavailable).|2.5.22
[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 _0x5e48=['randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','WhatsappQueueReport','body','options','raw','CreateWhatsappQueueReport','UpdateWhatsappQueueReport','update','where','attributes','lodash','util','moment','bluebird'];(function(_0x456624,_0x11a6cd){var _0x14b320=function(_0x440500){while(--_0x440500){_0x456624['push'](_0x456624['shift']());}};_0x14b320(++_0x11a6cd);}(_0x5e48,0xc2));var _0x85e4=function(_0x26dfa5,_0x2ed3e9){_0x26dfa5=_0x26dfa5-0x0;var _0x408dd2=_0x5e48[_0x26dfa5];return _0x408dd2;};'use strict';var _=require(_0x85e4('0x0'));var util=require(_0x85e4('0x1'));var moment=require(_0x85e4('0x2'));var BPromise=require(_0x85e4('0x3'));var rs=require(_0x85e4('0x4'));var fs=require('fs');var Redis=require(_0x85e4('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x85e4('0x6'));var logger=require(_0x85e4('0x7'))('rpc');var config=require(_0x85e4('0x8'));var jayson=require(_0x85e4('0x9'));var client=jayson[_0x85e4('0xa')][_0x85e4('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x680643,_0x3fc294,_0x5920b2){return new BPromise(function(_0x324ee1,_0x4d244b){return client['request'](_0x680643,_0x5920b2)[_0x85e4('0xc')](function(_0x1aa4bd){logger[_0x85e4('0xd')](_0x85e4('0xe'),_0x3fc294,_0x85e4('0xf'));logger[_0x85e4('0x10')](_0x85e4('0x11'),_0x3fc294,'request\x20sent',JSON[_0x85e4('0x12')](_0x1aa4bd));if(_0x1aa4bd[_0x85e4('0x13')]){if(_0x1aa4bd['error'][_0x85e4('0x14')]===0x1f4){logger[_0x85e4('0x13')](_0x85e4('0xe'),_0x3fc294,_0x1aa4bd[_0x85e4('0x13')]['message']);return _0x4d244b(_0x1aa4bd[_0x85e4('0x13')][_0x85e4('0x15')]);}logger[_0x85e4('0x13')]('WhatsappQueueReport,\x20%s,\x20%s',_0x3fc294,_0x1aa4bd[_0x85e4('0x13')][_0x85e4('0x15')]);return _0x324ee1(_0x1aa4bd[_0x85e4('0x13')][_0x85e4('0x15')]);}else{logger['info'](_0x85e4('0xe'),_0x3fc294,_0x85e4('0xf'));_0x324ee1(_0x1aa4bd[_0x85e4('0x16')][_0x85e4('0x15')]);}})[_0x85e4('0x17')](function(_0x253458){logger[_0x85e4('0x13')](_0x85e4('0xe'),_0x3fc294,_0x253458);_0x4d244b(_0x253458);});});}exports['CreateWhatsappQueueReport']=function(_0x320f74){var _0x3d93ee=this;return new Promise(function(_0x274c3b,_0x6091e2){return db[_0x85e4('0x18')]['create'](_0x320f74[_0x85e4('0x19')],{'raw':_0x320f74[_0x85e4('0x1a')]?_0x320f74[_0x85e4('0x1a')][_0x85e4('0x1b')]===undefined?!![]:![]:!![]})[_0x85e4('0xc')](function(_0x2ee48f){logger[_0x85e4('0xd')](_0x85e4('0x1c'),_0x320f74);logger[_0x85e4('0x10')](_0x85e4('0x1c'),_0x320f74,JSON[_0x85e4('0x12')](_0x2ee48f));_0x274c3b(_0x2ee48f);})[_0x85e4('0x17')](function(_0xef5f91){logger[_0x85e4('0x13')]('CreateWhatsappQueueReport',_0xef5f91[_0x85e4('0x15')],_0x320f74);_0x6091e2(_0x3d93ee[_0x85e4('0x13')](0x1f4,_0xef5f91[_0x85e4('0x15')]));});});};exports[_0x85e4('0x1d')]=function(_0x117ad6){var _0x348b98=this;return new Promise(function(_0x16f0ab,_0x5abeb7){return db[_0x85e4('0x18')][_0x85e4('0x1e')](_0x117ad6['body'],{'raw':_0x117ad6['options']?_0x117ad6['options'][_0x85e4('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x117ad6['options']?_0x117ad6['options'][_0x85e4('0x1f')]||null:null,'attributes':_0x117ad6[_0x85e4('0x1a')]?_0x117ad6['options'][_0x85e4('0x20')]||null:null,'limit':_0x117ad6[_0x85e4('0x1a')]?_0x117ad6[_0x85e4('0x1a')]['limit']||null:null})[_0x85e4('0xc')](function(_0x27da4d){logger[_0x85e4('0xd')](_0x85e4('0x1d'),_0x117ad6);logger[_0x85e4('0x10')](_0x85e4('0x1d'),_0x117ad6,JSON[_0x85e4('0x12')](_0x27da4d));_0x16f0ab(_0x27da4d);})[_0x85e4('0x17')](function(_0x4f140f){logger[_0x85e4('0x13')](_0x85e4('0x1d'),_0x4f140f['message'],_0x117ad6);_0x5abeb7(_0x348b98[_0x85e4('0x13')](0x1f4,_0x4f140f[_0x85e4('0x15')]));});});};