Built motion from commit 497d3d92.|2.5.43
[motion2.git] / server / api / voiceAgentReport / voiceAgentReport.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 _0xce1c=['CreateVoiceAgentReport','create','body','options','then','UpdateVoiceAgentReport','VoiceAgentReport','update','where','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request\x20sent','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','VoiceAgentReport,\x20%s,\x20%s','result','catch'];(function(_0x54eab6,_0x5e262f){var _0x1e7435=function(_0x468c91){while(--_0x468c91){_0x54eab6['push'](_0x54eab6['shift']());}};_0x1e7435(++_0x5e262f);}(_0xce1c,0x18c));var _0xcce1=function(_0x5c8c71,_0x421f89){_0x5c8c71=_0x5c8c71-0x0;var _0x38eaef=_0xce1c[_0x5c8c71];return _0x38eaef;};'use strict';var _=require(_0xcce1('0x0'));var util=require(_0xcce1('0x1'));var moment=require(_0xcce1('0x2'));var BPromise=require(_0xcce1('0x3'));var rs=require(_0xcce1('0x4'));var fs=require('fs');var Redis=require(_0xcce1('0x5'));var db=require(_0xcce1('0x6'))['db'];var utils=require(_0xcce1('0x7'));var logger=require(_0xcce1('0x8'))('rpc');var config=require(_0xcce1('0x9'));var jayson=require(_0xcce1('0xa'));var client=jayson[_0xcce1('0xb')][_0xcce1('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5630ce,_0x266878,_0x457e86){return new BPromise(function(_0x6b6415,_0x50a3bf){return client['request'](_0x5630ce,_0x457e86)['then'](function(_0x5355f3){logger['info']('VoiceAgentReport,\x20%s,\x20%s',_0x266878,_0xcce1('0xd'));logger[_0xcce1('0xe')](_0xcce1('0xf'),_0x266878,_0xcce1('0xd'),JSON[_0xcce1('0x10')](_0x5355f3));if(_0x5355f3['error']){if(_0x5355f3[_0xcce1('0x11')][_0xcce1('0x12')]===0x1f4){logger['error']('VoiceAgentReport,\x20%s,\x20%s',_0x266878,_0x5355f3[_0xcce1('0x11')][_0xcce1('0x13')]);return _0x50a3bf(_0x5355f3[_0xcce1('0x11')][_0xcce1('0x13')]);}logger[_0xcce1('0x11')]('VoiceAgentReport,\x20%s,\x20%s',_0x266878,_0x5355f3[_0xcce1('0x11')][_0xcce1('0x13')]);return _0x6b6415(_0x5355f3[_0xcce1('0x11')][_0xcce1('0x13')]);}else{logger[_0xcce1('0x14')](_0xcce1('0x15'),_0x266878,_0xcce1('0xd'));_0x6b6415(_0x5355f3[_0xcce1('0x16')][_0xcce1('0x13')]);}})[_0xcce1('0x17')](function(_0x519f7c){logger[_0xcce1('0x11')](_0xcce1('0x15'),_0x266878,_0x519f7c);_0x50a3bf(_0x519f7c);});});}exports[_0xcce1('0x18')]=function(_0x55a461){var _0x4e3d52=this;return new Promise(function(_0x4546ce,_0x3e7392){return db['VoiceAgentReport'][_0xcce1('0x19')](_0x55a461[_0xcce1('0x1a')],{'raw':_0x55a461[_0xcce1('0x1b')]?_0x55a461[_0xcce1('0x1b')]['raw']===undefined?!![]:![]:!![]})[_0xcce1('0x1c')](function(_0x288c56){logger['info'](_0xcce1('0x18'),_0x55a461);logger[_0xcce1('0xe')](_0xcce1('0x18'),_0x55a461,JSON['stringify'](_0x288c56));_0x4546ce(_0x288c56);})['catch'](function(_0x41d83d){logger[_0xcce1('0x11')]('CreateVoiceAgentReport',_0x41d83d[_0xcce1('0x13')],_0x55a461);_0x3e7392(_0x4e3d52['error'](0x1f4,_0x41d83d[_0xcce1('0x13')]));});});};exports[_0xcce1('0x1d')]=function(_0x5469e2){var _0x599d9c=this;return new Promise(function(_0x3fcc1e,_0x17a5a9){return db[_0xcce1('0x1e')][_0xcce1('0x1f')](_0x5469e2[_0xcce1('0x1a')],{'raw':_0x5469e2[_0xcce1('0x1b')]?_0x5469e2[_0xcce1('0x1b')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5469e2[_0xcce1('0x1b')]?_0x5469e2[_0xcce1('0x1b')][_0xcce1('0x20')]||null:null,'attributes':_0x5469e2['options']?_0x5469e2[_0xcce1('0x1b')][_0xcce1('0x21')]||null:null,'limit':_0x5469e2[_0xcce1('0x1b')]?_0x5469e2[_0xcce1('0x1b')][_0xcce1('0x22')]||null:null})['then'](function(_0x5568e2){logger[_0xcce1('0x14')](_0xcce1('0x1d'),_0x5469e2);logger[_0xcce1('0xe')](_0xcce1('0x1d'),_0x5469e2,JSON[_0xcce1('0x10')](_0x5568e2));_0x3fcc1e(_0x5568e2);})[_0xcce1('0x17')](function(_0x1da700){logger[_0xcce1('0x11')](_0xcce1('0x1d'),_0x1da700[_0xcce1('0x13')],_0x5469e2);_0x17a5a9(_0x599d9c[_0xcce1('0x11')](0x1f4,_0x1da700[_0xcce1('0x13')]));});});};