Built motion from commit 953226e6.|2.6.32
[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 _0x6caf=['create','body','options','raw','then','debug','UpdateSmsQueueReport','update','where','attributes','limit','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','http','info','SmsQueueReport,\x20%s,\x20%s','request\x20sent','SmsQueueReport,\x20%s,\x20%s,\x20%s','code','error','message','catch','CreateSmsQueueReport','SmsQueueReport'];(function(_0x42d9db,_0x48a1ed){var _0x556ba5=function(_0x223b07){while(--_0x223b07){_0x42d9db['push'](_0x42d9db['shift']());}};_0x556ba5(++_0x48a1ed);}(_0x6caf,0xf3));var _0xf6ca=function(_0x2085f3,_0x50105b){_0x2085f3=_0x2085f3-0x0;var _0x384e3c=_0x6caf[_0x2085f3];return _0x384e3c;};'use strict';var _=require(_0xf6ca('0x0'));var util=require(_0xf6ca('0x1'));var moment=require(_0xf6ca('0x2'));var BPromise=require(_0xf6ca('0x3'));var rs=require(_0xf6ca('0x4'));var fs=require('fs');var Redis=require(_0xf6ca('0x5'));var db=require(_0xf6ca('0x6'))['db'];var utils=require(_0xf6ca('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xf6ca('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xf6ca('0x9')][_0xf6ca('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x21adb4,_0x21dca5,_0x44cbc3){return new BPromise(function(_0x47a127,_0x30412f){return client['request'](_0x21adb4,_0x44cbc3)['then'](function(_0x278967){logger[_0xf6ca('0xb')](_0xf6ca('0xc'),_0x21dca5,_0xf6ca('0xd'));logger['debug'](_0xf6ca('0xe'),_0x21dca5,_0xf6ca('0xd'),JSON['stringify'](_0x278967));if(_0x278967['error']){if(_0x278967['error'][_0xf6ca('0xf')]===0x1f4){logger['error'](_0xf6ca('0xc'),_0x21dca5,_0x278967[_0xf6ca('0x10')][_0xf6ca('0x11')]);return _0x30412f(_0x278967['error'][_0xf6ca('0x11')]);}logger['error'](_0xf6ca('0xc'),_0x21dca5,_0x278967[_0xf6ca('0x10')][_0xf6ca('0x11')]);return _0x47a127(_0x278967['error'][_0xf6ca('0x11')]);}else{logger[_0xf6ca('0xb')](_0xf6ca('0xc'),_0x21dca5,_0xf6ca('0xd'));_0x47a127(_0x278967['result'][_0xf6ca('0x11')]);}})[_0xf6ca('0x12')](function(_0x274ccf){logger[_0xf6ca('0x10')](_0xf6ca('0xc'),_0x21dca5,_0x274ccf);_0x30412f(_0x274ccf);});});}exports[_0xf6ca('0x13')]=function(_0x363c84){var _0x2d80a8=this;return new Promise(function(_0x20b218,_0x316c3d){return db[_0xf6ca('0x14')][_0xf6ca('0x15')](_0x363c84[_0xf6ca('0x16')],{'raw':_0x363c84[_0xf6ca('0x17')]?_0x363c84[_0xf6ca('0x17')][_0xf6ca('0x18')]===undefined?!![]:![]:!![]})[_0xf6ca('0x19')](function(_0x4e4b03){logger[_0xf6ca('0xb')](_0xf6ca('0x13'),_0x363c84);logger[_0xf6ca('0x1a')](_0xf6ca('0x13'),_0x363c84,JSON['stringify'](_0x4e4b03));_0x20b218(_0x4e4b03);})[_0xf6ca('0x12')](function(_0x1040e0){logger[_0xf6ca('0x10')]('CreateSmsQueueReport',_0x1040e0['message'],_0x363c84);_0x316c3d(_0x2d80a8['error'](0x1f4,_0x1040e0[_0xf6ca('0x11')]));});});};exports[_0xf6ca('0x1b')]=function(_0x4a37a8){var _0x330f6a=this;return new Promise(function(_0x5c56c5,_0x5d91a0){return db[_0xf6ca('0x14')][_0xf6ca('0x1c')](_0x4a37a8[_0xf6ca('0x16')],{'raw':_0x4a37a8[_0xf6ca('0x17')]?_0x4a37a8[_0xf6ca('0x17')][_0xf6ca('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4a37a8[_0xf6ca('0x17')]?_0x4a37a8['options'][_0xf6ca('0x1d')]||null:null,'attributes':_0x4a37a8[_0xf6ca('0x17')]?_0x4a37a8[_0xf6ca('0x17')][_0xf6ca('0x1e')]||null:null,'limit':_0x4a37a8[_0xf6ca('0x17')]?_0x4a37a8[_0xf6ca('0x17')][_0xf6ca('0x1f')]||null:null})[_0xf6ca('0x19')](function(_0x23cba7){logger[_0xf6ca('0xb')](_0xf6ca('0x1b'),_0x4a37a8);logger['debug']('UpdateSmsQueueReport',_0x4a37a8,JSON[_0xf6ca('0x20')](_0x23cba7));_0x5c56c5(_0x23cba7);})[_0xf6ca('0x12')](function(_0x34237d){logger[_0xf6ca('0x10')](_0xf6ca('0x1b'),_0x34237d[_0xf6ca('0x11')],_0x4a37a8);_0x5d91a0(_0x330f6a[_0xf6ca('0x10')](0x1f4,_0x34237d[_0xf6ca('0x11')]));});});};