Built motion from commit 598073ad.|2.5.44
[motion2.git] / server / api / intServicenowAccount / intServicenowAccount.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 _0xb1c6=['ShowServicenowAccount','lodash','util','moment','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','then','info','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','ServicenowAccount,\x20%s,\x20%s','message','catch','GetServicenowAccount','options','where','limit','include','map','attributes','model','ServicenowAccount','raw'];(function(_0x406b98,_0x3dea6d){var _0x10545f=function(_0xecba84){while(--_0xecba84){_0x406b98['push'](_0x406b98['shift']());}};_0x10545f(++_0x3dea6d);}(_0xb1c6,0x14b));var _0x6b1c=function(_0x334524,_0x1fca82){_0x334524=_0x334524-0x0;var _0x870ae9=_0xb1c6[_0x334524];return _0x870ae9;};'use strict';var _=require(_0x6b1c('0x0'));var util=require(_0x6b1c('0x1'));var moment=require(_0x6b1c('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6b1c('0x3'));var db=require(_0x6b1c('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x6b1c('0x5'))(_0x6b1c('0x6'));var config=require('../../config/environment');var jayson=require(_0x6b1c('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1bfb46,_0x331a8b,_0x15de89){return new BPromise(function(_0x25097a,_0x5d5583){return client['request'](_0x1bfb46,_0x15de89)[_0x6b1c('0x8')](function(_0x9b271e){logger[_0x6b1c('0x9')]('ServicenowAccount,\x20%s,\x20%s',_0x331a8b,_0x6b1c('0xa'));logger[_0x6b1c('0xb')](_0x6b1c('0xc'),_0x331a8b,_0x6b1c('0xa'),JSON[_0x6b1c('0xd')](_0x9b271e));if(_0x9b271e[_0x6b1c('0xe')]){if(_0x9b271e['error'][_0x6b1c('0xf')]===0x1f4){logger[_0x6b1c('0xe')](_0x6b1c('0x10'),_0x331a8b,_0x9b271e[_0x6b1c('0xe')][_0x6b1c('0x11')]);return _0x5d5583(_0x9b271e[_0x6b1c('0xe')][_0x6b1c('0x11')]);}logger['error']('ServicenowAccount,\x20%s,\x20%s',_0x331a8b,_0x9b271e[_0x6b1c('0xe')][_0x6b1c('0x11')]);return _0x25097a(_0x9b271e[_0x6b1c('0xe')][_0x6b1c('0x11')]);}else{logger[_0x6b1c('0x9')]('ServicenowAccount,\x20%s,\x20%s',_0x331a8b,_0x6b1c('0xa'));_0x25097a(_0x9b271e['result'][_0x6b1c('0x11')]);}})[_0x6b1c('0x12')](function(_0xfcad06){logger[_0x6b1c('0xe')](_0x6b1c('0x10'),_0x331a8b,_0xfcad06);_0x5d5583(_0xfcad06);});});}exports[_0x6b1c('0x13')]=function(_0x5b5651){var _0x1136a3=this;return new Promise(function(_0x47c149,_0x614cba){return db['ServicenowAccount']['findAll']({'raw':_0x5b5651[_0x6b1c('0x14')]?_0x5b5651[_0x6b1c('0x14')]['raw']===undefined?!![]:![]:!![],'where':_0x5b5651[_0x6b1c('0x14')]?_0x5b5651[_0x6b1c('0x14')][_0x6b1c('0x15')]||null:null,'attributes':_0x5b5651[_0x6b1c('0x14')]?_0x5b5651[_0x6b1c('0x14')]['attributes']||null:null,'limit':_0x5b5651['options']?_0x5b5651[_0x6b1c('0x14')][_0x6b1c('0x16')]||null:null,'include':_0x5b5651[_0x6b1c('0x14')]?_0x5b5651[_0x6b1c('0x14')][_0x6b1c('0x17')]?_[_0x6b1c('0x18')](_0x5b5651[_0x6b1c('0x14')][_0x6b1c('0x17')],function(_0x2fb4e0){return{'model':db[_0x2fb4e0['model']],'as':_0x2fb4e0['as'],'attributes':_0x2fb4e0[_0x6b1c('0x19')],'include':_0x2fb4e0[_0x6b1c('0x17')]?_[_0x6b1c('0x18')](_0x2fb4e0['include'],function(_0x3e62e7){return{'model':db[_0x3e62e7['model']],'as':_0x3e62e7['as'],'attributes':_0x3e62e7[_0x6b1c('0x19')],'include':_0x3e62e7['include']?_[_0x6b1c('0x18')](_0x3e62e7[_0x6b1c('0x17')],function(_0xbce9b5){return{'model':db[_0xbce9b5[_0x6b1c('0x1a')]],'as':_0xbce9b5['as'],'attributes':_0xbce9b5[_0x6b1c('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3f5f31){logger[_0x6b1c('0x9')]('GetServicenowAccount',_0x5b5651);logger[_0x6b1c('0xb')](_0x6b1c('0x13'),_0x5b5651,JSON[_0x6b1c('0xd')](_0x3f5f31));_0x47c149(_0x3f5f31);})['catch'](function(_0x23cad9){logger[_0x6b1c('0xe')]('GetServicenowAccount',_0x23cad9[_0x6b1c('0x11')],_0x5b5651);_0x614cba(_0x1136a3[_0x6b1c('0xe')](0x1f4,_0x23cad9[_0x6b1c('0x11')]));});});};exports['ShowServicenowAccount']=function(_0x4363d1){var _0x551ed2=this;return new Promise(function(_0x2637f5,_0x5ea8f6){return db[_0x6b1c('0x1b')]['find']({'raw':_0x4363d1['options']?_0x4363d1[_0x6b1c('0x14')][_0x6b1c('0x1c')]===undefined?!![]:![]:!![],'where':_0x4363d1[_0x6b1c('0x14')]?_0x4363d1[_0x6b1c('0x14')]['where']||null:null,'attributes':_0x4363d1[_0x6b1c('0x14')]?_0x4363d1[_0x6b1c('0x14')][_0x6b1c('0x19')]||null:null,'include':_0x4363d1['options']?_0x4363d1['options'][_0x6b1c('0x17')]?_[_0x6b1c('0x18')](_0x4363d1[_0x6b1c('0x14')]['include'],function(_0x227294){return{'model':db[_0x227294[_0x6b1c('0x1a')]],'as':_0x227294['as'],'attributes':_0x227294[_0x6b1c('0x19')],'include':_0x227294[_0x6b1c('0x17')]?_[_0x6b1c('0x18')](_0x227294[_0x6b1c('0x17')],function(_0x4d9c45){return{'model':db[_0x4d9c45[_0x6b1c('0x1a')]],'as':_0x4d9c45['as'],'attributes':_0x4d9c45[_0x6b1c('0x19')],'include':_0x4d9c45[_0x6b1c('0x17')]?_[_0x6b1c('0x18')](_0x4d9c45[_0x6b1c('0x17')],function(_0x149508){return{'model':db[_0x149508[_0x6b1c('0x1a')]],'as':_0x149508['as'],'attributes':_0x149508['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x4efbd4){logger[_0x6b1c('0x9')](_0x6b1c('0x1d'),_0x4363d1);logger['debug'](_0x6b1c('0x1d'),_0x4363d1,JSON[_0x6b1c('0xd')](_0x4efbd4));_0x2637f5(_0x4efbd4);})[_0x6b1c('0x12')](function(_0x4258c0){logger[_0x6b1c('0xe')](_0x6b1c('0x1d'),_0x4258c0[_0x6b1c('0x11')],_0x4363d1);_0x5ea8f6(_0x551ed2[_0x6b1c('0xe')](0x1f4,_0x4258c0[_0x6b1c('0x11')]));});});};