Built motion from commit 85328c08.|2.5.50
[motion2.git] / server / api / smsQueueReport / smsQueueReport.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 _0xbcd8=['../../config/environment','http','request','then','info','SmsQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','CreateSmsQueueReport','SmsQueueReport','create','body','options','UpdateSmsQueueReport','update','attributes','limit','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x499922,_0x50ea6c){var _0xeacd8d=function(_0x34e2d4){while(--_0x34e2d4){_0x499922['push'](_0x499922['shift']());}};_0xeacd8d(++_0x50ea6c);}(_0xbcd8,0x143));var _0x8bcd=function(_0x73cc89,_0x34e084){_0x73cc89=_0x73cc89-0x0;var _0x2bfa6f=_0xbcd8[_0x73cc89];return _0x2bfa6f;};'use strict';var _=require(_0x8bcd('0x0'));var util=require('util');var moment=require(_0x8bcd('0x1'));var BPromise=require(_0x8bcd('0x2'));var rs=require(_0x8bcd('0x3'));var fs=require('fs');var Redis=require(_0x8bcd('0x4'));var db=require(_0x8bcd('0x5'))['db'];var utils=require(_0x8bcd('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x8bcd('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x8bcd('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xf83c0b,_0x3c6c9e,_0x1c5f3f){return new BPromise(function(_0x525692,_0x301a2c){return client[_0x8bcd('0x9')](_0xf83c0b,_0x1c5f3f)[_0x8bcd('0xa')](function(_0x10bcef){logger[_0x8bcd('0xb')](_0x8bcd('0xc'),_0x3c6c9e,_0x8bcd('0xd'));logger[_0x8bcd('0xe')]('SmsQueueReport,\x20%s,\x20%s,\x20%s',_0x3c6c9e,'request\x20sent',JSON[_0x8bcd('0xf')](_0x10bcef));if(_0x10bcef[_0x8bcd('0x10')]){if(_0x10bcef['error'][_0x8bcd('0x11')]===0x1f4){logger['error']('SmsQueueReport,\x20%s,\x20%s',_0x3c6c9e,_0x10bcef[_0x8bcd('0x10')][_0x8bcd('0x12')]);return _0x301a2c(_0x10bcef[_0x8bcd('0x10')][_0x8bcd('0x12')]);}logger[_0x8bcd('0x10')]('SmsQueueReport,\x20%s,\x20%s',_0x3c6c9e,_0x10bcef['error'][_0x8bcd('0x12')]);return _0x525692(_0x10bcef[_0x8bcd('0x10')][_0x8bcd('0x12')]);}else{logger['info'](_0x8bcd('0xc'),_0x3c6c9e,_0x8bcd('0xd'));_0x525692(_0x10bcef[_0x8bcd('0x13')][_0x8bcd('0x12')]);}})[_0x8bcd('0x14')](function(_0x28a180){logger['error'](_0x8bcd('0xc'),_0x3c6c9e,_0x28a180);_0x301a2c(_0x28a180);});});}exports[_0x8bcd('0x15')]=function(_0x52660c){var _0x298698=this;return new Promise(function(_0x267262,_0x23c5a2){return db[_0x8bcd('0x16')][_0x8bcd('0x17')](_0x52660c[_0x8bcd('0x18')],{'raw':_0x52660c[_0x8bcd('0x19')]?_0x52660c['options']['raw']===undefined?!![]:![]:!![]})['then'](function(_0x2c0026){logger[_0x8bcd('0xb')]('CreateSmsQueueReport',_0x52660c);logger[_0x8bcd('0xe')]('CreateSmsQueueReport',_0x52660c,JSON[_0x8bcd('0xf')](_0x2c0026));_0x267262(_0x2c0026);})[_0x8bcd('0x14')](function(_0x23ae5e){logger[_0x8bcd('0x10')](_0x8bcd('0x15'),_0x23ae5e['message'],_0x52660c);_0x23c5a2(_0x298698[_0x8bcd('0x10')](0x1f4,_0x23ae5e[_0x8bcd('0x12')]));});});};exports[_0x8bcd('0x1a')]=function(_0x2f85be){var _0x1d8cee=this;return new Promise(function(_0x272b96,_0x11a620){return db[_0x8bcd('0x16')][_0x8bcd('0x1b')](_0x2f85be[_0x8bcd('0x18')],{'raw':_0x2f85be['options']?_0x2f85be[_0x8bcd('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2f85be['options']?_0x2f85be[_0x8bcd('0x19')]['where']||null:null,'attributes':_0x2f85be[_0x8bcd('0x19')]?_0x2f85be[_0x8bcd('0x19')][_0x8bcd('0x1c')]||null:null,'limit':_0x2f85be[_0x8bcd('0x19')]?_0x2f85be[_0x8bcd('0x19')][_0x8bcd('0x1d')]||null:null})['then'](function(_0x4ac2d7){logger[_0x8bcd('0xb')]('UpdateSmsQueueReport',_0x2f85be);logger[_0x8bcd('0xe')](_0x8bcd('0x1a'),_0x2f85be,JSON[_0x8bcd('0xf')](_0x4ac2d7));_0x272b96(_0x4ac2d7);})[_0x8bcd('0x14')](function(_0x488e0a){logger[_0x8bcd('0x10')]('UpdateSmsQueueReport',_0x488e0a[_0x8bcd('0x12')],_0x2f85be);_0x11a620(_0x1d8cee[_0x8bcd('0x10')](0x1f4,_0x488e0a[_0x8bcd('0x12')]));});});};