d80fc28c15beb431fc26d77ece373aae55c096cf
[motion2.git] / server / api / pause / pause.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 _0x1de4=['then','info','Pause,\x20%s,\x20%s','debug','Pause,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','Pause','raw','options','where','attributes','include','map','model','ShowPause','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x1de4,0x94));var _0x41de=function(_0x498ccc,_0x1b7dd4){_0x498ccc=_0x498ccc-0x0;var _0xbaf470=_0x1de4[_0x498ccc];return _0xbaf470;};'use strict';var _=require(_0x41de('0x0'));var util=require(_0x41de('0x1'));var moment=require(_0x41de('0x2'));var BPromise=require(_0x41de('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x41de('0x4'));var db=require(_0x41de('0x5'))['db'];var utils=require(_0x41de('0x6'));var logger=require('../../config/logger')(_0x41de('0x7'));var config=require(_0x41de('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x41de('0x9')][_0x41de('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2f1078,_0x352d9b,_0x50f716){return new BPromise(function(_0x4c292c,_0x344b7b){return client[_0x41de('0xb')](_0x2f1078,_0x50f716)[_0x41de('0xc')](function(_0xb268da){logger[_0x41de('0xd')](_0x41de('0xe'),_0x352d9b,'request\x20sent');logger[_0x41de('0xf')](_0x41de('0x10'),_0x352d9b,_0x41de('0x11'),JSON[_0x41de('0x12')](_0xb268da));if(_0xb268da[_0x41de('0x13')]){if(_0xb268da[_0x41de('0x13')]['code']===0x1f4){logger[_0x41de('0x13')](_0x41de('0xe'),_0x352d9b,_0xb268da[_0x41de('0x13')]['message']);return _0x344b7b(_0xb268da[_0x41de('0x13')][_0x41de('0x14')]);}logger['error'](_0x41de('0xe'),_0x352d9b,_0xb268da[_0x41de('0x13')][_0x41de('0x14')]);return _0x4c292c(_0xb268da[_0x41de('0x13')][_0x41de('0x14')]);}else{logger[_0x41de('0xd')](_0x41de('0xe'),_0x352d9b,_0x41de('0x11'));_0x4c292c(_0xb268da[_0x41de('0x15')][_0x41de('0x14')]);}})[_0x41de('0x16')](function(_0x4a9591){logger[_0x41de('0x13')](_0x41de('0xe'),_0x352d9b,_0x4a9591);_0x344b7b(_0x4a9591);});});}exports['ShowPause']=function(_0x1bf5bb){var _0x2d2736=this;return new Promise(function(_0xd725cb,_0x3cc40d){return db[_0x41de('0x17')]['find']({'raw':_0x1bf5bb['options']?_0x1bf5bb['options'][_0x41de('0x18')]===undefined?!![]:![]:!![],'where':_0x1bf5bb[_0x41de('0x19')]?_0x1bf5bb[_0x41de('0x19')][_0x41de('0x1a')]||null:null,'attributes':_0x1bf5bb[_0x41de('0x19')]?_0x1bf5bb[_0x41de('0x19')][_0x41de('0x1b')]||null:null,'include':_0x1bf5bb[_0x41de('0x19')]?_0x1bf5bb[_0x41de('0x19')][_0x41de('0x1c')]?_[_0x41de('0x1d')](_0x1bf5bb['options'][_0x41de('0x1c')],function(_0x3b956e){return{'model':db[_0x3b956e[_0x41de('0x1e')]],'as':_0x3b956e['as'],'attributes':_0x3b956e[_0x41de('0x1b')],'include':_0x3b956e[_0x41de('0x1c')]?_['map'](_0x3b956e[_0x41de('0x1c')],function(_0x1d3d85){return{'model':db[_0x1d3d85[_0x41de('0x1e')]],'as':_0x1d3d85['as'],'attributes':_0x1d3d85[_0x41de('0x1b')],'include':_0x1d3d85[_0x41de('0x1c')]?_[_0x41de('0x1d')](_0x1d3d85[_0x41de('0x1c')],function(_0x54f2e5){return{'model':db[_0x54f2e5[_0x41de('0x1e')]],'as':_0x54f2e5['as'],'attributes':_0x54f2e5[_0x41de('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1acc02){logger[_0x41de('0xd')](_0x41de('0x1f'),_0x1bf5bb);logger[_0x41de('0xf')](_0x41de('0x1f'),_0x1bf5bb,JSON[_0x41de('0x12')](_0x1acc02));_0xd725cb(_0x1acc02);})['catch'](function(_0x193007){logger[_0x41de('0x13')](_0x41de('0x1f'),_0x193007['message'],_0x1bf5bb);_0x3cc40d(_0x2d2736[_0x41de('0x13')](0x1f4,_0x193007[_0x41de('0x14')]));});});};