Built motion from commit (unavailable).|2.5.4
[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 _0x51a5=['options','raw','where','attributes','include','map','model','ShowSmsAccount','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','localhost','redis','./smsAccount.socket','register','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','error','message','SmsAccount','find'];(function(_0x40f647,_0x3c5506){var _0x490649=function(_0xcb7c3b){while(--_0xcb7c3b){_0x40f647['push'](_0x40f647['shift']());}};_0x490649(++_0x3c5506);}(_0x51a5,0x155));var _0x551a=function(_0x4eee59,_0x195b9a){_0x4eee59=_0x4eee59-0x0;var _0x42194d=_0x51a5[_0x4eee59];return _0x42194d;};'use strict';var _=require(_0x551a('0x0'));var util=require(_0x551a('0x1'));var moment=require(_0x551a('0x2'));var BPromise=require(_0x551a('0x3'));var rs=require(_0x551a('0x4'));var fs=require('fs');var Redis=require(_0x551a('0x5'));var db=require(_0x551a('0x6'))['db'];var utils=require(_0x551a('0x7'));var logger=require(_0x551a('0x8'))(_0x551a('0x9'));var config=require(_0x551a('0xa'));var jayson=require(_0x551a('0xb'));var client=jayson[_0x551a('0xc')][_0x551a('0xd')]({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':_0x551a('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x551a('0xf')]));require(_0x551a('0x10'))[_0x551a('0x11')](socket);function respondWithRpcPromise(_0x2631f7,_0x573ec3,_0x3c1b59){return new BPromise(function(_0x54a226,_0x1c595f){return client[_0x551a('0x12')](_0x2631f7,_0x3c1b59)[_0x551a('0x13')](function(_0x3a19c7){logger[_0x551a('0x14')](_0x551a('0x15'),_0x573ec3,_0x551a('0x16'));logger[_0x551a('0x17')](_0x551a('0x18'),_0x573ec3,_0x551a('0x16'),JSON['stringify'](_0x3a19c7));if(_0x3a19c7[_0x551a('0x19')]){if(_0x3a19c7[_0x551a('0x19')]['code']===0x1f4){logger[_0x551a('0x19')]('SmsAccount,\x20%s,\x20%s',_0x573ec3,_0x3a19c7['error']['message']);return _0x1c595f(_0x3a19c7['error'][_0x551a('0x1a')]);}logger[_0x551a('0x19')](_0x551a('0x15'),_0x573ec3,_0x3a19c7[_0x551a('0x19')][_0x551a('0x1a')]);return _0x54a226(_0x3a19c7['error'][_0x551a('0x1a')]);}else{logger[_0x551a('0x14')](_0x551a('0x15'),_0x573ec3,_0x551a('0x16'));_0x54a226(_0x3a19c7['result'][_0x551a('0x1a')]);}})['catch'](function(_0x1f755b){logger[_0x551a('0x19')](_0x551a('0x15'),_0x573ec3,_0x1f755b);_0x1c595f(_0x1f755b);});});}exports['ShowSmsAccount']=function(_0x29aaae){var _0x223a1c=this;return new Promise(function(_0x338f49,_0x39fa4a){return db[_0x551a('0x1b')][_0x551a('0x1c')]({'raw':_0x29aaae[_0x551a('0x1d')]?_0x29aaae[_0x551a('0x1d')][_0x551a('0x1e')]===undefined?!![]:![]:!![],'where':_0x29aaae[_0x551a('0x1d')]?_0x29aaae[_0x551a('0x1d')][_0x551a('0x1f')]||null:null,'attributes':_0x29aaae[_0x551a('0x1d')]?_0x29aaae[_0x551a('0x1d')][_0x551a('0x20')]||null:null,'include':_0x29aaae[_0x551a('0x1d')]?_0x29aaae[_0x551a('0x1d')][_0x551a('0x21')]?_['map'](_0x29aaae[_0x551a('0x1d')][_0x551a('0x21')],function(_0x3691bb){return{'model':db[_0x3691bb['model']],'as':_0x3691bb['as'],'attributes':_0x3691bb[_0x551a('0x20')],'include':_0x3691bb['include']?_[_0x551a('0x22')](_0x3691bb[_0x551a('0x21')],function(_0x4e3d68){return{'model':db[_0x4e3d68[_0x551a('0x23')]],'as':_0x4e3d68['as'],'attributes':_0x4e3d68['attributes'],'include':_0x4e3d68[_0x551a('0x21')]?_[_0x551a('0x22')](_0x4e3d68['include'],function(_0xb70cbb){return{'model':db[_0xb70cbb['model']],'as':_0xb70cbb['as'],'attributes':_0xb70cbb['attributes']};}):[]};}):[]};}):[]:[]})[_0x551a('0x13')](function(_0xa7d172){logger[_0x551a('0x14')]('ShowSmsAccount',_0x29aaae);logger[_0x551a('0x17')]('ShowSmsAccount',_0x29aaae,JSON['stringify'](_0xa7d172));_0x338f49(_0xa7d172);})['catch'](function(_0x1c73a7){logger[_0x551a('0x19')](_0x551a('0x24'),_0x1c73a7['message'],_0x29aaae);_0x39fa4a(_0x223a1c['error'](0x1f4,_0x1c73a7[_0x551a('0x1a')]));});});};