Built motion from commit (unavailable).|2.3.8
[motion2.git] / server / api / voiceQueueReport / voiceQueueReport.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 _0x78cb=['where','attributes','limit','include','map','model','CreateVoiceQueueReport','create','body','stringify','UpdateVoiceQueueReport','update','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','http','defaults','redis','localhost','./voiceQueueReport.socket','register','request','then','info','request\x20sent','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','VoiceQueueReport,\x20%s,\x20%s','result','catch','GetVoiceQueueReport','VoiceQueueReport','findAll','options','raw'];(function(_0x35387d,_0x1ba72f){var _0x3aba56=function(_0x42cd08){while(--_0x42cd08){_0x35387d['push'](_0x35387d['shift']());}};_0x3aba56(++_0x1ba72f);}(_0x78cb,0x1c4));var _0xb78c=function(_0x157e9b,_0x21cfad){_0x157e9b=_0x157e9b-0x0;var _0x12eb3e=_0x78cb[_0x157e9b];return _0x12eb3e;};'use strict';var _=require(_0xb78c('0x0'));var util=require(_0xb78c('0x1'));var moment=require(_0xb78c('0x2'));var BPromise=require(_0xb78c('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb78c('0x4'));var db=require(_0xb78c('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xb78c('0x6'))(_0xb78c('0x7'));var config=require(_0xb78c('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xb78c('0x9')]({'port':0x232a});config['redis']=_[_0xb78c('0xa')](config[_0xb78c('0xb')],{'host':_0xb78c('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb78c('0xb')]));require(_0xb78c('0xd'))[_0xb78c('0xe')](socket);function respondWithRpcPromise(_0x2e0a56,_0x1826b8,_0x23b6f3){return new BPromise(function(_0x54a69d,_0x5f1ace){return client[_0xb78c('0xf')](_0x2e0a56,_0x23b6f3)[_0xb78c('0x10')](function(_0x1a7d6c){logger[_0xb78c('0x11')]('VoiceQueueReport,\x20%s,\x20%s',_0x1826b8,_0xb78c('0x12'));logger[_0xb78c('0x13')](_0xb78c('0x14'),_0x1826b8,_0xb78c('0x12'),JSON['stringify'](_0x1a7d6c));if(_0x1a7d6c[_0xb78c('0x15')]){if(_0x1a7d6c['error'][_0xb78c('0x16')]===0x1f4){logger[_0xb78c('0x15')]('VoiceQueueReport,\x20%s,\x20%s',_0x1826b8,_0x1a7d6c['error'][_0xb78c('0x17')]);return _0x5f1ace(_0x1a7d6c['error']['message']);}logger['error'](_0xb78c('0x18'),_0x1826b8,_0x1a7d6c[_0xb78c('0x15')][_0xb78c('0x17')]);return _0x54a69d(_0x1a7d6c['error'][_0xb78c('0x17')]);}else{logger[_0xb78c('0x11')](_0xb78c('0x18'),_0x1826b8,'request\x20sent');_0x54a69d(_0x1a7d6c[_0xb78c('0x19')][_0xb78c('0x17')]);}})[_0xb78c('0x1a')](function(_0xfbc060){logger[_0xb78c('0x15')](_0xb78c('0x18'),_0x1826b8,_0xfbc060);_0x5f1ace(_0xfbc060);});});}exports[_0xb78c('0x1b')]=function(_0x111b05){var _0x119b57=this;return new Promise(function(_0x5c225,_0x1e1316){return db[_0xb78c('0x1c')][_0xb78c('0x1d')]({'raw':_0x111b05['options']?_0x111b05[_0xb78c('0x1e')][_0xb78c('0x1f')]===undefined?!![]:![]:!![],'where':_0x111b05[_0xb78c('0x1e')]?_0x111b05[_0xb78c('0x1e')][_0xb78c('0x20')]||null:null,'attributes':_0x111b05[_0xb78c('0x1e')]?_0x111b05[_0xb78c('0x1e')][_0xb78c('0x21')]||null:null,'limit':_0x111b05[_0xb78c('0x1e')]?_0x111b05[_0xb78c('0x1e')][_0xb78c('0x22')]||null:null,'include':_0x111b05['options']?_0x111b05[_0xb78c('0x1e')][_0xb78c('0x23')]?_[_0xb78c('0x24')](_0x111b05[_0xb78c('0x1e')][_0xb78c('0x23')],function(_0x409991){return{'model':db[_0x409991[_0xb78c('0x25')]],'as':_0x409991['as'],'attributes':_0x409991[_0xb78c('0x21')],'include':_0x409991[_0xb78c('0x23')]?_[_0xb78c('0x24')](_0x409991['include'],function(_0x282d8c){return{'model':db[_0x282d8c[_0xb78c('0x25')]],'as':_0x282d8c['as'],'attributes':_0x282d8c['attributes'],'include':_0x282d8c[_0xb78c('0x23')]?_[_0xb78c('0x24')](_0x282d8c[_0xb78c('0x23')],function(_0xa63865){return{'model':db[_0xa63865[_0xb78c('0x25')]],'as':_0xa63865['as'],'attributes':_0xa63865[_0xb78c('0x21')]};}):[]};}):[]};}):[]:[]})[_0xb78c('0x10')](function(_0x398e1b){logger[_0xb78c('0x11')](_0xb78c('0x1b'),_0x111b05);logger[_0xb78c('0x13')](_0xb78c('0x1b'),_0x111b05,JSON['stringify'](_0x398e1b));_0x5c225(_0x398e1b);})[_0xb78c('0x1a')](function(_0x1becc6){logger[_0xb78c('0x15')](_0xb78c('0x1b'),_0x1becc6[_0xb78c('0x17')],_0x111b05);_0x1e1316(_0x119b57['error'](0x1f4,_0x1becc6[_0xb78c('0x17')]));});});};exports[_0xb78c('0x26')]=function(_0x11e006){var _0x57b095=this;return new Promise(function(_0x3e43fc,_0x53fc85){return db['VoiceQueueReport'][_0xb78c('0x27')](_0x11e006[_0xb78c('0x28')],{'raw':_0x11e006[_0xb78c('0x1e')]?_0x11e006[_0xb78c('0x1e')][_0xb78c('0x1f')]===undefined?!![]:![]:!![]})[_0xb78c('0x10')](function(_0x5b3ed6){logger[_0xb78c('0x11')]('CreateVoiceQueueReport',_0x11e006);logger[_0xb78c('0x13')](_0xb78c('0x26'),_0x11e006,JSON[_0xb78c('0x29')](_0x5b3ed6));_0x3e43fc(_0x5b3ed6);})['catch'](function(_0xbe0c6f){logger[_0xb78c('0x15')](_0xb78c('0x26'),_0xbe0c6f[_0xb78c('0x17')],_0x11e006);_0x53fc85(_0x57b095[_0xb78c('0x15')](0x1f4,_0xbe0c6f[_0xb78c('0x17')]));});});};exports[_0xb78c('0x2a')]=function(_0x20ca39){var _0x4e8bf2=this;return new Promise(function(_0xe65745,_0x393295){return db['VoiceQueueReport'][_0xb78c('0x2b')](_0x20ca39['body'],{'raw':_0x20ca39[_0xb78c('0x1e')]?_0x20ca39['options'][_0xb78c('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x20ca39[_0xb78c('0x1e')]?_0x20ca39['options'][_0xb78c('0x20')]||null:null,'attributes':_0x20ca39[_0xb78c('0x1e')]?_0x20ca39[_0xb78c('0x1e')]['attributes']||null:null,'limit':_0x20ca39[_0xb78c('0x1e')]?_0x20ca39[_0xb78c('0x1e')][_0xb78c('0x22')]||null:null})['then'](function(_0x4e1bbe){logger[_0xb78c('0x11')](_0xb78c('0x2a'),_0x20ca39);logger[_0xb78c('0x13')](_0xb78c('0x2a'),_0x20ca39,JSON[_0xb78c('0x29')](_0x4e1bbe));_0xe65745(_0x4e1bbe);})[_0xb78c('0x1a')](function(_0x5ca9d9){logger[_0xb78c('0x15')](_0xb78c('0x2a'),_0x5ca9d9['message'],_0x20ca39);_0x393295(_0x4e8bf2[_0xb78c('0x15')](0x1f4,_0x5ca9d9[_0xb78c('0x17')]));});});};