Built motion from commit (unavailable).|2.4.3
[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 _0x34f8=['http','request','then','Pause,\x20%s,\x20%s','request\x20sent','debug','Pause,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','ShowPause','Pause','options','raw','where','attributes','include','map','model','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client'];(function(_0x1394a2,_0x533264){var _0x31dcd1=function(_0x58c693){while(--_0x58c693){_0x1394a2['push'](_0x1394a2['shift']());}};_0x31dcd1(++_0x533264);}(_0x34f8,0xbc));var _0x834f=function(_0x4a2183,_0x53e74d){_0x4a2183=_0x4a2183-0x0;var _0xc7c01d=_0x34f8[_0x4a2183];return _0xc7c01d;};'use strict';var _=require(_0x834f('0x0'));var util=require(_0x834f('0x1'));var moment=require('moment');var BPromise=require(_0x834f('0x2'));var rs=require(_0x834f('0x3'));var fs=require('fs');var Redis=require(_0x834f('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x834f('0x5'));var logger=require(_0x834f('0x6'))(_0x834f('0x7'));var config=require(_0x834f('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x834f('0x9')][_0x834f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x341f3d,_0x22fb2,_0x559443){return new BPromise(function(_0x2ea0d6,_0x4f5627){return client[_0x834f('0xb')](_0x341f3d,_0x559443)[_0x834f('0xc')](function(_0x48b723){logger['info'](_0x834f('0xd'),_0x22fb2,_0x834f('0xe'));logger[_0x834f('0xf')](_0x834f('0x10'),_0x22fb2,_0x834f('0xe'),JSON[_0x834f('0x11')](_0x48b723));if(_0x48b723[_0x834f('0x12')]){if(_0x48b723['error'][_0x834f('0x13')]===0x1f4){logger[_0x834f('0x12')](_0x834f('0xd'),_0x22fb2,_0x48b723['error'][_0x834f('0x14')]);return _0x4f5627(_0x48b723[_0x834f('0x12')][_0x834f('0x14')]);}logger[_0x834f('0x12')]('Pause,\x20%s,\x20%s',_0x22fb2,_0x48b723['error'][_0x834f('0x14')]);return _0x2ea0d6(_0x48b723['error'][_0x834f('0x14')]);}else{logger[_0x834f('0x15')](_0x834f('0xd'),_0x22fb2,_0x834f('0xe'));_0x2ea0d6(_0x48b723[_0x834f('0x16')][_0x834f('0x14')]);}})[_0x834f('0x17')](function(_0x2c5768){logger['error'](_0x834f('0xd'),_0x22fb2,_0x2c5768);_0x4f5627(_0x2c5768);});});}exports[_0x834f('0x18')]=function(_0x4eb572){var _0x3e8ff6=this;return new Promise(function(_0x2722e6,_0x7788a1){return db[_0x834f('0x19')]['find']({'raw':_0x4eb572[_0x834f('0x1a')]?_0x4eb572[_0x834f('0x1a')][_0x834f('0x1b')]===undefined?!![]:![]:!![],'where':_0x4eb572[_0x834f('0x1a')]?_0x4eb572[_0x834f('0x1a')][_0x834f('0x1c')]||null:null,'attributes':_0x4eb572['options']?_0x4eb572[_0x834f('0x1a')][_0x834f('0x1d')]||null:null,'include':_0x4eb572[_0x834f('0x1a')]?_0x4eb572[_0x834f('0x1a')][_0x834f('0x1e')]?_[_0x834f('0x1f')](_0x4eb572['options'][_0x834f('0x1e')],function(_0x2b7581){return{'model':db[_0x2b7581[_0x834f('0x20')]],'as':_0x2b7581['as'],'attributes':_0x2b7581[_0x834f('0x1d')],'include':_0x2b7581[_0x834f('0x1e')]?_[_0x834f('0x1f')](_0x2b7581[_0x834f('0x1e')],function(_0x15e2f8){return{'model':db[_0x15e2f8['model']],'as':_0x15e2f8['as'],'attributes':_0x15e2f8['attributes'],'include':_0x15e2f8['include']?_[_0x834f('0x1f')](_0x15e2f8[_0x834f('0x1e')],function(_0x15da76){return{'model':db[_0x15da76[_0x834f('0x20')]],'as':_0x15da76['as'],'attributes':_0x15da76[_0x834f('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x834f('0xc')](function(_0xc3d112){logger[_0x834f('0x15')](_0x834f('0x18'),_0x4eb572);logger[_0x834f('0xf')]('ShowPause',_0x4eb572,JSON[_0x834f('0x11')](_0xc3d112));_0x2722e6(_0xc3d112);})['catch'](function(_0x4dabaa){logger[_0x834f('0x12')](_0x834f('0x18'),_0x4dabaa[_0x834f('0x14')],_0x4eb572);_0x7788a1(_0x3e8ff6['error'](0x1f4,_0x4dabaa['message']));});});};