Built motion from commit d69f4380.|2.6.29
[motion2.git] / server / api / intZendeskAccount / intZendeskAccount.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 _0x1eae=['GetZendeskAccount','options','raw','where','attributes','limit','include','model','debug','catch','ShowZendeskAccount','ZendeskAccount','find','map','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result'];(function(_0x12fc8d,_0x19ee33){var _0x3f9d04=function(_0x52e51c){while(--_0x52e51c){_0x12fc8d['push'](_0x12fc8d['shift']());}};_0x3f9d04(++_0x19ee33);}(_0x1eae,0x12e));var _0xe1ea=function(_0x532451,_0x21109a){_0x532451=_0x532451-0x0;var _0x2981f9=_0x1eae[_0x532451];return _0x2981f9;};'use strict';var _=require(_0xe1ea('0x0'));var util=require(_0xe1ea('0x1'));var moment=require(_0xe1ea('0x2'));var BPromise=require(_0xe1ea('0x3'));var rs=require(_0xe1ea('0x4'));var fs=require('fs');var Redis=require(_0xe1ea('0x5'));var db=require(_0xe1ea('0x6'))['db'];var utils=require(_0xe1ea('0x7'));var logger=require('../../config/logger')(_0xe1ea('0x8'));var config=require(_0xe1ea('0x9'));var jayson=require(_0xe1ea('0xa'));var client=jayson['client'][_0xe1ea('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x45ca78,_0x4a7271,_0x3a4707){return new BPromise(function(_0x2bc78a,_0xec4571){return client[_0xe1ea('0xc')](_0x45ca78,_0x3a4707)[_0xe1ea('0xd')](function(_0x78f43d){logger[_0xe1ea('0xe')](_0xe1ea('0xf'),_0x4a7271,_0xe1ea('0x10'));logger['debug']('ZendeskAccount,\x20%s,\x20%s,\x20%s',_0x4a7271,_0xe1ea('0x10'),JSON[_0xe1ea('0x11')](_0x78f43d));if(_0x78f43d[_0xe1ea('0x12')]){if(_0x78f43d[_0xe1ea('0x12')][_0xe1ea('0x13')]===0x1f4){logger[_0xe1ea('0x12')](_0xe1ea('0xf'),_0x4a7271,_0x78f43d['error'][_0xe1ea('0x14')]);return _0xec4571(_0x78f43d[_0xe1ea('0x12')][_0xe1ea('0x14')]);}logger[_0xe1ea('0x12')]('ZendeskAccount,\x20%s,\x20%s',_0x4a7271,_0x78f43d['error'][_0xe1ea('0x14')]);return _0x2bc78a(_0x78f43d[_0xe1ea('0x12')][_0xe1ea('0x14')]);}else{logger[_0xe1ea('0xe')](_0xe1ea('0xf'),_0x4a7271,'request\x20sent');_0x2bc78a(_0x78f43d[_0xe1ea('0x15')][_0xe1ea('0x14')]);}})['catch'](function(_0xaa9233){logger[_0xe1ea('0x12')](_0xe1ea('0xf'),_0x4a7271,_0xaa9233);_0xec4571(_0xaa9233);});});}exports[_0xe1ea('0x16')]=function(_0x47f18b){var _0x5f512a=this;return new Promise(function(_0x5bc6a5,_0x1d56fb){return db['ZendeskAccount']['findAll']({'raw':_0x47f18b[_0xe1ea('0x17')]?_0x47f18b['options'][_0xe1ea('0x18')]===undefined?!![]:![]:!![],'where':_0x47f18b[_0xe1ea('0x17')]?_0x47f18b['options'][_0xe1ea('0x19')]||null:null,'attributes':_0x47f18b[_0xe1ea('0x17')]?_0x47f18b[_0xe1ea('0x17')][_0xe1ea('0x1a')]||null:null,'limit':_0x47f18b['options']?_0x47f18b[_0xe1ea('0x17')][_0xe1ea('0x1b')]||null:null,'include':_0x47f18b['options']?_0x47f18b[_0xe1ea('0x17')]['include']?_['map'](_0x47f18b[_0xe1ea('0x17')][_0xe1ea('0x1c')],function(_0x29ecb2){return{'model':db[_0x29ecb2[_0xe1ea('0x1d')]],'as':_0x29ecb2['as'],'attributes':_0x29ecb2[_0xe1ea('0x1a')],'include':_0x29ecb2[_0xe1ea('0x1c')]?_['map'](_0x29ecb2[_0xe1ea('0x1c')],function(_0x45524e){return{'model':db[_0x45524e[_0xe1ea('0x1d')]],'as':_0x45524e['as'],'attributes':_0x45524e['attributes'],'include':_0x45524e[_0xe1ea('0x1c')]?_['map'](_0x45524e[_0xe1ea('0x1c')],function(_0x5859da){return{'model':db[_0x5859da[_0xe1ea('0x1d')]],'as':_0x5859da['as'],'attributes':_0x5859da[_0xe1ea('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xe1ea('0xd')](function(_0x45a1d3){logger[_0xe1ea('0xe')]('GetZendeskAccount',_0x47f18b);logger[_0xe1ea('0x1e')]('GetZendeskAccount',_0x47f18b,JSON[_0xe1ea('0x11')](_0x45a1d3));_0x5bc6a5(_0x45a1d3);})[_0xe1ea('0x1f')](function(_0x3a2254){logger[_0xe1ea('0x12')]('GetZendeskAccount',_0x3a2254[_0xe1ea('0x14')],_0x47f18b);_0x1d56fb(_0x5f512a[_0xe1ea('0x12')](0x1f4,_0x3a2254[_0xe1ea('0x14')]));});});};exports[_0xe1ea('0x20')]=function(_0xaadc4c){var _0x394a28=this;return new Promise(function(_0x1be5cd,_0x18c28b){return db[_0xe1ea('0x21')][_0xe1ea('0x22')]({'raw':_0xaadc4c[_0xe1ea('0x17')]?_0xaadc4c['options'][_0xe1ea('0x18')]===undefined?!![]:![]:!![],'where':_0xaadc4c['options']?_0xaadc4c[_0xe1ea('0x17')][_0xe1ea('0x19')]||null:null,'attributes':_0xaadc4c[_0xe1ea('0x17')]?_0xaadc4c[_0xe1ea('0x17')]['attributes']||null:null,'include':_0xaadc4c[_0xe1ea('0x17')]?_0xaadc4c[_0xe1ea('0x17')][_0xe1ea('0x1c')]?_[_0xe1ea('0x23')](_0xaadc4c[_0xe1ea('0x17')]['include'],function(_0x24e0e5){return{'model':db[_0x24e0e5['model']],'as':_0x24e0e5['as'],'attributes':_0x24e0e5[_0xe1ea('0x1a')],'include':_0x24e0e5[_0xe1ea('0x1c')]?_['map'](_0x24e0e5[_0xe1ea('0x1c')],function(_0x12c2c7){return{'model':db[_0x12c2c7[_0xe1ea('0x1d')]],'as':_0x12c2c7['as'],'attributes':_0x12c2c7[_0xe1ea('0x1a')],'include':_0x12c2c7[_0xe1ea('0x1c')]?_[_0xe1ea('0x23')](_0x12c2c7[_0xe1ea('0x1c')],function(_0x103aa4){return{'model':db[_0x103aa4[_0xe1ea('0x1d')]],'as':_0x103aa4['as'],'attributes':_0x103aa4[_0xe1ea('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xe1ea('0xd')](function(_0x5c4692){logger[_0xe1ea('0xe')](_0xe1ea('0x20'),_0xaadc4c);logger['debug']('ShowZendeskAccount',_0xaadc4c,JSON[_0xe1ea('0x11')](_0x5c4692));_0x1be5cd(_0x5c4692);})['catch'](function(_0x3e9c26){logger['error']('ShowZendeskAccount',_0x3e9c26[_0xe1ea('0x14')],_0xaadc4c);_0x18c28b(_0x394a28[_0xe1ea('0x12')](0x1f4,_0x3e9c26[_0xe1ea('0x14')]));});});};