Built motion from commit (unavailable).|2.3.6
[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 _0x7914=['util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','Pause,\x20%s,\x20%s','debug','Pause,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','ShowPause','find','raw','options','where','attributes','include','model','map','lodash'];(function(_0x135ebc,_0x123430){var _0x210162=function(_0x4c7459){while(--_0x4c7459){_0x135ebc['push'](_0x135ebc['shift']());}};_0x210162(++_0x123430);}(_0x7914,0x107));var _0x4791=function(_0x125274,_0x2c78ef){_0x125274=_0x125274-0x0;var _0x5ab3d2=_0x7914[_0x125274];return _0x5ab3d2;};'use strict';var _=require(_0x4791('0x0'));var util=require(_0x4791('0x1'));var moment=require('moment');var BPromise=require(_0x4791('0x2'));var rs=require(_0x4791('0x3'));var fs=require('fs');var Redis=require(_0x4791('0x4'));var db=require(_0x4791('0x5'))['db'];var utils=require(_0x4791('0x6'));var logger=require(_0x4791('0x7'))(_0x4791('0x8'));var config=require(_0x4791('0x9'));var jayson=require(_0x4791('0xa'));var client=jayson[_0x4791('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x306863,_0x559fc1,_0x1dc98f){return new BPromise(function(_0x22163f,_0xa154fc){return client[_0x4791('0xc')](_0x306863,_0x1dc98f)[_0x4791('0xd')](function(_0x153de4){logger[_0x4791('0xe')](_0x4791('0xf'),_0x559fc1,'request\x20sent');logger[_0x4791('0x10')](_0x4791('0x11'),_0x559fc1,_0x4791('0x12'),JSON[_0x4791('0x13')](_0x153de4));if(_0x153de4[_0x4791('0x14')]){if(_0x153de4[_0x4791('0x14')]['code']===0x1f4){logger[_0x4791('0x14')](_0x4791('0xf'),_0x559fc1,_0x153de4['error'][_0x4791('0x15')]);return _0xa154fc(_0x153de4[_0x4791('0x14')][_0x4791('0x15')]);}logger[_0x4791('0x14')](_0x4791('0xf'),_0x559fc1,_0x153de4[_0x4791('0x14')][_0x4791('0x15')]);return _0x22163f(_0x153de4['error'][_0x4791('0x15')]);}else{logger[_0x4791('0xe')]('Pause,\x20%s,\x20%s',_0x559fc1,_0x4791('0x12'));_0x22163f(_0x153de4[_0x4791('0x16')][_0x4791('0x15')]);}})[_0x4791('0x17')](function(_0xab1f15){logger['error']('Pause,\x20%s,\x20%s',_0x559fc1,_0xab1f15);_0xa154fc(_0xab1f15);});});}exports[_0x4791('0x18')]=function(_0x41d373){var _0xce74a5=this;return new Promise(function(_0x322244,_0x333258){return db['Pause'][_0x4791('0x19')]({'raw':_0x41d373['options']?_0x41d373['options'][_0x4791('0x1a')]===undefined?!![]:![]:!![],'where':_0x41d373[_0x4791('0x1b')]?_0x41d373[_0x4791('0x1b')][_0x4791('0x1c')]||null:null,'attributes':_0x41d373[_0x4791('0x1b')]?_0x41d373['options'][_0x4791('0x1d')]||null:null,'include':_0x41d373['options']?_0x41d373[_0x4791('0x1b')][_0x4791('0x1e')]?_['map'](_0x41d373[_0x4791('0x1b')][_0x4791('0x1e')],function(_0xb78cd4){return{'model':db[_0xb78cd4[_0x4791('0x1f')]],'as':_0xb78cd4['as'],'attributes':_0xb78cd4['attributes'],'include':_0xb78cd4[_0x4791('0x1e')]?_[_0x4791('0x20')](_0xb78cd4[_0x4791('0x1e')],function(_0x564a43){return{'model':db[_0x564a43[_0x4791('0x1f')]],'as':_0x564a43['as'],'attributes':_0x564a43[_0x4791('0x1d')],'include':_0x564a43['include']?_[_0x4791('0x20')](_0x564a43[_0x4791('0x1e')],function(_0x16616d){return{'model':db[_0x16616d[_0x4791('0x1f')]],'as':_0x16616d['as'],'attributes':_0x16616d[_0x4791('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x4791('0xd')](function(_0x21edcd){logger[_0x4791('0xe')](_0x4791('0x18'),_0x41d373);logger[_0x4791('0x10')](_0x4791('0x18'),_0x41d373,JSON[_0x4791('0x13')](_0x21edcd));_0x322244(_0x21edcd);})[_0x4791('0x17')](function(_0x55117f){logger[_0x4791('0x14')](_0x4791('0x18'),_0x55117f[_0x4791('0x15')],_0x41d373);_0x333258(_0xce74a5[_0x4791('0x14')](0x1f4,_0x55117f[_0x4791('0x15')]));});});};