Built motion from commit 1fd437e9.|2.6.19
[motion2.git] / server / api / openchannelApplication / openchannelApplication.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 _0x35c1=['raw','where','attributes','limit','debug','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','http','then','info','OpenchannelApplication,\x20%s,\x20%s','request\x20sent','OpenchannelApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','UpdateOpenchannelApplication','OpenchannelApplication','update','body','options'];(function(_0x5acf1d,_0x17f4d3){var _0x380572=function(_0x887ebe){while(--_0x887ebe){_0x5acf1d['push'](_0x5acf1d['shift']());}};_0x380572(++_0x17f4d3);}(_0x35c1,0x7d));var _0x135c=function(_0x477f1a,_0x4999d3){_0x477f1a=_0x477f1a-0x0;var _0x1cf352=_0x35c1[_0x477f1a];return _0x1cf352;};'use strict';var _=require(_0x135c('0x0'));var util=require(_0x135c('0x1'));var moment=require('moment');var BPromise=require(_0x135c('0x2'));var rs=require(_0x135c('0x3'));var fs=require('fs');var Redis=require(_0x135c('0x4'));var db=require(_0x135c('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x135c('0x6'));var config=require(_0x135c('0x7'));var jayson=require(_0x135c('0x8'));var client=jayson['client'][_0x135c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5d5387,_0x560cec,_0x2565fb){return new BPromise(function(_0x4b03df,_0x259cd0){return client['request'](_0x5d5387,_0x2565fb)[_0x135c('0xa')](function(_0xcbb5eb){logger[_0x135c('0xb')](_0x135c('0xc'),_0x560cec,_0x135c('0xd'));logger['debug'](_0x135c('0xe'),_0x560cec,_0x135c('0xd'),JSON[_0x135c('0xf')](_0xcbb5eb));if(_0xcbb5eb[_0x135c('0x10')]){if(_0xcbb5eb[_0x135c('0x10')][_0x135c('0x11')]===0x1f4){logger[_0x135c('0x10')](_0x135c('0xc'),_0x560cec,_0xcbb5eb['error'][_0x135c('0x12')]);return _0x259cd0(_0xcbb5eb[_0x135c('0x10')]['message']);}logger[_0x135c('0x10')](_0x135c('0xc'),_0x560cec,_0xcbb5eb[_0x135c('0x10')]['message']);return _0x4b03df(_0xcbb5eb[_0x135c('0x10')]['message']);}else{logger[_0x135c('0xb')](_0x135c('0xc'),_0x560cec,_0x135c('0xd'));_0x4b03df(_0xcbb5eb['result']['message']);}})[_0x135c('0x13')](function(_0x2c962c){logger[_0x135c('0x10')](_0x135c('0xc'),_0x560cec,_0x2c962c);_0x259cd0(_0x2c962c);});});}exports[_0x135c('0x14')]=function(_0x152168){var _0x3e71e6=this;return new Promise(function(_0x12378a,_0xf59ec6){return db[_0x135c('0x15')][_0x135c('0x16')](_0x152168[_0x135c('0x17')],{'raw':_0x152168[_0x135c('0x18')]?_0x152168[_0x135c('0x18')][_0x135c('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x152168[_0x135c('0x18')]?_0x152168[_0x135c('0x18')][_0x135c('0x1a')]||null:null,'attributes':_0x152168[_0x135c('0x18')]?_0x152168['options'][_0x135c('0x1b')]||null:null,'limit':_0x152168[_0x135c('0x18')]?_0x152168[_0x135c('0x18')][_0x135c('0x1c')]||null:null})[_0x135c('0xa')](function(_0x51e3b8){logger[_0x135c('0xb')](_0x135c('0x14'),_0x152168);logger[_0x135c('0x1d')](_0x135c('0x14'),_0x152168,JSON[_0x135c('0xf')](_0x51e3b8));_0x12378a(_0x51e3b8);})[_0x135c('0x13')](function(_0xaaa87b){logger[_0x135c('0x10')](_0x135c('0x14'),_0xaaa87b[_0x135c('0x12')],_0x152168);_0xf59ec6(_0x3e71e6[_0x135c('0x10')](0x1f4,_0xaaa87b[_0x135c('0x12')]));});});};