Built motion from commit (unavailable).|2.5.17
[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 _0x5beb=['util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then','info','Pause,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','catch','ShowPause','find','options','where','include','map','model','attributes'];(function(_0x46aff0,_0x122890){var _0x9d78cf=function(_0x3f14cb){while(--_0x3f14cb){_0x46aff0['push'](_0x46aff0['shift']());}};_0x9d78cf(++_0x122890);}(_0x5beb,0x15c));var _0xb5be=function(_0x330b6f,_0x5e5b31){_0x330b6f=_0x330b6f-0x0;var _0x3301be=_0x5beb[_0x330b6f];return _0x3301be;};'use strict';var _=require('lodash');var util=require(_0xb5be('0x0'));var moment=require('moment');var BPromise=require(_0xb5be('0x1'));var rs=require(_0xb5be('0x2'));var fs=require('fs');var Redis=require(_0xb5be('0x3'));var db=require(_0xb5be('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xb5be('0x5'))(_0xb5be('0x6'));var config=require('../../config/environment');var jayson=require(_0xb5be('0x7'));var client=jayson[_0xb5be('0x8')][_0xb5be('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x38d12c,_0x30bb6b,_0x1c151a){return new BPromise(function(_0x13c8b9,_0x4a2d8c){return client[_0xb5be('0xa')](_0x38d12c,_0x1c151a)[_0xb5be('0xb')](function(_0x53a49d){logger[_0xb5be('0xc')](_0xb5be('0xd'),_0x30bb6b,'request\x20sent');logger[_0xb5be('0xe')]('Pause,\x20%s,\x20%s,\x20%s',_0x30bb6b,_0xb5be('0xf'),JSON[_0xb5be('0x10')](_0x53a49d));if(_0x53a49d[_0xb5be('0x11')]){if(_0x53a49d['error'][_0xb5be('0x12')]===0x1f4){logger[_0xb5be('0x11')]('Pause,\x20%s,\x20%s',_0x30bb6b,_0x53a49d[_0xb5be('0x11')][_0xb5be('0x13')]);return _0x4a2d8c(_0x53a49d[_0xb5be('0x11')][_0xb5be('0x13')]);}logger[_0xb5be('0x11')](_0xb5be('0xd'),_0x30bb6b,_0x53a49d[_0xb5be('0x11')][_0xb5be('0x13')]);return _0x13c8b9(_0x53a49d['error'][_0xb5be('0x13')]);}else{logger[_0xb5be('0xc')](_0xb5be('0xd'),_0x30bb6b,'request\x20sent');_0x13c8b9(_0x53a49d['result'][_0xb5be('0x13')]);}})[_0xb5be('0x14')](function(_0xfdb45e){logger['error'](_0xb5be('0xd'),_0x30bb6b,_0xfdb45e);_0x4a2d8c(_0xfdb45e);});});}exports[_0xb5be('0x15')]=function(_0xff25c4){var _0x11a020=this;return new Promise(function(_0x57f6ff,_0x959cf5){return db['Pause'][_0xb5be('0x16')]({'raw':_0xff25c4[_0xb5be('0x17')]?_0xff25c4[_0xb5be('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0xff25c4[_0xb5be('0x17')]?_0xff25c4['options'][_0xb5be('0x18')]||null:null,'attributes':_0xff25c4[_0xb5be('0x17')]?_0xff25c4[_0xb5be('0x17')]['attributes']||null:null,'include':_0xff25c4[_0xb5be('0x17')]?_0xff25c4[_0xb5be('0x17')][_0xb5be('0x19')]?_[_0xb5be('0x1a')](_0xff25c4['options'][_0xb5be('0x19')],function(_0x4d087b){return{'model':db[_0x4d087b[_0xb5be('0x1b')]],'as':_0x4d087b['as'],'attributes':_0x4d087b[_0xb5be('0x1c')],'include':_0x4d087b[_0xb5be('0x19')]?_[_0xb5be('0x1a')](_0x4d087b[_0xb5be('0x19')],function(_0x214c01){return{'model':db[_0x214c01[_0xb5be('0x1b')]],'as':_0x214c01['as'],'attributes':_0x214c01['attributes'],'include':_0x214c01[_0xb5be('0x19')]?_[_0xb5be('0x1a')](_0x214c01[_0xb5be('0x19')],function(_0xffd30d){return{'model':db[_0xffd30d[_0xb5be('0x1b')]],'as':_0xffd30d['as'],'attributes':_0xffd30d[_0xb5be('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xb5be('0xb')](function(_0x4353a4){logger[_0xb5be('0xc')]('ShowPause',_0xff25c4);logger[_0xb5be('0xe')]('ShowPause',_0xff25c4,JSON[_0xb5be('0x10')](_0x4353a4));_0x57f6ff(_0x4353a4);})[_0xb5be('0x14')](function(_0x56293a){logger[_0xb5be('0x11')]('ShowPause',_0x56293a[_0xb5be('0x13')],_0xff25c4);_0x959cf5(_0x11a020['error'](0x1f4,_0x56293a[_0xb5be('0x13')]));});});};