9ac8933e4237b76e4b58c9fd1790beb034cbd4de
[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 _0xa8e6=['ShowServicenowAccount','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ServicenowAccount,\x20%s,\x20%s','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','GetServicenowAccount','options','where','limit','include','map','model','attributes','ServicenowAccount'];(function(_0x4231e3,_0x5d8fc3){var _0x522fa8=function(_0x524ee3){while(--_0x524ee3){_0x4231e3['push'](_0x4231e3['shift']());}};_0x522fa8(++_0x5d8fc3);}(_0xa8e6,0x15f));var _0x6a8e=function(_0x5da997,_0x3e05c2){_0x5da997=_0x5da997-0x0;var _0x1e6f53=_0xa8e6[_0x5da997];return _0x1e6f53;};'use strict';var _=require(_0x6a8e('0x0'));var util=require(_0x6a8e('0x1'));var moment=require(_0x6a8e('0x2'));var BPromise=require(_0x6a8e('0x3'));var rs=require(_0x6a8e('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6a8e('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x6a8e('0x6'))(_0x6a8e('0x7'));var config=require(_0x6a8e('0x8'));var jayson=require(_0x6a8e('0x9'));var client=jayson[_0x6a8e('0xa')][_0x6a8e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x420176,_0x34acba,_0x27d455){return new BPromise(function(_0x118d85,_0x1d1779){return client[_0x6a8e('0xc')](_0x420176,_0x27d455)[_0x6a8e('0xd')](function(_0x150bc1){logger[_0x6a8e('0xe')](_0x6a8e('0xf'),_0x34acba,'request\x20sent');logger[_0x6a8e('0x10')](_0x6a8e('0x11'),_0x34acba,'request\x20sent',JSON[_0x6a8e('0x12')](_0x150bc1));if(_0x150bc1[_0x6a8e('0x13')]){if(_0x150bc1[_0x6a8e('0x13')][_0x6a8e('0x14')]===0x1f4){logger[_0x6a8e('0x13')](_0x6a8e('0xf'),_0x34acba,_0x150bc1['error'][_0x6a8e('0x15')]);return _0x1d1779(_0x150bc1[_0x6a8e('0x13')][_0x6a8e('0x15')]);}logger[_0x6a8e('0x13')](_0x6a8e('0xf'),_0x34acba,_0x150bc1[_0x6a8e('0x13')][_0x6a8e('0x15')]);return _0x118d85(_0x150bc1['error']['message']);}else{logger[_0x6a8e('0xe')](_0x6a8e('0xf'),_0x34acba,_0x6a8e('0x16'));_0x118d85(_0x150bc1[_0x6a8e('0x17')]['message']);}})[_0x6a8e('0x18')](function(_0x3e3b6b){logger[_0x6a8e('0x13')](_0x6a8e('0xf'),_0x34acba,_0x3e3b6b);_0x1d1779(_0x3e3b6b);});});}exports[_0x6a8e('0x19')]=function(_0x4d605b){var _0x5856c2=this;return new Promise(function(_0x13d2cf,_0x581b34){return db['ServicenowAccount']['findAll']({'raw':_0x4d605b[_0x6a8e('0x1a')]?_0x4d605b[_0x6a8e('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x4d605b['options']?_0x4d605b[_0x6a8e('0x1a')][_0x6a8e('0x1b')]||null:null,'attributes':_0x4d605b['options']?_0x4d605b['options']['attributes']||null:null,'limit':_0x4d605b[_0x6a8e('0x1a')]?_0x4d605b[_0x6a8e('0x1a')][_0x6a8e('0x1c')]||null:null,'include':_0x4d605b[_0x6a8e('0x1a')]?_0x4d605b[_0x6a8e('0x1a')][_0x6a8e('0x1d')]?_[_0x6a8e('0x1e')](_0x4d605b['options'][_0x6a8e('0x1d')],function(_0x5ebb7d){return{'model':db[_0x5ebb7d[_0x6a8e('0x1f')]],'as':_0x5ebb7d['as'],'attributes':_0x5ebb7d[_0x6a8e('0x20')],'include':_0x5ebb7d[_0x6a8e('0x1d')]?_[_0x6a8e('0x1e')](_0x5ebb7d['include'],function(_0x162989){return{'model':db[_0x162989[_0x6a8e('0x1f')]],'as':_0x162989['as'],'attributes':_0x162989[_0x6a8e('0x20')],'include':_0x162989['include']?_['map'](_0x162989[_0x6a8e('0x1d')],function(_0x2338d5){return{'model':db[_0x2338d5[_0x6a8e('0x1f')]],'as':_0x2338d5['as'],'attributes':_0x2338d5['attributes']};}):[]};}):[]};}):[]:[]})[_0x6a8e('0xd')](function(_0x189249){logger[_0x6a8e('0xe')](_0x6a8e('0x19'),_0x4d605b);logger[_0x6a8e('0x10')](_0x6a8e('0x19'),_0x4d605b,JSON['stringify'](_0x189249));_0x13d2cf(_0x189249);})[_0x6a8e('0x18')](function(_0xf9f1d0){logger[_0x6a8e('0x13')](_0x6a8e('0x19'),_0xf9f1d0[_0x6a8e('0x15')],_0x4d605b);_0x581b34(_0x5856c2[_0x6a8e('0x13')](0x1f4,_0xf9f1d0[_0x6a8e('0x15')]));});});};exports['ShowServicenowAccount']=function(_0x44b252){var _0x1bfd02=this;return new Promise(function(_0x286a80,_0x411379){return db[_0x6a8e('0x21')]['find']({'raw':_0x44b252[_0x6a8e('0x1a')]?_0x44b252[_0x6a8e('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x44b252[_0x6a8e('0x1a')]?_0x44b252['options'][_0x6a8e('0x1b')]||null:null,'attributes':_0x44b252[_0x6a8e('0x1a')]?_0x44b252[_0x6a8e('0x1a')]['attributes']||null:null,'include':_0x44b252[_0x6a8e('0x1a')]?_0x44b252[_0x6a8e('0x1a')][_0x6a8e('0x1d')]?_[_0x6a8e('0x1e')](_0x44b252[_0x6a8e('0x1a')][_0x6a8e('0x1d')],function(_0x58bb02){return{'model':db[_0x58bb02['model']],'as':_0x58bb02['as'],'attributes':_0x58bb02[_0x6a8e('0x20')],'include':_0x58bb02[_0x6a8e('0x1d')]?_[_0x6a8e('0x1e')](_0x58bb02[_0x6a8e('0x1d')],function(_0x1afa4e){return{'model':db[_0x1afa4e['model']],'as':_0x1afa4e['as'],'attributes':_0x1afa4e[_0x6a8e('0x20')],'include':_0x1afa4e[_0x6a8e('0x1d')]?_[_0x6a8e('0x1e')](_0x1afa4e[_0x6a8e('0x1d')],function(_0x54809c){return{'model':db[_0x54809c[_0x6a8e('0x1f')]],'as':_0x54809c['as'],'attributes':_0x54809c[_0x6a8e('0x20')]};}):[]};}):[]};}):[]:[]})[_0x6a8e('0xd')](function(_0x222ee6){logger[_0x6a8e('0xe')]('ShowServicenowAccount',_0x44b252);logger[_0x6a8e('0x10')](_0x6a8e('0x22'),_0x44b252,JSON['stringify'](_0x222ee6));_0x286a80(_0x222ee6);})['catch'](function(_0x3a7162){logger[_0x6a8e('0x13')](_0x6a8e('0x22'),_0x3a7162[_0x6a8e('0x15')],_0x44b252);_0x411379(_0x1bfd02[_0x6a8e('0x13')](0x1f4,_0x3a7162['message']));});});};