Built motion from commit 10af8726.|2.6.34
[motion2.git] / server / api / smsAccount / smsAccount.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 _0x19af=['request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','SmsAccount','find','options','where','attributes','include','map','model','ShowSmsAccount','debug','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','defaults','socket.io-emitter','./smsAccount.socket','register'];(function(_0x9c9587,_0x4894c1){var _0x13df91=function(_0x57e18a){while(--_0x57e18a){_0x9c9587['push'](_0x9c9587['shift']());}};_0x13df91(++_0x4894c1);}(_0x19af,0x85));var _0xf19a=function(_0xf82ec,_0x5a1db4){_0xf82ec=_0xf82ec-0x0;var _0x1ad7b0=_0x19af[_0xf82ec];return _0x1ad7b0;};'use strict';var _=require(_0xf19a('0x0'));var util=require(_0xf19a('0x1'));var moment=require(_0xf19a('0x2'));var BPromise=require('bluebird');var rs=require(_0xf19a('0x3'));var fs=require('fs');var Redis=require(_0xf19a('0x4'));var db=require(_0xf19a('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xf19a('0x6'))(_0xf19a('0x7'));var config=require(_0xf19a('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xf19a('0x9')][_0xf19a('0xa')]({'port':0x232a});config['redis']=_[_0xf19a('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xf19a('0xc'))(new Redis(config['redis']));require(_0xf19a('0xd'))[_0xf19a('0xe')](socket);function respondWithRpcPromise(_0x25b2c4,_0x3fdbe4,_0x57fa0a){return new BPromise(function(_0x5f054a,_0x2be0ba){return client[_0xf19a('0xf')](_0x25b2c4,_0x57fa0a)[_0xf19a('0x10')](function(_0x188ec8){logger[_0xf19a('0x11')](_0xf19a('0x12'),_0x3fdbe4,_0xf19a('0x13'));logger['debug'](_0xf19a('0x14'),_0x3fdbe4,_0xf19a('0x13'),JSON[_0xf19a('0x15')](_0x188ec8));if(_0x188ec8['error']){if(_0x188ec8[_0xf19a('0x16')][_0xf19a('0x17')]===0x1f4){logger[_0xf19a('0x16')]('SmsAccount,\x20%s,\x20%s',_0x3fdbe4,_0x188ec8[_0xf19a('0x16')][_0xf19a('0x18')]);return _0x2be0ba(_0x188ec8[_0xf19a('0x16')][_0xf19a('0x18')]);}logger[_0xf19a('0x16')](_0xf19a('0x12'),_0x3fdbe4,_0x188ec8['error']['message']);return _0x5f054a(_0x188ec8['error'][_0xf19a('0x18')]);}else{logger[_0xf19a('0x11')](_0xf19a('0x12'),_0x3fdbe4,_0xf19a('0x13'));_0x5f054a(_0x188ec8[_0xf19a('0x19')][_0xf19a('0x18')]);}})[_0xf19a('0x1a')](function(_0xa2d5c8){logger[_0xf19a('0x16')](_0xf19a('0x12'),_0x3fdbe4,_0xa2d5c8);_0x2be0ba(_0xa2d5c8);});});}exports['ShowSmsAccount']=function(_0x334dc8){var _0x22db41=this;return new Promise(function(_0x3c7085,_0x13baf6){return db[_0xf19a('0x1b')][_0xf19a('0x1c')]({'raw':_0x334dc8['options']?_0x334dc8[_0xf19a('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x334dc8[_0xf19a('0x1d')]?_0x334dc8[_0xf19a('0x1d')][_0xf19a('0x1e')]||null:null,'attributes':_0x334dc8[_0xf19a('0x1d')]?_0x334dc8[_0xf19a('0x1d')][_0xf19a('0x1f')]||null:null,'include':_0x334dc8[_0xf19a('0x1d')]?_0x334dc8[_0xf19a('0x1d')][_0xf19a('0x20')]?_[_0xf19a('0x21')](_0x334dc8[_0xf19a('0x1d')][_0xf19a('0x20')],function(_0x9db8e9){return{'model':db[_0x9db8e9[_0xf19a('0x22')]],'as':_0x9db8e9['as'],'attributes':_0x9db8e9['attributes'],'include':_0x9db8e9[_0xf19a('0x20')]?_[_0xf19a('0x21')](_0x9db8e9['include'],function(_0xec2558){return{'model':db[_0xec2558[_0xf19a('0x22')]],'as':_0xec2558['as'],'attributes':_0xec2558[_0xf19a('0x1f')],'include':_0xec2558[_0xf19a('0x20')]?_[_0xf19a('0x21')](_0xec2558[_0xf19a('0x20')],function(_0x1e897c){return{'model':db[_0x1e897c[_0xf19a('0x22')]],'as':_0x1e897c['as'],'attributes':_0x1e897c['attributes']};}):[]};}):[]};}):[]:[]})[_0xf19a('0x10')](function(_0x18817b){logger[_0xf19a('0x11')](_0xf19a('0x23'),_0x334dc8);logger[_0xf19a('0x24')](_0xf19a('0x23'),_0x334dc8,JSON[_0xf19a('0x15')](_0x18817b));_0x3c7085(_0x18817b);})[_0xf19a('0x1a')](function(_0xf04c81){logger[_0xf19a('0x16')](_0xf19a('0x23'),_0xf04c81[_0xf19a('0x18')],_0x334dc8);_0x13baf6(_0x22db41['error'](0x1f4,_0xf04c81[_0xf19a('0x18')]));});});};