Built motion from commit 20b39a97.|2.6.29
[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 _0x5a78=['debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetFreshdeskAccount','FreshdeskAccount','findAll','options','raw','where','attributes','limit','include','map','model','catch','ShowFreshdeskAccount','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x5a78,0x19b));var _0x85a7=function(_0x138d01,_0x2a2629){_0x138d01=_0x138d01-0x0;var _0x5b14ce=_0x5a78[_0x138d01];return _0x5b14ce;};'use strict';var _=require(_0x85a7('0x0'));var util=require(_0x85a7('0x1'));var moment=require(_0x85a7('0x2'));var BPromise=require(_0x85a7('0x3'));var rs=require(_0x85a7('0x4'));var fs=require('fs');var Redis=require(_0x85a7('0x5'));var db=require(_0x85a7('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x85a7('0x7'))(_0x85a7('0x8'));var config=require(_0x85a7('0x9'));var jayson=require(_0x85a7('0xa'));var client=jayson[_0x85a7('0xb')][_0x85a7('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x559dc4,_0x984ed4,_0x377ccb){return new BPromise(function(_0x371901,_0x6c7207){return client[_0x85a7('0xd')](_0x559dc4,_0x377ccb)[_0x85a7('0xe')](function(_0x5eb30a){logger[_0x85a7('0xf')](_0x85a7('0x10'),_0x984ed4,_0x85a7('0x11'));logger[_0x85a7('0x12')](_0x85a7('0x13'),_0x984ed4,_0x85a7('0x11'),JSON[_0x85a7('0x14')](_0x5eb30a));if(_0x5eb30a[_0x85a7('0x15')]){if(_0x5eb30a[_0x85a7('0x15')][_0x85a7('0x16')]===0x1f4){logger[_0x85a7('0x15')](_0x85a7('0x10'),_0x984ed4,_0x5eb30a['error'][_0x85a7('0x17')]);return _0x6c7207(_0x5eb30a[_0x85a7('0x15')][_0x85a7('0x17')]);}logger[_0x85a7('0x15')](_0x85a7('0x10'),_0x984ed4,_0x5eb30a[_0x85a7('0x15')][_0x85a7('0x17')]);return _0x371901(_0x5eb30a[_0x85a7('0x15')]['message']);}else{logger[_0x85a7('0xf')](_0x85a7('0x10'),_0x984ed4,'request\x20sent');_0x371901(_0x5eb30a[_0x85a7('0x18')][_0x85a7('0x17')]);}})['catch'](function(_0xb7cb38){logger['error'](_0x85a7('0x10'),_0x984ed4,_0xb7cb38);_0x6c7207(_0xb7cb38);});});}exports[_0x85a7('0x19')]=function(_0x95e275){var _0x3ba1a5=this;return new Promise(function(_0x4c8517,_0x361ed4){return db[_0x85a7('0x1a')][_0x85a7('0x1b')]({'raw':_0x95e275[_0x85a7('0x1c')]?_0x95e275[_0x85a7('0x1c')][_0x85a7('0x1d')]===undefined?!![]:![]:!![],'where':_0x95e275['options']?_0x95e275[_0x85a7('0x1c')][_0x85a7('0x1e')]||null:null,'attributes':_0x95e275['options']?_0x95e275[_0x85a7('0x1c')][_0x85a7('0x1f')]||null:null,'limit':_0x95e275['options']?_0x95e275[_0x85a7('0x1c')][_0x85a7('0x20')]||null:null,'include':_0x95e275[_0x85a7('0x1c')]?_0x95e275[_0x85a7('0x1c')][_0x85a7('0x21')]?_[_0x85a7('0x22')](_0x95e275['options'][_0x85a7('0x21')],function(_0x570f38){return{'model':db[_0x570f38[_0x85a7('0x23')]],'as':_0x570f38['as'],'attributes':_0x570f38[_0x85a7('0x1f')],'include':_0x570f38[_0x85a7('0x21')]?_[_0x85a7('0x22')](_0x570f38['include'],function(_0x5423c5){return{'model':db[_0x5423c5[_0x85a7('0x23')]],'as':_0x5423c5['as'],'attributes':_0x5423c5['attributes'],'include':_0x5423c5[_0x85a7('0x21')]?_['map'](_0x5423c5['include'],function(_0x2d0003){return{'model':db[_0x2d0003['model']],'as':_0x2d0003['as'],'attributes':_0x2d0003[_0x85a7('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x34aae7){logger[_0x85a7('0xf')](_0x85a7('0x19'),_0x95e275);logger[_0x85a7('0x12')](_0x85a7('0x19'),_0x95e275,JSON[_0x85a7('0x14')](_0x34aae7));_0x4c8517(_0x34aae7);})[_0x85a7('0x24')](function(_0x3550b5){logger[_0x85a7('0x15')](_0x85a7('0x19'),_0x3550b5['message'],_0x95e275);_0x361ed4(_0x3ba1a5[_0x85a7('0x15')](0x1f4,_0x3550b5['message']));});});};exports[_0x85a7('0x25')]=function(_0x554175){var _0x48877e=this;return new Promise(function(_0x4030c2,_0x99be5a){return db[_0x85a7('0x1a')][_0x85a7('0x26')]({'raw':_0x554175[_0x85a7('0x1c')]?_0x554175[_0x85a7('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x554175['options']?_0x554175[_0x85a7('0x1c')][_0x85a7('0x1e')]||null:null,'attributes':_0x554175[_0x85a7('0x1c')]?_0x554175[_0x85a7('0x1c')]['attributes']||null:null,'include':_0x554175[_0x85a7('0x1c')]?_0x554175['options'][_0x85a7('0x21')]?_[_0x85a7('0x22')](_0x554175[_0x85a7('0x1c')]['include'],function(_0x1fe1e5){return{'model':db[_0x1fe1e5[_0x85a7('0x23')]],'as':_0x1fe1e5['as'],'attributes':_0x1fe1e5[_0x85a7('0x1f')],'include':_0x1fe1e5[_0x85a7('0x21')]?_[_0x85a7('0x22')](_0x1fe1e5['include'],function(_0x39e7ac){return{'model':db[_0x39e7ac[_0x85a7('0x23')]],'as':_0x39e7ac['as'],'attributes':_0x39e7ac['attributes'],'include':_0x39e7ac[_0x85a7('0x21')]?_[_0x85a7('0x22')](_0x39e7ac[_0x85a7('0x21')],function(_0x4b443a){return{'model':db[_0x4b443a[_0x85a7('0x23')]],'as':_0x4b443a['as'],'attributes':_0x4b443a[_0x85a7('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x85a7('0xe')](function(_0x4def00){logger[_0x85a7('0xf')](_0x85a7('0x25'),_0x554175);logger[_0x85a7('0x12')](_0x85a7('0x25'),_0x554175,JSON['stringify'](_0x4def00));_0x4030c2(_0x4def00);})[_0x85a7('0x24')](function(_0x2f39b9){logger[_0x85a7('0x15')](_0x85a7('0x25'),_0x2f39b9['message'],_0x554175);_0x99be5a(_0x48877e[_0x85a7('0x15')](0x1f4,_0x2f39b9[_0x85a7('0x17')]));});});};