Built motion from commit (unavailable).|2.5.4
[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 _0x36f4=['../../config/environment','jayson/promise','request','then','info','Pause,\x20%s,\x20%s','request\x20sent','debug','Pause,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','ShowPause','Pause','options','raw','where','attributes','include','map','model','stringify','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc'];(function(_0x198643,_0x499312){var _0x1a6aa6=function(_0x486858){while(--_0x486858){_0x198643['push'](_0x198643['shift']());}};_0x1a6aa6(++_0x499312);}(_0x36f4,0xb3));var _0x436f=function(_0x41b8b2,_0x3c819e){_0x41b8b2=_0x41b8b2-0x0;var _0x16a168=_0x36f4[_0x41b8b2];return _0x16a168;};'use strict';var _=require('lodash');var util=require(_0x436f('0x0'));var moment=require(_0x436f('0x1'));var BPromise=require(_0x436f('0x2'));var rs=require(_0x436f('0x3'));var fs=require('fs');var Redis=require(_0x436f('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x436f('0x5'))(_0x436f('0x6'));var config=require(_0x436f('0x7'));var jayson=require(_0x436f('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1d27a2,_0x58fae8,_0x374425){return new BPromise(function(_0x5cd749,_0xd56d48){return client[_0x436f('0x9')](_0x1d27a2,_0x374425)[_0x436f('0xa')](function(_0x3dab1c){logger[_0x436f('0xb')](_0x436f('0xc'),_0x58fae8,_0x436f('0xd'));logger[_0x436f('0xe')](_0x436f('0xf'),_0x58fae8,_0x436f('0xd'),JSON['stringify'](_0x3dab1c));if(_0x3dab1c[_0x436f('0x10')]){if(_0x3dab1c[_0x436f('0x10')][_0x436f('0x11')]===0x1f4){logger[_0x436f('0x10')](_0x436f('0xc'),_0x58fae8,_0x3dab1c[_0x436f('0x10')][_0x436f('0x12')]);return _0xd56d48(_0x3dab1c[_0x436f('0x10')][_0x436f('0x12')]);}logger[_0x436f('0x10')]('Pause,\x20%s,\x20%s',_0x58fae8,_0x3dab1c['error'][_0x436f('0x12')]);return _0x5cd749(_0x3dab1c[_0x436f('0x10')][_0x436f('0x12')]);}else{logger[_0x436f('0xb')]('Pause,\x20%s,\x20%s',_0x58fae8,'request\x20sent');_0x5cd749(_0x3dab1c[_0x436f('0x13')]['message']);}})[_0x436f('0x14')](function(_0x5b55b5){logger[_0x436f('0x10')](_0x436f('0xc'),_0x58fae8,_0x5b55b5);_0xd56d48(_0x5b55b5);});});}exports[_0x436f('0x15')]=function(_0x3185a7){var _0xe426bd=this;return new Promise(function(_0x29399c,_0x1f7460){return db[_0x436f('0x16')]['find']({'raw':_0x3185a7[_0x436f('0x17')]?_0x3185a7[_0x436f('0x17')][_0x436f('0x18')]===undefined?!![]:![]:!![],'where':_0x3185a7[_0x436f('0x17')]?_0x3185a7[_0x436f('0x17')][_0x436f('0x19')]||null:null,'attributes':_0x3185a7[_0x436f('0x17')]?_0x3185a7['options'][_0x436f('0x1a')]||null:null,'include':_0x3185a7[_0x436f('0x17')]?_0x3185a7[_0x436f('0x17')][_0x436f('0x1b')]?_[_0x436f('0x1c')](_0x3185a7[_0x436f('0x17')][_0x436f('0x1b')],function(_0x14fa91){return{'model':db[_0x14fa91['model']],'as':_0x14fa91['as'],'attributes':_0x14fa91[_0x436f('0x1a')],'include':_0x14fa91['include']?_[_0x436f('0x1c')](_0x14fa91[_0x436f('0x1b')],function(_0x1ccaba){return{'model':db[_0x1ccaba[_0x436f('0x1d')]],'as':_0x1ccaba['as'],'attributes':_0x1ccaba[_0x436f('0x1a')],'include':_0x1ccaba[_0x436f('0x1b')]?_[_0x436f('0x1c')](_0x1ccaba[_0x436f('0x1b')],function(_0x118d3a){return{'model':db[_0x118d3a[_0x436f('0x1d')]],'as':_0x118d3a['as'],'attributes':_0x118d3a[_0x436f('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x14710a){logger['info'](_0x436f('0x15'),_0x3185a7);logger[_0x436f('0xe')](_0x436f('0x15'),_0x3185a7,JSON[_0x436f('0x1e')](_0x14710a));_0x29399c(_0x14710a);})[_0x436f('0x14')](function(_0x11cc89){logger[_0x436f('0x10')]('ShowPause',_0x11cc89['message'],_0x3185a7);_0x1f7460(_0xe426bd[_0x436f('0x10')](0x1f4,_0x11cc89[_0x436f('0x12')]));});});};