Built motion from commit 97153652.|2.6.26
[motion2.git] / server / api / intFreshdeskAccount / intFreshdeskAccount.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 _0xedc0=['../../config/logger','../../config/environment','http','request','then','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','GetFreshdeskAccount','FreshdeskAccount','findAll','options','attributes','limit','map','include','model','ShowFreshdeskAccount','find','raw','where','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x43222c,_0xcc1e44){var _0x3dbcfc=function(_0xe9072e){while(--_0xe9072e){_0x43222c['push'](_0x43222c['shift']());}};_0x3dbcfc(++_0xcc1e44);}(_0xedc0,0x12c));var _0x0edc=function(_0x4a2193,_0x312076){_0x4a2193=_0x4a2193-0x0;var _0x634e78=_0xedc0[_0x4a2193];return _0x634e78;};'use strict';var _=require(_0x0edc('0x0'));var util=require('util');var moment=require(_0x0edc('0x1'));var BPromise=require(_0x0edc('0x2'));var rs=require(_0x0edc('0x3'));var fs=require('fs');var Redis=require(_0x0edc('0x4'));var db=require(_0x0edc('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0edc('0x6'))('rpc');var config=require(_0x0edc('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x0edc('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x561102,_0x5f756,_0x27ff01){return new BPromise(function(_0x3f9e3f,_0x21a100){return client[_0x0edc('0x9')](_0x561102,_0x27ff01)[_0x0edc('0xa')](function(_0x587cb1){logger[_0x0edc('0xb')](_0x0edc('0xc'),_0x5f756,_0x0edc('0xd'));logger[_0x0edc('0xe')]('FreshdeskAccount,\x20%s,\x20%s,\x20%s',_0x5f756,_0x0edc('0xd'),JSON[_0x0edc('0xf')](_0x587cb1));if(_0x587cb1[_0x0edc('0x10')]){if(_0x587cb1[_0x0edc('0x10')][_0x0edc('0x11')]===0x1f4){logger['error'](_0x0edc('0xc'),_0x5f756,_0x587cb1[_0x0edc('0x10')][_0x0edc('0x12')]);return _0x21a100(_0x587cb1['error'][_0x0edc('0x12')]);}logger[_0x0edc('0x10')]('FreshdeskAccount,\x20%s,\x20%s',_0x5f756,_0x587cb1[_0x0edc('0x10')][_0x0edc('0x12')]);return _0x3f9e3f(_0x587cb1['error']['message']);}else{logger[_0x0edc('0xb')](_0x0edc('0xc'),_0x5f756,_0x0edc('0xd'));_0x3f9e3f(_0x587cb1[_0x0edc('0x13')][_0x0edc('0x12')]);}})[_0x0edc('0x14')](function(_0x27794e){logger[_0x0edc('0x10')](_0x0edc('0xc'),_0x5f756,_0x27794e);_0x21a100(_0x27794e);});});}exports[_0x0edc('0x15')]=function(_0x5446e7){var _0x264c8b=this;return new Promise(function(_0xe232e5,_0xee6a0a){return db[_0x0edc('0x16')][_0x0edc('0x17')]({'raw':_0x5446e7[_0x0edc('0x18')]?_0x5446e7[_0x0edc('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x5446e7[_0x0edc('0x18')]?_0x5446e7['options']['where']||null:null,'attributes':_0x5446e7[_0x0edc('0x18')]?_0x5446e7['options'][_0x0edc('0x19')]||null:null,'limit':_0x5446e7[_0x0edc('0x18')]?_0x5446e7[_0x0edc('0x18')][_0x0edc('0x1a')]||null:null,'include':_0x5446e7[_0x0edc('0x18')]?_0x5446e7[_0x0edc('0x18')]['include']?_[_0x0edc('0x1b')](_0x5446e7[_0x0edc('0x18')][_0x0edc('0x1c')],function(_0x424ede){return{'model':db[_0x424ede[_0x0edc('0x1d')]],'as':_0x424ede['as'],'attributes':_0x424ede[_0x0edc('0x19')],'include':_0x424ede[_0x0edc('0x1c')]?_[_0x0edc('0x1b')](_0x424ede['include'],function(_0x2708c9){return{'model':db[_0x2708c9[_0x0edc('0x1d')]],'as':_0x2708c9['as'],'attributes':_0x2708c9[_0x0edc('0x19')],'include':_0x2708c9[_0x0edc('0x1c')]?_[_0x0edc('0x1b')](_0x2708c9[_0x0edc('0x1c')],function(_0x24bd32){return{'model':db[_0x24bd32['model']],'as':_0x24bd32['as'],'attributes':_0x24bd32[_0x0edc('0x19')]};}):[]};}):[]};}):[]:[]})[_0x0edc('0xa')](function(_0x2c84bd){logger['info'](_0x0edc('0x15'),_0x5446e7);logger[_0x0edc('0xe')](_0x0edc('0x15'),_0x5446e7,JSON['stringify'](_0x2c84bd));_0xe232e5(_0x2c84bd);})[_0x0edc('0x14')](function(_0x104fb2){logger[_0x0edc('0x10')](_0x0edc('0x15'),_0x104fb2[_0x0edc('0x12')],_0x5446e7);_0xee6a0a(_0x264c8b[_0x0edc('0x10')](0x1f4,_0x104fb2[_0x0edc('0x12')]));});});};exports[_0x0edc('0x1e')]=function(_0x219c7a){var _0x309a5a=this;return new Promise(function(_0x3beef9,_0x2ceb65){return db[_0x0edc('0x16')][_0x0edc('0x1f')]({'raw':_0x219c7a[_0x0edc('0x18')]?_0x219c7a[_0x0edc('0x18')][_0x0edc('0x20')]===undefined?!![]:![]:!![],'where':_0x219c7a[_0x0edc('0x18')]?_0x219c7a[_0x0edc('0x18')][_0x0edc('0x21')]||null:null,'attributes':_0x219c7a[_0x0edc('0x18')]?_0x219c7a[_0x0edc('0x18')][_0x0edc('0x19')]||null:null,'include':_0x219c7a[_0x0edc('0x18')]?_0x219c7a[_0x0edc('0x18')][_0x0edc('0x1c')]?_[_0x0edc('0x1b')](_0x219c7a['options']['include'],function(_0x56c7d3){return{'model':db[_0x56c7d3['model']],'as':_0x56c7d3['as'],'attributes':_0x56c7d3[_0x0edc('0x19')],'include':_0x56c7d3[_0x0edc('0x1c')]?_[_0x0edc('0x1b')](_0x56c7d3[_0x0edc('0x1c')],function(_0x3331c2){return{'model':db[_0x3331c2[_0x0edc('0x1d')]],'as':_0x3331c2['as'],'attributes':_0x3331c2[_0x0edc('0x19')],'include':_0x3331c2[_0x0edc('0x1c')]?_[_0x0edc('0x1b')](_0x3331c2['include'],function(_0x3d7752){return{'model':db[_0x3d7752[_0x0edc('0x1d')]],'as':_0x3d7752['as'],'attributes':_0x3d7752[_0x0edc('0x19')]};}):[]};}):[]};}):[]:[]})[_0x0edc('0xa')](function(_0x18da92){logger[_0x0edc('0xb')](_0x0edc('0x1e'),_0x219c7a);logger[_0x0edc('0xe')](_0x0edc('0x1e'),_0x219c7a,JSON[_0x0edc('0xf')](_0x18da92));_0x3beef9(_0x18da92);})[_0x0edc('0x14')](function(_0x36349b){logger[_0x0edc('0x10')]('ShowFreshdeskAccount',_0x36349b[_0x0edc('0x12')],_0x219c7a);_0x2ceb65(_0x309a5a[_0x0edc('0x10')](0x1f4,_0x36349b[_0x0edc('0x12')]));});});};