Built motion from commit (unavailable).|2.3.1
[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 _0x2308=['include','model','debug','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','then','request\x20sent','Pause,\x20%s,\x20%s,\x20%s','stringify','error','Pause,\x20%s,\x20%s','message','info','result','ShowPause','Pause','options','where','attributes','map'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x2308,0x108));var _0x8230=function(_0x13b02f,_0x462a53){_0x13b02f=_0x13b02f-0x0;var _0x12e9a6=_0x2308[_0x13b02f];return _0x12e9a6;};'use strict';var _=require(_0x8230('0x0'));var util=require('util');var moment=require(_0x8230('0x1'));var BPromise=require(_0x8230('0x2'));var rs=require(_0x8230('0x3'));var fs=require('fs');var Redis=require(_0x8230('0x4'));var db=require(_0x8230('0x5'))['db'];var utils=require(_0x8230('0x6'));var logger=require(_0x8230('0x7'))('rpc');var config=require(_0x8230('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x8230('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x19990d,_0x26ca48,_0x1938b6){return new BPromise(function(_0x2344b0,_0x1b89be){return client[_0x8230('0xa')](_0x19990d,_0x1938b6)[_0x8230('0xb')](function(_0x3885f3){logger['info']('Pause,\x20%s,\x20%s',_0x26ca48,_0x8230('0xc'));logger['debug'](_0x8230('0xd'),_0x26ca48,_0x8230('0xc'),JSON[_0x8230('0xe')](_0x3885f3));if(_0x3885f3[_0x8230('0xf')]){if(_0x3885f3[_0x8230('0xf')]['code']===0x1f4){logger[_0x8230('0xf')](_0x8230('0x10'),_0x26ca48,_0x3885f3[_0x8230('0xf')][_0x8230('0x11')]);return _0x1b89be(_0x3885f3[_0x8230('0xf')][_0x8230('0x11')]);}logger['error']('Pause,\x20%s,\x20%s',_0x26ca48,_0x3885f3[_0x8230('0xf')][_0x8230('0x11')]);return _0x2344b0(_0x3885f3[_0x8230('0xf')][_0x8230('0x11')]);}else{logger[_0x8230('0x12')](_0x8230('0x10'),_0x26ca48,_0x8230('0xc'));_0x2344b0(_0x3885f3[_0x8230('0x13')]['message']);}})['catch'](function(_0x317c66){logger[_0x8230('0xf')](_0x8230('0x10'),_0x26ca48,_0x317c66);_0x1b89be(_0x317c66);});});}exports[_0x8230('0x14')]=function(_0x293c54){var _0x2310b4=this;return new Promise(function(_0x33099c,_0x3da24e){return db[_0x8230('0x15')]['find']({'raw':_0x293c54['options']?_0x293c54[_0x8230('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x293c54[_0x8230('0x16')]?_0x293c54[_0x8230('0x16')][_0x8230('0x17')]||null:null,'attributes':_0x293c54[_0x8230('0x16')]?_0x293c54[_0x8230('0x16')][_0x8230('0x18')]||null:null,'include':_0x293c54['options']?_0x293c54[_0x8230('0x16')]['include']?_[_0x8230('0x19')](_0x293c54[_0x8230('0x16')][_0x8230('0x1a')],function(_0x338e94){return{'model':db[_0x338e94[_0x8230('0x1b')]],'as':_0x338e94['as'],'attributes':_0x338e94[_0x8230('0x18')],'include':_0x338e94[_0x8230('0x1a')]?_[_0x8230('0x19')](_0x338e94[_0x8230('0x1a')],function(_0x51604c){return{'model':db[_0x51604c[_0x8230('0x1b')]],'as':_0x51604c['as'],'attributes':_0x51604c[_0x8230('0x18')],'include':_0x51604c[_0x8230('0x1a')]?_['map'](_0x51604c[_0x8230('0x1a')],function(_0xae7f97){return{'model':db[_0xae7f97[_0x8230('0x1b')]],'as':_0xae7f97['as'],'attributes':_0xae7f97['attributes']};}):[]};}):[]};}):[]:[]})[_0x8230('0xb')](function(_0x1d3fb5){logger[_0x8230('0x12')](_0x8230('0x14'),_0x293c54);logger[_0x8230('0x1c')](_0x8230('0x14'),_0x293c54,JSON[_0x8230('0xe')](_0x1d3fb5));_0x33099c(_0x1d3fb5);})['catch'](function(_0x5d5014){logger[_0x8230('0xf')]('ShowPause',_0x5d5014['message'],_0x293c54);_0x3da24e(_0x2310b4[_0x8230('0xf')](0x1f4,_0x5d5014['message']));});});};