Built motion from commit (unavailable).|2.4.18
[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 _0xa0e5=['error','code','message','result','catch','Pause','find','options','raw','where','attributes','include','map','model','ShowPause','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','info','Pause,\x20%s,\x20%s','request\x20sent','debug','Pause,\x20%s,\x20%s,\x20%s','stringify'];(function(_0xb6e2ea,_0x3b26e9){var _0x2a57bb=function(_0x2a1ac9){while(--_0x2a1ac9){_0xb6e2ea['push'](_0xb6e2ea['shift']());}};_0x2a57bb(++_0x3b26e9);}(_0xa0e5,0x6f));var _0x5a0e=function(_0x54668e,_0x45d939){_0x54668e=_0x54668e-0x0;var _0x30494e=_0xa0e5[_0x54668e];return _0x30494e;};'use strict';var _=require(_0x5a0e('0x0'));var util=require('util');var moment=require(_0x5a0e('0x1'));var BPromise=require(_0x5a0e('0x2'));var rs=require(_0x5a0e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5a0e('0x4'))['db'];var utils=require(_0x5a0e('0x5'));var logger=require('../../config/logger')(_0x5a0e('0x6'));var config=require(_0x5a0e('0x7'));var jayson=require(_0x5a0e('0x8'));var client=jayson[_0x5a0e('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x45b189,_0x1e4b34,_0x2ba5a0){return new BPromise(function(_0x383df6,_0xe4662a){return client[_0x5a0e('0xa')](_0x45b189,_0x2ba5a0)['then'](function(_0x3b6baa){logger[_0x5a0e('0xb')](_0x5a0e('0xc'),_0x1e4b34,_0x5a0e('0xd'));logger[_0x5a0e('0xe')](_0x5a0e('0xf'),_0x1e4b34,_0x5a0e('0xd'),JSON[_0x5a0e('0x10')](_0x3b6baa));if(_0x3b6baa[_0x5a0e('0x11')]){if(_0x3b6baa[_0x5a0e('0x11')][_0x5a0e('0x12')]===0x1f4){logger['error']('Pause,\x20%s,\x20%s',_0x1e4b34,_0x3b6baa[_0x5a0e('0x11')][_0x5a0e('0x13')]);return _0xe4662a(_0x3b6baa[_0x5a0e('0x11')]['message']);}logger['error'](_0x5a0e('0xc'),_0x1e4b34,_0x3b6baa[_0x5a0e('0x11')]['message']);return _0x383df6(_0x3b6baa['error'][_0x5a0e('0x13')]);}else{logger[_0x5a0e('0xb')](_0x5a0e('0xc'),_0x1e4b34,'request\x20sent');_0x383df6(_0x3b6baa[_0x5a0e('0x14')][_0x5a0e('0x13')]);}})[_0x5a0e('0x15')](function(_0x42e069){logger[_0x5a0e('0x11')](_0x5a0e('0xc'),_0x1e4b34,_0x42e069);_0xe4662a(_0x42e069);});});}exports['ShowPause']=function(_0x8a44b6){var _0x472377=this;return new Promise(function(_0xcdc4a9,_0x246a70){return db[_0x5a0e('0x16')][_0x5a0e('0x17')]({'raw':_0x8a44b6[_0x5a0e('0x18')]?_0x8a44b6[_0x5a0e('0x18')][_0x5a0e('0x19')]===undefined?!![]:![]:!![],'where':_0x8a44b6['options']?_0x8a44b6[_0x5a0e('0x18')][_0x5a0e('0x1a')]||null:null,'attributes':_0x8a44b6['options']?_0x8a44b6[_0x5a0e('0x18')][_0x5a0e('0x1b')]||null:null,'include':_0x8a44b6[_0x5a0e('0x18')]?_0x8a44b6[_0x5a0e('0x18')][_0x5a0e('0x1c')]?_[_0x5a0e('0x1d')](_0x8a44b6[_0x5a0e('0x18')][_0x5a0e('0x1c')],function(_0x37415c){return{'model':db[_0x37415c[_0x5a0e('0x1e')]],'as':_0x37415c['as'],'attributes':_0x37415c[_0x5a0e('0x1b')],'include':_0x37415c['include']?_[_0x5a0e('0x1d')](_0x37415c[_0x5a0e('0x1c')],function(_0x1396b1){return{'model':db[_0x1396b1[_0x5a0e('0x1e')]],'as':_0x1396b1['as'],'attributes':_0x1396b1[_0x5a0e('0x1b')],'include':_0x1396b1[_0x5a0e('0x1c')]?_[_0x5a0e('0x1d')](_0x1396b1['include'],function(_0x381dda){return{'model':db[_0x381dda[_0x5a0e('0x1e')]],'as':_0x381dda['as'],'attributes':_0x381dda['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x1e5703){logger[_0x5a0e('0xb')](_0x5a0e('0x1f'),_0x8a44b6);logger['debug'](_0x5a0e('0x1f'),_0x8a44b6,JSON[_0x5a0e('0x10')](_0x1e5703));_0xcdc4a9(_0x1e5703);})['catch'](function(_0x5ca1e0){logger['error'](_0x5a0e('0x1f'),_0x5ca1e0['message'],_0x8a44b6);_0x246a70(_0x472377[_0x5a0e('0x11')](0x1f4,_0x5ca1e0['message']));});});};