Built motion from commit (unavailable).|2.2.0
[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 _0x40cd=['../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Pause,\x20%s,\x20%s','request\x20sent','Pause,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ShowPause','Pause','find','options','raw','where','include','map','attributes','model','debug','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x284506,_0x191316){var _0x1e9ee5=function(_0xe7eaa){while(--_0xe7eaa){_0x284506['push'](_0x284506['shift']());}};_0x1e9ee5(++_0x191316);}(_0x40cd,0xa5));var _0xd40c=function(_0x335de4,_0x46f9f1){_0x335de4=_0x335de4-0x0;var _0x2ceb56=_0x40cd[_0x335de4];return _0x2ceb56;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xd40c('0x0'));var BPromise=require(_0xd40c('0x1'));var rs=require(_0xd40c('0x2'));var fs=require('fs');var Redis=require(_0xd40c('0x3'));var db=require(_0xd40c('0x4'))['db'];var utils=require(_0xd40c('0x5'));var logger=require('../../config/logger')(_0xd40c('0x6'));var config=require(_0xd40c('0x7'));var jayson=require(_0xd40c('0x8'));var client=jayson[_0xd40c('0x9')][_0xd40c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x9abc4d,_0x1ab028,_0x616e6f){return new BPromise(function(_0x5d383f,_0x234017){return client[_0xd40c('0xb')](_0x9abc4d,_0x616e6f)[_0xd40c('0xc')](function(_0x44de53){logger[_0xd40c('0xd')](_0xd40c('0xe'),_0x1ab028,_0xd40c('0xf'));logger['debug'](_0xd40c('0x10'),_0x1ab028,_0xd40c('0xf'),JSON[_0xd40c('0x11')](_0x44de53));if(_0x44de53[_0xd40c('0x12')]){if(_0x44de53[_0xd40c('0x12')][_0xd40c('0x13')]===0x1f4){logger['error'](_0xd40c('0xe'),_0x1ab028,_0x44de53[_0xd40c('0x12')]['message']);return _0x234017(_0x44de53[_0xd40c('0x12')][_0xd40c('0x14')]);}logger[_0xd40c('0x12')](_0xd40c('0xe'),_0x1ab028,_0x44de53['error'][_0xd40c('0x14')]);return _0x5d383f(_0x44de53[_0xd40c('0x12')][_0xd40c('0x14')]);}else{logger[_0xd40c('0xd')]('Pause,\x20%s,\x20%s',_0x1ab028,'request\x20sent');_0x5d383f(_0x44de53[_0xd40c('0x15')][_0xd40c('0x14')]);}})[_0xd40c('0x16')](function(_0x160da9){logger[_0xd40c('0x12')]('Pause,\x20%s,\x20%s',_0x1ab028,_0x160da9);_0x234017(_0x160da9);});});}exports[_0xd40c('0x17')]=function(_0x26d86d){var _0x74e57c=this;return new Promise(function(_0x2ea918,_0x4060a6){return db[_0xd40c('0x18')][_0xd40c('0x19')]({'raw':_0x26d86d[_0xd40c('0x1a')]?_0x26d86d[_0xd40c('0x1a')][_0xd40c('0x1b')]===undefined?!![]:![]:!![],'where':_0x26d86d['options']?_0x26d86d['options'][_0xd40c('0x1c')]||null:null,'attributes':_0x26d86d[_0xd40c('0x1a')]?_0x26d86d['options']['attributes']||null:null,'include':_0x26d86d[_0xd40c('0x1a')]?_0x26d86d[_0xd40c('0x1a')][_0xd40c('0x1d')]?_[_0xd40c('0x1e')](_0x26d86d['options']['include'],function(_0x170abb){return{'model':db[_0x170abb['model']],'as':_0x170abb['as'],'attributes':_0x170abb[_0xd40c('0x1f')],'include':_0x170abb[_0xd40c('0x1d')]?_[_0xd40c('0x1e')](_0x170abb[_0xd40c('0x1d')],function(_0x245afc){return{'model':db[_0x245afc[_0xd40c('0x20')]],'as':_0x245afc['as'],'attributes':_0x245afc[_0xd40c('0x1f')],'include':_0x245afc[_0xd40c('0x1d')]?_[_0xd40c('0x1e')](_0x245afc['include'],function(_0xe7f48c){return{'model':db[_0xe7f48c['model']],'as':_0xe7f48c['as'],'attributes':_0xe7f48c['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x2e16d5){logger[_0xd40c('0xd')](_0xd40c('0x17'),_0x26d86d);logger[_0xd40c('0x21')](_0xd40c('0x17'),_0x26d86d,JSON[_0xd40c('0x11')](_0x2e16d5));_0x2ea918(_0x2e16d5);})[_0xd40c('0x16')](function(_0x520e43){logger[_0xd40c('0x12')](_0xd40c('0x17'),_0x520e43[_0xd40c('0x14')],_0x26d86d);_0x4060a6(_0x74e57c[_0xd40c('0x12')](0x1f4,_0x520e43['message']));});});};