Built motion from commit (unavailable).|2.5.6
[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 _0xb235=['../../config/utils','rpc','../../config/environment','client','redis','defaults','socket.io-emitter','./voiceQueueReport.socket','register','then','info','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','VoiceQueueReport','options','raw','where','attributes','include','map','model','GetVoiceQueueReport','create','body','CreateVoiceQueueReport','update','UpdateVoiceQueueReport','lodash','util','moment','randomstring','ioredis','../../mysqldb'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0xb235,0x1e6));var _0x5b23=function(_0x338c8c,_0x19df14){_0x338c8c=_0x338c8c-0x0;var _0x371a9a=_0xb235[_0x338c8c];return _0x371a9a;};'use strict';var _=require(_0x5b23('0x0'));var util=require(_0x5b23('0x1'));var moment=require(_0x5b23('0x2'));var BPromise=require('bluebird');var rs=require(_0x5b23('0x3'));var fs=require('fs');var Redis=require(_0x5b23('0x4'));var db=require(_0x5b23('0x5'))['db'];var utils=require(_0x5b23('0x6'));var logger=require('../../config/logger')(_0x5b23('0x7'));var config=require(_0x5b23('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x5b23('0x9')]['http']({'port':0x232a});config[_0x5b23('0xa')]=_[_0x5b23('0xb')](config[_0x5b23('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x5b23('0xc'))(new Redis(config[_0x5b23('0xa')]));require(_0x5b23('0xd'))[_0x5b23('0xe')](socket);function respondWithRpcPromise(_0x372d7a,_0x1bd0e5,_0x350cef){return new BPromise(function(_0x23ef86,_0x395f96){return client['request'](_0x372d7a,_0x350cef)[_0x5b23('0xf')](function(_0x1fc8a8){logger[_0x5b23('0x10')](_0x5b23('0x11'),_0x1bd0e5,_0x5b23('0x12'));logger[_0x5b23('0x13')](_0x5b23('0x14'),_0x1bd0e5,_0x5b23('0x12'),JSON[_0x5b23('0x15')](_0x1fc8a8));if(_0x1fc8a8[_0x5b23('0x16')]){if(_0x1fc8a8[_0x5b23('0x16')][_0x5b23('0x17')]===0x1f4){logger[_0x5b23('0x16')](_0x5b23('0x11'),_0x1bd0e5,_0x1fc8a8[_0x5b23('0x16')][_0x5b23('0x18')]);return _0x395f96(_0x1fc8a8[_0x5b23('0x16')][_0x5b23('0x18')]);}logger['error'](_0x5b23('0x11'),_0x1bd0e5,_0x1fc8a8[_0x5b23('0x16')][_0x5b23('0x18')]);return _0x23ef86(_0x1fc8a8[_0x5b23('0x16')][_0x5b23('0x18')]);}else{logger[_0x5b23('0x10')](_0x5b23('0x11'),_0x1bd0e5,_0x5b23('0x12'));_0x23ef86(_0x1fc8a8[_0x5b23('0x19')][_0x5b23('0x18')]);}})[_0x5b23('0x1a')](function(_0x516a5a){logger['error']('VoiceQueueReport,\x20%s,\x20%s',_0x1bd0e5,_0x516a5a);_0x395f96(_0x516a5a);});});}exports['GetVoiceQueueReport']=function(_0x37e893){var _0x4b5e80=this;return new Promise(function(_0x2d8361,_0x271ca3){return db[_0x5b23('0x1b')]['findAll']({'raw':_0x37e893[_0x5b23('0x1c')]?_0x37e893['options'][_0x5b23('0x1d')]===undefined?!![]:![]:!![],'where':_0x37e893[_0x5b23('0x1c')]?_0x37e893['options'][_0x5b23('0x1e')]||null:null,'attributes':_0x37e893['options']?_0x37e893[_0x5b23('0x1c')][_0x5b23('0x1f')]||null:null,'limit':_0x37e893[_0x5b23('0x1c')]?_0x37e893['options']['limit']||null:null,'include':_0x37e893[_0x5b23('0x1c')]?_0x37e893[_0x5b23('0x1c')][_0x5b23('0x20')]?_[_0x5b23('0x21')](_0x37e893[_0x5b23('0x1c')]['include'],function(_0x47cfff){return{'model':db[_0x47cfff[_0x5b23('0x22')]],'as':_0x47cfff['as'],'attributes':_0x47cfff[_0x5b23('0x1f')],'include':_0x47cfff['include']?_[_0x5b23('0x21')](_0x47cfff[_0x5b23('0x20')],function(_0x5ecdea){return{'model':db[_0x5ecdea[_0x5b23('0x22')]],'as':_0x5ecdea['as'],'attributes':_0x5ecdea[_0x5b23('0x1f')],'include':_0x5ecdea[_0x5b23('0x20')]?_[_0x5b23('0x21')](_0x5ecdea[_0x5b23('0x20')],function(_0x46d6a1){return{'model':db[_0x46d6a1['model']],'as':_0x46d6a1['as'],'attributes':_0x46d6a1['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0xff2a47){logger[_0x5b23('0x10')](_0x5b23('0x23'),_0x37e893);logger[_0x5b23('0x13')]('GetVoiceQueueReport',_0x37e893,JSON[_0x5b23('0x15')](_0xff2a47));_0x2d8361(_0xff2a47);})[_0x5b23('0x1a')](function(_0x515395){logger[_0x5b23('0x16')](_0x5b23('0x23'),_0x515395[_0x5b23('0x18')],_0x37e893);_0x271ca3(_0x4b5e80[_0x5b23('0x16')](0x1f4,_0x515395[_0x5b23('0x18')]));});});};exports['CreateVoiceQueueReport']=function(_0x20c0a9){var _0xbc38dd=this;return new Promise(function(_0x5154cf,_0x43aa7b){return db[_0x5b23('0x1b')][_0x5b23('0x24')](_0x20c0a9[_0x5b23('0x25')],{'raw':_0x20c0a9[_0x5b23('0x1c')]?_0x20c0a9[_0x5b23('0x1c')]['raw']===undefined?!![]:![]:!![]})[_0x5b23('0xf')](function(_0x203549){logger['info'](_0x5b23('0x26'),_0x20c0a9);logger[_0x5b23('0x13')](_0x5b23('0x26'),_0x20c0a9,JSON[_0x5b23('0x15')](_0x203549));_0x5154cf(_0x203549);})[_0x5b23('0x1a')](function(_0x5bcdf2){logger[_0x5b23('0x16')](_0x5b23('0x26'),_0x5bcdf2[_0x5b23('0x18')],_0x20c0a9);_0x43aa7b(_0xbc38dd['error'](0x1f4,_0x5bcdf2[_0x5b23('0x18')]));});});};exports['UpdateVoiceQueueReport']=function(_0x27e40e){var _0x1eb37d=this;return new Promise(function(_0x45b71a,_0x470d90){return db[_0x5b23('0x1b')][_0x5b23('0x27')](_0x27e40e[_0x5b23('0x25')],{'raw':_0x27e40e['options']?_0x27e40e[_0x5b23('0x1c')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x27e40e[_0x5b23('0x1c')]?_0x27e40e[_0x5b23('0x1c')][_0x5b23('0x1e')]||null:null,'attributes':_0x27e40e[_0x5b23('0x1c')]?_0x27e40e[_0x5b23('0x1c')][_0x5b23('0x1f')]||null:null,'limit':_0x27e40e[_0x5b23('0x1c')]?_0x27e40e[_0x5b23('0x1c')]['limit']||null:null})[_0x5b23('0xf')](function(_0x8a3f50){logger[_0x5b23('0x10')]('UpdateVoiceQueueReport',_0x27e40e);logger[_0x5b23('0x13')]('UpdateVoiceQueueReport',_0x27e40e,JSON[_0x5b23('0x15')](_0x8a3f50));_0x45b71a(_0x8a3f50);})[_0x5b23('0x1a')](function(_0x5edb82){logger['error'](_0x5b23('0x28'),_0x5edb82[_0x5b23('0x18')],_0x27e40e);_0x470d90(_0x1eb37d['error'](0x1f4,_0x5edb82['message']));});});};