Built motion from commit (unavailable).|2.5.31
[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 _0x53b1=['stringify','ShowFreshdeskAccount','find','raw','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','request','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','GetFreshdeskAccount','FreshdeskAccount','findAll','options','where','limit','include','map','model','attributes','then'];(function(_0x473463,_0x21da73){var _0x42f406=function(_0x34a5be){while(--_0x34a5be){_0x473463['push'](_0x473463['shift']());}};_0x42f406(++_0x21da73);}(_0x53b1,0x6d));var _0x153b=function(_0x57fc7d,_0x445ce6){_0x57fc7d=_0x57fc7d-0x0;var _0xa2ad02=_0x53b1[_0x57fc7d];return _0xa2ad02;};'use strict';var _=require(_0x153b('0x0'));var util=require(_0x153b('0x1'));var moment=require(_0x153b('0x2'));var BPromise=require('bluebird');var rs=require(_0x153b('0x3'));var fs=require('fs');var Redis=require(_0x153b('0x4'));var db=require(_0x153b('0x5'))['db'];var utils=require(_0x153b('0x6'));var logger=require(_0x153b('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x153b('0x8'));var client=jayson['client'][_0x153b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x37e9ac,_0x573b72,_0x4b6c4b){return new BPromise(function(_0x2e0b2c,_0x5d5a9b){return client[_0x153b('0xa')](_0x37e9ac,_0x4b6c4b)['then'](function(_0x5359d5){logger[_0x153b('0xb')](_0x153b('0xc'),_0x573b72,_0x153b('0xd'));logger[_0x153b('0xe')]('FreshdeskAccount,\x20%s,\x20%s,\x20%s',_0x573b72,'request\x20sent',JSON['stringify'](_0x5359d5));if(_0x5359d5[_0x153b('0xf')]){if(_0x5359d5[_0x153b('0xf')][_0x153b('0x10')]===0x1f4){logger['error'](_0x153b('0xc'),_0x573b72,_0x5359d5[_0x153b('0xf')]['message']);return _0x5d5a9b(_0x5359d5[_0x153b('0xf')][_0x153b('0x11')]);}logger[_0x153b('0xf')](_0x153b('0xc'),_0x573b72,_0x5359d5['error'][_0x153b('0x11')]);return _0x2e0b2c(_0x5359d5[_0x153b('0xf')][_0x153b('0x11')]);}else{logger['info']('FreshdeskAccount,\x20%s,\x20%s',_0x573b72,_0x153b('0xd'));_0x2e0b2c(_0x5359d5[_0x153b('0x12')][_0x153b('0x11')]);}})[_0x153b('0x13')](function(_0x2dec93){logger[_0x153b('0xf')]('FreshdeskAccount,\x20%s,\x20%s',_0x573b72,_0x2dec93);_0x5d5a9b(_0x2dec93);});});}exports[_0x153b('0x14')]=function(_0x528744){var _0x45d009=this;return new Promise(function(_0x5b7248,_0x1a5002){return db[_0x153b('0x15')][_0x153b('0x16')]({'raw':_0x528744['options']?_0x528744[_0x153b('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x528744[_0x153b('0x17')]?_0x528744[_0x153b('0x17')][_0x153b('0x18')]||null:null,'attributes':_0x528744['options']?_0x528744[_0x153b('0x17')]['attributes']||null:null,'limit':_0x528744[_0x153b('0x17')]?_0x528744[_0x153b('0x17')][_0x153b('0x19')]||null:null,'include':_0x528744[_0x153b('0x17')]?_0x528744[_0x153b('0x17')][_0x153b('0x1a')]?_[_0x153b('0x1b')](_0x528744[_0x153b('0x17')][_0x153b('0x1a')],function(_0x3d8883){return{'model':db[_0x3d8883[_0x153b('0x1c')]],'as':_0x3d8883['as'],'attributes':_0x3d8883[_0x153b('0x1d')],'include':_0x3d8883[_0x153b('0x1a')]?_[_0x153b('0x1b')](_0x3d8883[_0x153b('0x1a')],function(_0x45006d){return{'model':db[_0x45006d[_0x153b('0x1c')]],'as':_0x45006d['as'],'attributes':_0x45006d[_0x153b('0x1d')],'include':_0x45006d[_0x153b('0x1a')]?_[_0x153b('0x1b')](_0x45006d['include'],function(_0x23a357){return{'model':db[_0x23a357[_0x153b('0x1c')]],'as':_0x23a357['as'],'attributes':_0x23a357[_0x153b('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x153b('0x1e')](function(_0x505679){logger['info'](_0x153b('0x14'),_0x528744);logger[_0x153b('0xe')](_0x153b('0x14'),_0x528744,JSON[_0x153b('0x1f')](_0x505679));_0x5b7248(_0x505679);})[_0x153b('0x13')](function(_0x501093){logger[_0x153b('0xf')]('GetFreshdeskAccount',_0x501093['message'],_0x528744);_0x1a5002(_0x45d009[_0x153b('0xf')](0x1f4,_0x501093[_0x153b('0x11')]));});});};exports[_0x153b('0x20')]=function(_0x1bae24){var _0x5ef16e=this;return new Promise(function(_0x1520b3,_0x423305){return db[_0x153b('0x15')][_0x153b('0x21')]({'raw':_0x1bae24[_0x153b('0x17')]?_0x1bae24[_0x153b('0x17')][_0x153b('0x22')]===undefined?!![]:![]:!![],'where':_0x1bae24['options']?_0x1bae24[_0x153b('0x17')]['where']||null:null,'attributes':_0x1bae24['options']?_0x1bae24['options'][_0x153b('0x1d')]||null:null,'include':_0x1bae24[_0x153b('0x17')]?_0x1bae24[_0x153b('0x17')][_0x153b('0x1a')]?_[_0x153b('0x1b')](_0x1bae24['options']['include'],function(_0x5e52d8){return{'model':db[_0x5e52d8['model']],'as':_0x5e52d8['as'],'attributes':_0x5e52d8[_0x153b('0x1d')],'include':_0x5e52d8[_0x153b('0x1a')]?_[_0x153b('0x1b')](_0x5e52d8[_0x153b('0x1a')],function(_0x2e6b2a){return{'model':db[_0x2e6b2a['model']],'as':_0x2e6b2a['as'],'attributes':_0x2e6b2a[_0x153b('0x1d')],'include':_0x2e6b2a[_0x153b('0x1a')]?_[_0x153b('0x1b')](_0x2e6b2a[_0x153b('0x1a')],function(_0x3c01d3){return{'model':db[_0x3c01d3[_0x153b('0x1c')]],'as':_0x3c01d3['as'],'attributes':_0x3c01d3[_0x153b('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x153b('0x1e')](function(_0x5ea6f2){logger[_0x153b('0xb')](_0x153b('0x20'),_0x1bae24);logger[_0x153b('0xe')](_0x153b('0x20'),_0x1bae24,JSON['stringify'](_0x5ea6f2));_0x1520b3(_0x5ea6f2);})[_0x153b('0x13')](function(_0x50d855){logger[_0x153b('0xf')](_0x153b('0x20'),_0x50d855[_0x153b('0x11')],_0x1bae24);_0x423305(_0x5ef16e['error'](0x1f4,_0x50d855['message']));});});};