Built motion from commit da617fac.|2.6.6
[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 _0xd6fd=['code','message','info','result','catch','WhatsappQueueReport','create','options','raw','then','CreateWhatsappQueueReport','body','where','attributes','limit','UpdateWhatsappQueueReport','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error'];(function(_0x5e36d1,_0x471178){var _0x950b9e=function(_0x1872f3){while(--_0x1872f3){_0x5e36d1['push'](_0x5e36d1['shift']());}};_0x950b9e(++_0x471178);}(_0xd6fd,0x110));var _0xdd6f=function(_0x1c88f9,_0x211646){_0x1c88f9=_0x1c88f9-0x0;var _0x1779f7=_0xd6fd[_0x1c88f9];return _0x1779f7;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xdd6f('0x0'));var BPromise=require(_0xdd6f('0x1'));var rs=require(_0xdd6f('0x2'));var fs=require('fs');var Redis=require(_0xdd6f('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xdd6f('0x4'));var logger=require('../../config/logger')(_0xdd6f('0x5'));var config=require(_0xdd6f('0x6'));var jayson=require(_0xdd6f('0x7'));var client=jayson[_0xdd6f('0x8')][_0xdd6f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x552b2f,_0x5099fb,_0x5f0bcf){return new BPromise(function(_0x1cf9e4,_0x1d30e3){return client[_0xdd6f('0xa')](_0x552b2f,_0x5f0bcf)['then'](function(_0x390595){logger['info'](_0xdd6f('0xb'),_0x5099fb,_0xdd6f('0xc'));logger[_0xdd6f('0xd')]('WhatsappQueueReport,\x20%s,\x20%s,\x20%s',_0x5099fb,_0xdd6f('0xc'),JSON[_0xdd6f('0xe')](_0x390595));if(_0x390595[_0xdd6f('0xf')]){if(_0x390595[_0xdd6f('0xf')][_0xdd6f('0x10')]===0x1f4){logger['error']('WhatsappQueueReport,\x20%s,\x20%s',_0x5099fb,_0x390595[_0xdd6f('0xf')][_0xdd6f('0x11')]);return _0x1d30e3(_0x390595[_0xdd6f('0xf')][_0xdd6f('0x11')]);}logger[_0xdd6f('0xf')](_0xdd6f('0xb'),_0x5099fb,_0x390595[_0xdd6f('0xf')]['message']);return _0x1cf9e4(_0x390595[_0xdd6f('0xf')][_0xdd6f('0x11')]);}else{logger[_0xdd6f('0x12')](_0xdd6f('0xb'),_0x5099fb,_0xdd6f('0xc'));_0x1cf9e4(_0x390595[_0xdd6f('0x13')][_0xdd6f('0x11')]);}})[_0xdd6f('0x14')](function(_0x19af9a){logger['error'](_0xdd6f('0xb'),_0x5099fb,_0x19af9a);_0x1d30e3(_0x19af9a);});});}exports['CreateWhatsappQueueReport']=function(_0x2716ab){var _0x451129=this;return new Promise(function(_0x40e15c,_0x2ce04e){return db[_0xdd6f('0x15')][_0xdd6f('0x16')](_0x2716ab['body'],{'raw':_0x2716ab[_0xdd6f('0x17')]?_0x2716ab[_0xdd6f('0x17')][_0xdd6f('0x18')]===undefined?!![]:![]:!![]})[_0xdd6f('0x19')](function(_0x28cae4){logger[_0xdd6f('0x12')]('CreateWhatsappQueueReport',_0x2716ab);logger[_0xdd6f('0xd')](_0xdd6f('0x1a'),_0x2716ab,JSON['stringify'](_0x28cae4));_0x40e15c(_0x28cae4);})['catch'](function(_0x234d3c){logger[_0xdd6f('0xf')](_0xdd6f('0x1a'),_0x234d3c['message'],_0x2716ab);_0x2ce04e(_0x451129[_0xdd6f('0xf')](0x1f4,_0x234d3c[_0xdd6f('0x11')]));});});};exports['UpdateWhatsappQueueReport']=function(_0x5e71db){var _0xc2e542=this;return new Promise(function(_0x34fb3b,_0x245ebc){return db[_0xdd6f('0x15')]['update'](_0x5e71db[_0xdd6f('0x1b')],{'raw':_0x5e71db['options']?_0x5e71db['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5e71db[_0xdd6f('0x17')]?_0x5e71db['options'][_0xdd6f('0x1c')]||null:null,'attributes':_0x5e71db[_0xdd6f('0x17')]?_0x5e71db[_0xdd6f('0x17')][_0xdd6f('0x1d')]||null:null,'limit':_0x5e71db[_0xdd6f('0x17')]?_0x5e71db[_0xdd6f('0x17')][_0xdd6f('0x1e')]||null:null})[_0xdd6f('0x19')](function(_0x128cdd){logger[_0xdd6f('0x12')](_0xdd6f('0x1f'),_0x5e71db);logger['debug'](_0xdd6f('0x1f'),_0x5e71db,JSON[_0xdd6f('0xe')](_0x128cdd));_0x34fb3b(_0x128cdd);})[_0xdd6f('0x14')](function(_0x400041){logger[_0xdd6f('0xf')]('UpdateWhatsappQueueReport',_0x400041[_0xdd6f('0x11')],_0x5e71db);_0x245ebc(_0xc2e542[_0xdd6f('0xf')](0x1f4,_0x400041[_0xdd6f('0x11')]));});});};