Built motion from commit 3c2ce842.|2.6.31
[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 _0x4f65=['CreateSmsQueueReport','options','raw','debug','UpdateSmsQueueReport','SmsQueueReport','update','attributes','limit','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','then','info','SmsQueueReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch'];(function(_0x19906c,_0xe20691){var _0x2e48be=function(_0x55d671){while(--_0x55d671){_0x19906c['push'](_0x19906c['shift']());}};_0x2e48be(++_0xe20691);}(_0x4f65,0x153));var _0x54f6=function(_0x2f5873,_0x5b3de6){_0x2f5873=_0x2f5873-0x0;var _0x122320=_0x4f65[_0x2f5873];return _0x122320;};'use strict';var _=require(_0x54f6('0x0'));var util=require(_0x54f6('0x1'));var moment=require('moment');var BPromise=require(_0x54f6('0x2'));var rs=require(_0x54f6('0x3'));var fs=require('fs');var Redis=require(_0x54f6('0x4'));var db=require(_0x54f6('0x5'))['db'];var utils=require(_0x54f6('0x6'));var logger=require('../../config/logger')(_0x54f6('0x7'));var config=require(_0x54f6('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x54f6('0x9')][_0x54f6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2a3301,_0xf742e6,_0x33ea1d){return new BPromise(function(_0x714dfa,_0x32f4cd){return client['request'](_0x2a3301,_0x33ea1d)[_0x54f6('0xb')](function(_0x11d403){logger[_0x54f6('0xc')](_0x54f6('0xd'),_0xf742e6,'request\x20sent');logger['debug']('SmsQueueReport,\x20%s,\x20%s,\x20%s',_0xf742e6,_0x54f6('0xe'),JSON[_0x54f6('0xf')](_0x11d403));if(_0x11d403['error']){if(_0x11d403[_0x54f6('0x10')][_0x54f6('0x11')]===0x1f4){logger[_0x54f6('0x10')](_0x54f6('0xd'),_0xf742e6,_0x11d403[_0x54f6('0x10')][_0x54f6('0x12')]);return _0x32f4cd(_0x11d403[_0x54f6('0x10')][_0x54f6('0x12')]);}logger['error'](_0x54f6('0xd'),_0xf742e6,_0x11d403[_0x54f6('0x10')][_0x54f6('0x12')]);return _0x714dfa(_0x11d403[_0x54f6('0x10')]['message']);}else{logger[_0x54f6('0xc')](_0x54f6('0xd'),_0xf742e6,_0x54f6('0xe'));_0x714dfa(_0x11d403[_0x54f6('0x13')][_0x54f6('0x12')]);}})[_0x54f6('0x14')](function(_0x5c2c5){logger[_0x54f6('0x10')](_0x54f6('0xd'),_0xf742e6,_0x5c2c5);_0x32f4cd(_0x5c2c5);});});}exports[_0x54f6('0x15')]=function(_0x1f2e8f){var _0x4d7c4e=this;return new Promise(function(_0x696502,_0x2b7655){return db['SmsQueueReport']['create'](_0x1f2e8f['body'],{'raw':_0x1f2e8f[_0x54f6('0x16')]?_0x1f2e8f[_0x54f6('0x16')][_0x54f6('0x17')]===undefined?!![]:![]:!![]})[_0x54f6('0xb')](function(_0x2405d5){logger[_0x54f6('0xc')](_0x54f6('0x15'),_0x1f2e8f);logger[_0x54f6('0x18')](_0x54f6('0x15'),_0x1f2e8f,JSON[_0x54f6('0xf')](_0x2405d5));_0x696502(_0x2405d5);})[_0x54f6('0x14')](function(_0x98175d){logger[_0x54f6('0x10')](_0x54f6('0x15'),_0x98175d[_0x54f6('0x12')],_0x1f2e8f);_0x2b7655(_0x4d7c4e[_0x54f6('0x10')](0x1f4,_0x98175d[_0x54f6('0x12')]));});});};exports[_0x54f6('0x19')]=function(_0x3fe58b){var _0x35f91a=this;return new Promise(function(_0x30e6e7,_0x28cfb9){return db[_0x54f6('0x1a')][_0x54f6('0x1b')](_0x3fe58b['body'],{'raw':_0x3fe58b[_0x54f6('0x16')]?_0x3fe58b['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3fe58b['options']?_0x3fe58b['options']['where']||null:null,'attributes':_0x3fe58b[_0x54f6('0x16')]?_0x3fe58b[_0x54f6('0x16')][_0x54f6('0x1c')]||null:null,'limit':_0x3fe58b['options']?_0x3fe58b[_0x54f6('0x16')][_0x54f6('0x1d')]||null:null})[_0x54f6('0xb')](function(_0x179da8){logger[_0x54f6('0xc')](_0x54f6('0x19'),_0x3fe58b);logger['debug'](_0x54f6('0x19'),_0x3fe58b,JSON[_0x54f6('0xf')](_0x179da8));_0x30e6e7(_0x179da8);})['catch'](function(_0x13f58e){logger['error'](_0x54f6('0x19'),_0x13f58e[_0x54f6('0x12')],_0x3fe58b);_0x28cfb9(_0x35f91a['error'](0x1f4,_0x13f58e[_0x54f6('0x12')]));});});};