Built motion from commit (unavailable).|2.5.31
[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 _0x7b40=['error','code','VoiceQueueReport,\x20%s,\x20%s','message','result','catch','GetVoiceQueueReport','VoiceQueueReport','findAll','options','raw','where','attributes','include','map','model','CreateVoiceQueueReport','create','body','UpdateVoiceQueueReport','update','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','http','redis','defaults','localhost','socket.io-emitter','./voiceQueueReport.socket','request','then','info','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0x7b40,0x1a1));var _0x07b4=function(_0x2d7bba,_0x55ef06){_0x2d7bba=_0x2d7bba-0x0;var _0x440c39=_0x7b40[_0x2d7bba];return _0x440c39;};'use strict';var _=require(_0x07b4('0x0'));var util=require(_0x07b4('0x1'));var moment=require(_0x07b4('0x2'));var BPromise=require(_0x07b4('0x3'));var rs=require(_0x07b4('0x4'));var fs=require('fs');var Redis=require(_0x07b4('0x5'));var db=require(_0x07b4('0x6'))['db'];var utils=require(_0x07b4('0x7'));var logger=require(_0x07b4('0x8'))(_0x07b4('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x07b4('0xa')]({'port':0x232a});config[_0x07b4('0xb')]=_[_0x07b4('0xc')](config[_0x07b4('0xb')],{'host':_0x07b4('0xd'),'port':0x18eb});var socket=require(_0x07b4('0xe'))(new Redis(config['redis']));require(_0x07b4('0xf'))['register'](socket);function respondWithRpcPromise(_0x248775,_0x1cac47,_0x4915b0){return new BPromise(function(_0x6e3103,_0x3b6404){return client[_0x07b4('0x10')](_0x248775,_0x4915b0)[_0x07b4('0x11')](function(_0x11a483){logger[_0x07b4('0x12')]('VoiceQueueReport,\x20%s,\x20%s',_0x1cac47,'request\x20sent');logger[_0x07b4('0x13')](_0x07b4('0x14'),_0x1cac47,_0x07b4('0x15'),JSON[_0x07b4('0x16')](_0x11a483));if(_0x11a483[_0x07b4('0x17')]){if(_0x11a483[_0x07b4('0x17')][_0x07b4('0x18')]===0x1f4){logger[_0x07b4('0x17')](_0x07b4('0x19'),_0x1cac47,_0x11a483[_0x07b4('0x17')]['message']);return _0x3b6404(_0x11a483[_0x07b4('0x17')][_0x07b4('0x1a')]);}logger[_0x07b4('0x17')](_0x07b4('0x19'),_0x1cac47,_0x11a483['error'][_0x07b4('0x1a')]);return _0x6e3103(_0x11a483['error'][_0x07b4('0x1a')]);}else{logger[_0x07b4('0x12')](_0x07b4('0x19'),_0x1cac47,_0x07b4('0x15'));_0x6e3103(_0x11a483[_0x07b4('0x1b')][_0x07b4('0x1a')]);}})[_0x07b4('0x1c')](function(_0x488a51){logger[_0x07b4('0x17')](_0x07b4('0x19'),_0x1cac47,_0x488a51);_0x3b6404(_0x488a51);});});}exports[_0x07b4('0x1d')]=function(_0x3741be){var _0x5cfd25=this;return new Promise(function(_0x5bbf77,_0x2a25e3){return db[_0x07b4('0x1e')][_0x07b4('0x1f')]({'raw':_0x3741be[_0x07b4('0x20')]?_0x3741be[_0x07b4('0x20')][_0x07b4('0x21')]===undefined?!![]:![]:!![],'where':_0x3741be[_0x07b4('0x20')]?_0x3741be[_0x07b4('0x20')][_0x07b4('0x22')]||null:null,'attributes':_0x3741be['options']?_0x3741be[_0x07b4('0x20')][_0x07b4('0x23')]||null:null,'limit':_0x3741be[_0x07b4('0x20')]?_0x3741be['options']['limit']||null:null,'include':_0x3741be['options']?_0x3741be[_0x07b4('0x20')][_0x07b4('0x24')]?_['map'](_0x3741be[_0x07b4('0x20')]['include'],function(_0x3696a9){return{'model':db[_0x3696a9['model']],'as':_0x3696a9['as'],'attributes':_0x3696a9[_0x07b4('0x23')],'include':_0x3696a9[_0x07b4('0x24')]?_[_0x07b4('0x25')](_0x3696a9[_0x07b4('0x24')],function(_0x54f463){return{'model':db[_0x54f463[_0x07b4('0x26')]],'as':_0x54f463['as'],'attributes':_0x54f463['attributes'],'include':_0x54f463[_0x07b4('0x24')]?_['map'](_0x54f463['include'],function(_0x39ec6e){return{'model':db[_0x39ec6e['model']],'as':_0x39ec6e['as'],'attributes':_0x39ec6e[_0x07b4('0x23')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5305b0){logger[_0x07b4('0x12')](_0x07b4('0x1d'),_0x3741be);logger[_0x07b4('0x13')](_0x07b4('0x1d'),_0x3741be,JSON[_0x07b4('0x16')](_0x5305b0));_0x5bbf77(_0x5305b0);})[_0x07b4('0x1c')](function(_0x2e7f65){logger[_0x07b4('0x17')]('GetVoiceQueueReport',_0x2e7f65['message'],_0x3741be);_0x2a25e3(_0x5cfd25[_0x07b4('0x17')](0x1f4,_0x2e7f65[_0x07b4('0x1a')]));});});};exports[_0x07b4('0x27')]=function(_0x2ddadb){var _0x10de70=this;return new Promise(function(_0x24f547,_0xcb6e75){return db[_0x07b4('0x1e')][_0x07b4('0x28')](_0x2ddadb[_0x07b4('0x29')],{'raw':_0x2ddadb[_0x07b4('0x20')]?_0x2ddadb[_0x07b4('0x20')][_0x07b4('0x21')]===undefined?!![]:![]:!![]})[_0x07b4('0x11')](function(_0x2d1e57){logger[_0x07b4('0x12')]('CreateVoiceQueueReport',_0x2ddadb);logger[_0x07b4('0x13')](_0x07b4('0x27'),_0x2ddadb,JSON['stringify'](_0x2d1e57));_0x24f547(_0x2d1e57);})['catch'](function(_0x334d54){logger['error']('CreateVoiceQueueReport',_0x334d54[_0x07b4('0x1a')],_0x2ddadb);_0xcb6e75(_0x10de70[_0x07b4('0x17')](0x1f4,_0x334d54[_0x07b4('0x1a')]));});});};exports[_0x07b4('0x2a')]=function(_0x537a26){var _0x3652d7=this;return new Promise(function(_0x30bcfc,_0x544cc0){return db[_0x07b4('0x1e')][_0x07b4('0x2b')](_0x537a26[_0x07b4('0x29')],{'raw':_0x537a26[_0x07b4('0x20')]?_0x537a26[_0x07b4('0x20')][_0x07b4('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x537a26[_0x07b4('0x20')]?_0x537a26[_0x07b4('0x20')][_0x07b4('0x22')]||null:null,'attributes':_0x537a26[_0x07b4('0x20')]?_0x537a26[_0x07b4('0x20')]['attributes']||null:null,'limit':_0x537a26[_0x07b4('0x20')]?_0x537a26[_0x07b4('0x20')]['limit']||null:null})[_0x07b4('0x11')](function(_0x571875){logger['info']('UpdateVoiceQueueReport',_0x537a26);logger[_0x07b4('0x13')]('UpdateVoiceQueueReport',_0x537a26,JSON[_0x07b4('0x16')](_0x571875));_0x30bcfc(_0x571875);})[_0x07b4('0x1c')](function(_0x59f3d4){logger[_0x07b4('0x17')](_0x07b4('0x2a'),_0x59f3d4[_0x07b4('0x1a')],_0x537a26);_0x544cc0(_0x3652d7[_0x07b4('0x17')](0x1f4,_0x59f3d4[_0x07b4('0x1a')]));});});};