Built motion from commit (unavailable).|2.4.4
[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 _0x3caf=['model','map','GetVoiceQueueReport','CreateVoiceQueueReport','UpdateVoiceQueueReport','update','body','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','./voiceQueueReport.socket','request','then','info','request\x20sent','debug','stringify','error','code','VoiceQueueReport,\x20%s,\x20%s','message','catch','VoiceQueueReport','findAll','options','raw','where','attributes','limit','include'];(function(_0x584e52,_0x5443dc){var _0x5cf710=function(_0x4fc333){while(--_0x4fc333){_0x584e52['push'](_0x584e52['shift']());}};_0x5cf710(++_0x5443dc);}(_0x3caf,0x7f));var _0xf3ca=function(_0x4282aa,_0xe66504){_0x4282aa=_0x4282aa-0x0;var _0x5085f0=_0x3caf[_0x4282aa];return _0x5085f0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xf3ca('0x0'));var BPromise=require(_0xf3ca('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf3ca('0x2'));var db=require(_0xf3ca('0x3'))['db'];var utils=require(_0xf3ca('0x4'));var logger=require(_0xf3ca('0x5'))(_0xf3ca('0x6'));var config=require(_0xf3ca('0x7'));var jayson=require(_0xf3ca('0x8'));var client=jayson[_0xf3ca('0x9')]['http']({'port':0x232a});config[_0xf3ca('0xa')]=_[_0xf3ca('0xb')](config[_0xf3ca('0xa')],{'host':_0xf3ca('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf3ca('0xa')]));require(_0xf3ca('0xd'))['register'](socket);function respondWithRpcPromise(_0x57244c,_0xbcae4c,_0x7d3075){return new BPromise(function(_0x1b2c27,_0x57b17a){return client[_0xf3ca('0xe')](_0x57244c,_0x7d3075)[_0xf3ca('0xf')](function(_0x554539){logger[_0xf3ca('0x10')]('VoiceQueueReport,\x20%s,\x20%s',_0xbcae4c,_0xf3ca('0x11'));logger[_0xf3ca('0x12')]('VoiceQueueReport,\x20%s,\x20%s,\x20%s',_0xbcae4c,_0xf3ca('0x11'),JSON[_0xf3ca('0x13')](_0x554539));if(_0x554539[_0xf3ca('0x14')]){if(_0x554539[_0xf3ca('0x14')][_0xf3ca('0x15')]===0x1f4){logger[_0xf3ca('0x14')](_0xf3ca('0x16'),_0xbcae4c,_0x554539[_0xf3ca('0x14')][_0xf3ca('0x17')]);return _0x57b17a(_0x554539['error'][_0xf3ca('0x17')]);}logger['error'](_0xf3ca('0x16'),_0xbcae4c,_0x554539['error'][_0xf3ca('0x17')]);return _0x1b2c27(_0x554539[_0xf3ca('0x14')][_0xf3ca('0x17')]);}else{logger['info'](_0xf3ca('0x16'),_0xbcae4c,_0xf3ca('0x11'));_0x1b2c27(_0x554539['result'][_0xf3ca('0x17')]);}})[_0xf3ca('0x18')](function(_0x193bf4){logger[_0xf3ca('0x14')]('VoiceQueueReport,\x20%s,\x20%s',_0xbcae4c,_0x193bf4);_0x57b17a(_0x193bf4);});});}exports['GetVoiceQueueReport']=function(_0x114106){var _0x1a02e6=this;return new Promise(function(_0x32f8d7,_0x1601b8){return db[_0xf3ca('0x19')][_0xf3ca('0x1a')]({'raw':_0x114106[_0xf3ca('0x1b')]?_0x114106[_0xf3ca('0x1b')][_0xf3ca('0x1c')]===undefined?!![]:![]:!![],'where':_0x114106[_0xf3ca('0x1b')]?_0x114106[_0xf3ca('0x1b')][_0xf3ca('0x1d')]||null:null,'attributes':_0x114106[_0xf3ca('0x1b')]?_0x114106[_0xf3ca('0x1b')][_0xf3ca('0x1e')]||null:null,'limit':_0x114106[_0xf3ca('0x1b')]?_0x114106['options'][_0xf3ca('0x1f')]||null:null,'include':_0x114106['options']?_0x114106[_0xf3ca('0x1b')][_0xf3ca('0x20')]?_['map'](_0x114106[_0xf3ca('0x1b')][_0xf3ca('0x20')],function(_0x273a95){return{'model':db[_0x273a95[_0xf3ca('0x21')]],'as':_0x273a95['as'],'attributes':_0x273a95[_0xf3ca('0x1e')],'include':_0x273a95[_0xf3ca('0x20')]?_['map'](_0x273a95[_0xf3ca('0x20')],function(_0x160bda){return{'model':db[_0x160bda[_0xf3ca('0x21')]],'as':_0x160bda['as'],'attributes':_0x160bda[_0xf3ca('0x1e')],'include':_0x160bda['include']?_[_0xf3ca('0x22')](_0x160bda[_0xf3ca('0x20')],function(_0x245623){return{'model':db[_0x245623['model']],'as':_0x245623['as'],'attributes':_0x245623[_0xf3ca('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xf3ca('0xf')](function(_0x388dde){logger['info'](_0xf3ca('0x23'),_0x114106);logger[_0xf3ca('0x12')](_0xf3ca('0x23'),_0x114106,JSON[_0xf3ca('0x13')](_0x388dde));_0x32f8d7(_0x388dde);})['catch'](function(_0x5a3c20){logger[_0xf3ca('0x14')](_0xf3ca('0x23'),_0x5a3c20['message'],_0x114106);_0x1601b8(_0x1a02e6[_0xf3ca('0x14')](0x1f4,_0x5a3c20[_0xf3ca('0x17')]));});});};exports[_0xf3ca('0x24')]=function(_0x51b04b){var _0x275861=this;return new Promise(function(_0x3270e3,_0x16c525){return db[_0xf3ca('0x19')]['create'](_0x51b04b['body'],{'raw':_0x51b04b['options']?_0x51b04b[_0xf3ca('0x1b')][_0xf3ca('0x1c')]===undefined?!![]:![]:!![]})[_0xf3ca('0xf')](function(_0x5c25de){logger[_0xf3ca('0x10')](_0xf3ca('0x24'),_0x51b04b);logger[_0xf3ca('0x12')](_0xf3ca('0x24'),_0x51b04b,JSON[_0xf3ca('0x13')](_0x5c25de));_0x3270e3(_0x5c25de);})[_0xf3ca('0x18')](function(_0xb15b76){logger[_0xf3ca('0x14')](_0xf3ca('0x24'),_0xb15b76[_0xf3ca('0x17')],_0x51b04b);_0x16c525(_0x275861['error'](0x1f4,_0xb15b76[_0xf3ca('0x17')]));});});};exports[_0xf3ca('0x25')]=function(_0x1ee826){var _0x3054ac=this;return new Promise(function(_0x3af14e,_0x422c8b){return db[_0xf3ca('0x19')][_0xf3ca('0x26')](_0x1ee826[_0xf3ca('0x27')],{'raw':_0x1ee826[_0xf3ca('0x1b')]?_0x1ee826['options'][_0xf3ca('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1ee826[_0xf3ca('0x1b')]?_0x1ee826[_0xf3ca('0x1b')][_0xf3ca('0x1d')]||null:null,'attributes':_0x1ee826[_0xf3ca('0x1b')]?_0x1ee826[_0xf3ca('0x1b')][_0xf3ca('0x1e')]||null:null,'limit':_0x1ee826['options']?_0x1ee826['options']['limit']||null:null})[_0xf3ca('0xf')](function(_0x2cb68d){logger[_0xf3ca('0x10')]('UpdateVoiceQueueReport',_0x1ee826);logger[_0xf3ca('0x12')]('UpdateVoiceQueueReport',_0x1ee826,JSON[_0xf3ca('0x13')](_0x2cb68d));_0x3af14e(_0x2cb68d);})[_0xf3ca('0x18')](function(_0x59bffe){logger['error'](_0xf3ca('0x25'),_0x59bffe[_0xf3ca('0x17')],_0x1ee826);_0x422c8b(_0x3054ac[_0xf3ca('0x14')](0x1f4,_0x59bffe[_0xf3ca('0x17')]));});});};