Built motion from commit da24aabd.|2.6.20
[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 _0x2e35=['randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','info','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','CreateWhatsappQueueReport','WhatsappQueueReport','create','body','options','then','stringify','raw','where','attributes','UpdateWhatsappQueueReport','lodash','bluebird'];(function(_0x36613c,_0x39680e){var _0x16daf3=function(_0xd82cd8){while(--_0xd82cd8){_0x36613c['push'](_0x36613c['shift']());}};_0x16daf3(++_0x39680e);}(_0x2e35,0x166));var _0x52e3=function(_0xeb35e3,_0x48e58e){_0xeb35e3=_0xeb35e3-0x0;var _0x365553=_0x2e35[_0xeb35e3];return _0x365553;};'use strict';var _=require(_0x52e3('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x52e3('0x1'));var rs=require(_0x52e3('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x52e3('0x3'))['db'];var utils=require(_0x52e3('0x4'));var logger=require('../../config/logger')(_0x52e3('0x5'));var config=require('../../config/environment');var jayson=require(_0x52e3('0x6'));var client=jayson[_0x52e3('0x7')][_0x52e3('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x28a1e0,_0x3c8aa6,_0x4fce91){return new BPromise(function(_0xf3c667,_0x4f70ba){return client[_0x52e3('0x9')](_0x28a1e0,_0x4fce91)['then'](function(_0x134672){logger[_0x52e3('0xa')](_0x52e3('0xb'),_0x3c8aa6,_0x52e3('0xc'));logger[_0x52e3('0xd')]('WhatsappQueueReport,\x20%s,\x20%s,\x20%s',_0x3c8aa6,_0x52e3('0xc'),JSON['stringify'](_0x134672));if(_0x134672[_0x52e3('0xe')]){if(_0x134672[_0x52e3('0xe')][_0x52e3('0xf')]===0x1f4){logger[_0x52e3('0xe')](_0x52e3('0xb'),_0x3c8aa6,_0x134672[_0x52e3('0xe')]['message']);return _0x4f70ba(_0x134672[_0x52e3('0xe')][_0x52e3('0x10')]);}logger[_0x52e3('0xe')](_0x52e3('0xb'),_0x3c8aa6,_0x134672[_0x52e3('0xe')][_0x52e3('0x10')]);return _0xf3c667(_0x134672[_0x52e3('0xe')]['message']);}else{logger[_0x52e3('0xa')](_0x52e3('0xb'),_0x3c8aa6,_0x52e3('0xc'));_0xf3c667(_0x134672[_0x52e3('0x11')][_0x52e3('0x10')]);}})[_0x52e3('0x12')](function(_0x52e956){logger[_0x52e3('0xe')](_0x52e3('0xb'),_0x3c8aa6,_0x52e956);_0x4f70ba(_0x52e956);});});}exports[_0x52e3('0x13')]=function(_0xe06cd){var _0x46f711=this;return new Promise(function(_0x103f8c,_0x490fbe){return db[_0x52e3('0x14')][_0x52e3('0x15')](_0xe06cd[_0x52e3('0x16')],{'raw':_0xe06cd[_0x52e3('0x17')]?_0xe06cd[_0x52e3('0x17')]['raw']===undefined?!![]:![]:!![]})[_0x52e3('0x18')](function(_0x1f7edd){logger[_0x52e3('0xa')](_0x52e3('0x13'),_0xe06cd);logger[_0x52e3('0xd')](_0x52e3('0x13'),_0xe06cd,JSON[_0x52e3('0x19')](_0x1f7edd));_0x103f8c(_0x1f7edd);})[_0x52e3('0x12')](function(_0x4089c5){logger[_0x52e3('0xe')]('CreateWhatsappQueueReport',_0x4089c5[_0x52e3('0x10')],_0xe06cd);_0x490fbe(_0x46f711[_0x52e3('0xe')](0x1f4,_0x4089c5[_0x52e3('0x10')]));});});};exports['UpdateWhatsappQueueReport']=function(_0x2d66bd){var _0x2f55ac=this;return new Promise(function(_0x1c8505,_0x10dd4d){return db['WhatsappQueueReport']['update'](_0x2d66bd[_0x52e3('0x16')],{'raw':_0x2d66bd[_0x52e3('0x17')]?_0x2d66bd[_0x52e3('0x17')][_0x52e3('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2d66bd[_0x52e3('0x17')]?_0x2d66bd[_0x52e3('0x17')][_0x52e3('0x1b')]||null:null,'attributes':_0x2d66bd[_0x52e3('0x17')]?_0x2d66bd[_0x52e3('0x17')][_0x52e3('0x1c')]||null:null,'limit':_0x2d66bd[_0x52e3('0x17')]?_0x2d66bd[_0x52e3('0x17')]['limit']||null:null})['then'](function(_0x172ade){logger[_0x52e3('0xa')]('UpdateWhatsappQueueReport',_0x2d66bd);logger[_0x52e3('0xd')](_0x52e3('0x1d'),_0x2d66bd,JSON[_0x52e3('0x19')](_0x172ade));_0x1c8505(_0x172ade);})[_0x52e3('0x12')](function(_0x510fc3){logger[_0x52e3('0xe')](_0x52e3('0x1d'),_0x510fc3[_0x52e3('0x10')],_0x2d66bd);_0x10dd4d(_0x2f55ac[_0x52e3('0xe')](0x1f4,_0x510fc3[_0x52e3('0x10')]));});});};