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 _0xa249=['http','redis','./smsAccount.socket','request','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','error','code','message','info','catch','find','options','raw','where','attributes','include','map','model','then','ShowSmsAccount','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x27604f,_0x5ae336){var _0x40d189=function(_0xebacde){while(--_0xebacde){_0x27604f['push'](_0x27604f['shift']());}};_0x40d189(++_0x5ae336);}(_0xa249,0x130));var _0x9a24=function(_0xabc97,_0x47be61){_0xabc97=_0xabc97-0x0;var _0x3c0b97=_0xa249[_0xabc97];return _0x3c0b97;};'use strict';var _=require(_0x9a24('0x0'));var util=require(_0x9a24('0x1'));var moment=require(_0x9a24('0x2'));var BPromise=require(_0x9a24('0x3'));var rs=require(_0x9a24('0x4'));var fs=require('fs');var Redis=require(_0x9a24('0x5'));var db=require(_0x9a24('0x6'))['db'];var utils=require(_0x9a24('0x7'));var logger=require(_0x9a24('0x8'))(_0x9a24('0x9'));var config=require(_0x9a24('0xa'));var jayson=require('jayson/promise');var client=jayson['client'][_0x9a24('0xb')]({'port':0x232a});config['redis']=_['defaults'](config[_0x9a24('0xc')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x9a24('0xd'))['register'](socket);function respondWithRpcPromise(_0xa76744,_0x11fa0b,_0x2da87f){return new BPromise(function(_0xdfbb33,_0x2656c7){return client[_0x9a24('0xe')](_0xa76744,_0x2da87f)['then'](function(_0x41ec72){logger['info'](_0x9a24('0xf'),_0x11fa0b,_0x9a24('0x10'));logger[_0x9a24('0x11')](_0x9a24('0x12'),_0x11fa0b,_0x9a24('0x10'),JSON['stringify'](_0x41ec72));if(_0x41ec72[_0x9a24('0x13')]){if(_0x41ec72['error'][_0x9a24('0x14')]===0x1f4){logger[_0x9a24('0x13')](_0x9a24('0xf'),_0x11fa0b,_0x41ec72['error']['message']);return _0x2656c7(_0x41ec72[_0x9a24('0x13')][_0x9a24('0x15')]);}logger[_0x9a24('0x13')](_0x9a24('0xf'),_0x11fa0b,_0x41ec72[_0x9a24('0x13')][_0x9a24('0x15')]);return _0xdfbb33(_0x41ec72[_0x9a24('0x13')][_0x9a24('0x15')]);}else{logger[_0x9a24('0x16')](_0x9a24('0xf'),_0x11fa0b,_0x9a24('0x10'));_0xdfbb33(_0x41ec72['result'][_0x9a24('0x15')]);}})[_0x9a24('0x17')](function(_0x33ef3a){logger[_0x9a24('0x13')](_0x9a24('0xf'),_0x11fa0b,_0x33ef3a);_0x2656c7(_0x33ef3a);});});}exports['ShowSmsAccount']=function(_0x333c75){var _0x5e6f03=this;return new Promise(function(_0x890979,_0x30e490){return db['SmsAccount'][_0x9a24('0x18')]({'raw':_0x333c75[_0x9a24('0x19')]?_0x333c75[_0x9a24('0x19')][_0x9a24('0x1a')]===undefined?!![]:![]:!![],'where':_0x333c75[_0x9a24('0x19')]?_0x333c75[_0x9a24('0x19')][_0x9a24('0x1b')]||null:null,'attributes':_0x333c75[_0x9a24('0x19')]?_0x333c75[_0x9a24('0x19')][_0x9a24('0x1c')]||null:null,'include':_0x333c75['options']?_0x333c75[_0x9a24('0x19')][_0x9a24('0x1d')]?_[_0x9a24('0x1e')](_0x333c75['options'][_0x9a24('0x1d')],function(_0x3d4ed1){return{'model':db[_0x3d4ed1[_0x9a24('0x1f')]],'as':_0x3d4ed1['as'],'attributes':_0x3d4ed1[_0x9a24('0x1c')],'include':_0x3d4ed1[_0x9a24('0x1d')]?_[_0x9a24('0x1e')](_0x3d4ed1[_0x9a24('0x1d')],function(_0x356b4b){return{'model':db[_0x356b4b[_0x9a24('0x1f')]],'as':_0x356b4b['as'],'attributes':_0x356b4b[_0x9a24('0x1c')],'include':_0x356b4b[_0x9a24('0x1d')]?_[_0x9a24('0x1e')](_0x356b4b['include'],function(_0x1d0013){return{'model':db[_0x1d0013[_0x9a24('0x1f')]],'as':_0x1d0013['as'],'attributes':_0x1d0013[_0x9a24('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x9a24('0x20')](function(_0x325c15){logger[_0x9a24('0x16')]('ShowSmsAccount',_0x333c75);logger[_0x9a24('0x11')](_0x9a24('0x21'),_0x333c75,JSON[_0x9a24('0x22')](_0x325c15));_0x890979(_0x325c15);})[_0x9a24('0x17')](function(_0x545844){logger['error'](_0x9a24('0x21'),_0x545844[_0x9a24('0x15')],_0x333c75);_0x30e490(_0x5e6f03[_0x9a24('0x13')](0x1f4,_0x545844[_0x9a24('0x15')]));});});};