Built motion from commit b0a9a629.|2.6.33
[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 _0x7a10=['info','catch','CreateSmsQueueReport','SmsQueueReport','create','body','options','UpdateSmsQueueReport','raw','where','attributes','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','request\x20sent','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsQueueReport,\x20%s,\x20%s','message'];(function(_0x22ddc2,_0x5c9c6d){var _0x45c534=function(_0x2bc0ab){while(--_0x2bc0ab){_0x22ddc2['push'](_0x22ddc2['shift']());}};_0x45c534(++_0x5c9c6d);}(_0x7a10,0x1eb));var _0x07a1=function(_0x16a6fe,_0x5865b5){_0x16a6fe=_0x16a6fe-0x0;var _0x367d5f=_0x7a10[_0x16a6fe];return _0x367d5f;};'use strict';var _=require('lodash');var util=require(_0x07a1('0x0'));var moment=require(_0x07a1('0x1'));var BPromise=require(_0x07a1('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x07a1('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x07a1('0x4'));var logger=require(_0x07a1('0x5'))(_0x07a1('0x6'));var config=require(_0x07a1('0x7'));var jayson=require(_0x07a1('0x8'));var client=jayson[_0x07a1('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5a9d9e,_0x45b702,_0x265dc0){return new BPromise(function(_0x2c6e70,_0xf05a9f){return client['request'](_0x5a9d9e,_0x265dc0)[_0x07a1('0xa')](function(_0x2f8664){logger['info']('SmsQueueReport,\x20%s,\x20%s',_0x45b702,_0x07a1('0xb'));logger[_0x07a1('0xc')](_0x07a1('0xd'),_0x45b702,_0x07a1('0xb'),JSON[_0x07a1('0xe')](_0x2f8664));if(_0x2f8664['error']){if(_0x2f8664[_0x07a1('0xf')][_0x07a1('0x10')]===0x1f4){logger[_0x07a1('0xf')](_0x07a1('0x11'),_0x45b702,_0x2f8664[_0x07a1('0xf')]['message']);return _0xf05a9f(_0x2f8664[_0x07a1('0xf')]['message']);}logger[_0x07a1('0xf')]('SmsQueueReport,\x20%s,\x20%s',_0x45b702,_0x2f8664['error'][_0x07a1('0x12')]);return _0x2c6e70(_0x2f8664[_0x07a1('0xf')]['message']);}else{logger[_0x07a1('0x13')]('SmsQueueReport,\x20%s,\x20%s',_0x45b702,_0x07a1('0xb'));_0x2c6e70(_0x2f8664['result']['message']);}})[_0x07a1('0x14')](function(_0x211d7c){logger['error'](_0x07a1('0x11'),_0x45b702,_0x211d7c);_0xf05a9f(_0x211d7c);});});}exports[_0x07a1('0x15')]=function(_0x24a01c){var _0x2c1690=this;return new Promise(function(_0x121d14,_0x1715bf){return db[_0x07a1('0x16')][_0x07a1('0x17')](_0x24a01c[_0x07a1('0x18')],{'raw':_0x24a01c[_0x07a1('0x19')]?_0x24a01c[_0x07a1('0x19')]['raw']===undefined?!![]:![]:!![]})[_0x07a1('0xa')](function(_0x446175){logger['info']('CreateSmsQueueReport',_0x24a01c);logger[_0x07a1('0xc')]('CreateSmsQueueReport',_0x24a01c,JSON[_0x07a1('0xe')](_0x446175));_0x121d14(_0x446175);})[_0x07a1('0x14')](function(_0x48720e){logger['error'](_0x07a1('0x15'),_0x48720e[_0x07a1('0x12')],_0x24a01c);_0x1715bf(_0x2c1690[_0x07a1('0xf')](0x1f4,_0x48720e[_0x07a1('0x12')]));});});};exports[_0x07a1('0x1a')]=function(_0x464816){var _0x151f18=this;return new Promise(function(_0x20c4e4,_0x49c9af){return db['SmsQueueReport']['update'](_0x464816['body'],{'raw':_0x464816[_0x07a1('0x19')]?_0x464816[_0x07a1('0x19')][_0x07a1('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x464816[_0x07a1('0x19')]?_0x464816['options'][_0x07a1('0x1c')]||null:null,'attributes':_0x464816[_0x07a1('0x19')]?_0x464816['options'][_0x07a1('0x1d')]||null:null,'limit':_0x464816[_0x07a1('0x19')]?_0x464816[_0x07a1('0x19')]['limit']||null:null})[_0x07a1('0xa')](function(_0x16808e){logger[_0x07a1('0x13')](_0x07a1('0x1a'),_0x464816);logger[_0x07a1('0xc')]('UpdateSmsQueueReport',_0x464816,JSON[_0x07a1('0xe')](_0x16808e));_0x20c4e4(_0x16808e);})[_0x07a1('0x14')](function(_0x5b4a33){logger[_0x07a1('0xf')]('UpdateSmsQueueReport',_0x5b4a33['message'],_0x464816);_0x49c9af(_0x151f18['error'](0x1f4,_0x5b4a33['message']));});});};