Built motion from commit bab6f49e.|2.6.17
[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 _0x11ff=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','SmsQueueReport,\x20%s,\x20%s','result','SmsQueueReport','create','body','options','info','CreateSmsQueueReport','stringify','UpdateSmsQueueReport','update','raw','where','limit','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb'];(function(_0x41ee16,_0xfa94c3){var _0x1f60de=function(_0x1c8ffc){while(--_0x1c8ffc){_0x41ee16['push'](_0x41ee16['shift']());}};_0x1f60de(++_0xfa94c3);}(_0x11ff,0xa9));var _0xf11f=function(_0x5539a9,_0x2153bf){_0x5539a9=_0x5539a9-0x0;var _0x463a4f=_0x11ff[_0x5539a9];return _0x463a4f;};'use strict';var _=require(_0xf11f('0x0'));var util=require(_0xf11f('0x1'));var moment=require(_0xf11f('0x2'));var BPromise=require('bluebird');var rs=require(_0xf11f('0x3'));var fs=require('fs');var Redis=require(_0xf11f('0x4'));var db=require(_0xf11f('0x5'))['db'];var utils=require(_0xf11f('0x6'));var logger=require(_0xf11f('0x7'))(_0xf11f('0x8'));var config=require(_0xf11f('0x9'));var jayson=require(_0xf11f('0xa'));var client=jayson[_0xf11f('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x48d429,_0x2e7af1,_0x576bc5){return new BPromise(function(_0x515221,_0x94b5d2){return client[_0xf11f('0xc')](_0x48d429,_0x576bc5)[_0xf11f('0xd')](function(_0x1d2ad7){logger['info']('SmsQueueReport,\x20%s,\x20%s',_0x2e7af1,'request\x20sent');logger[_0xf11f('0xe')](_0xf11f('0xf'),_0x2e7af1,_0xf11f('0x10'),JSON['stringify'](_0x1d2ad7));if(_0x1d2ad7['error']){if(_0x1d2ad7[_0xf11f('0x11')][_0xf11f('0x12')]===0x1f4){logger[_0xf11f('0x11')]('SmsQueueReport,\x20%s,\x20%s',_0x2e7af1,_0x1d2ad7[_0xf11f('0x11')][_0xf11f('0x13')]);return _0x94b5d2(_0x1d2ad7['error']['message']);}logger[_0xf11f('0x11')](_0xf11f('0x14'),_0x2e7af1,_0x1d2ad7[_0xf11f('0x11')][_0xf11f('0x13')]);return _0x515221(_0x1d2ad7[_0xf11f('0x11')][_0xf11f('0x13')]);}else{logger['info'](_0xf11f('0x14'),_0x2e7af1,_0xf11f('0x10'));_0x515221(_0x1d2ad7[_0xf11f('0x15')][_0xf11f('0x13')]);}})['catch'](function(_0x2869fa){logger[_0xf11f('0x11')]('SmsQueueReport,\x20%s,\x20%s',_0x2e7af1,_0x2869fa);_0x94b5d2(_0x2869fa);});});}exports['CreateSmsQueueReport']=function(_0x3b7e8c){var _0xa4b17e=this;return new Promise(function(_0xb165b8,_0x36c2cd){return db[_0xf11f('0x16')][_0xf11f('0x17')](_0x3b7e8c[_0xf11f('0x18')],{'raw':_0x3b7e8c['options']?_0x3b7e8c[_0xf11f('0x19')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x55ae7f){logger[_0xf11f('0x1a')](_0xf11f('0x1b'),_0x3b7e8c);logger[_0xf11f('0xe')](_0xf11f('0x1b'),_0x3b7e8c,JSON[_0xf11f('0x1c')](_0x55ae7f));_0xb165b8(_0x55ae7f);})['catch'](function(_0x40dadf){logger[_0xf11f('0x11')](_0xf11f('0x1b'),_0x40dadf[_0xf11f('0x13')],_0x3b7e8c);_0x36c2cd(_0xa4b17e[_0xf11f('0x11')](0x1f4,_0x40dadf['message']));});});};exports[_0xf11f('0x1d')]=function(_0x2d791c){var _0x5405d5=this;return new Promise(function(_0x38ef1e,_0x271ff0){return db[_0xf11f('0x16')][_0xf11f('0x1e')](_0x2d791c[_0xf11f('0x18')],{'raw':_0x2d791c['options']?_0x2d791c[_0xf11f('0x19')][_0xf11f('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2d791c[_0xf11f('0x19')]?_0x2d791c['options'][_0xf11f('0x20')]||null:null,'attributes':_0x2d791c[_0xf11f('0x19')]?_0x2d791c[_0xf11f('0x19')]['attributes']||null:null,'limit':_0x2d791c[_0xf11f('0x19')]?_0x2d791c['options'][_0xf11f('0x21')]||null:null})[_0xf11f('0xd')](function(_0x18d859){logger[_0xf11f('0x1a')](_0xf11f('0x1d'),_0x2d791c);logger['debug'](_0xf11f('0x1d'),_0x2d791c,JSON['stringify'](_0x18d859));_0x38ef1e(_0x18d859);})[_0xf11f('0x22')](function(_0x591376){logger[_0xf11f('0x11')](_0xf11f('0x1d'),_0x591376[_0xf11f('0x13')],_0x2d791c);_0x271ff0(_0x5405d5[_0xf11f('0x11')](0x1f4,_0x591376[_0xf11f('0x13')]));});});};