Built motion from commit 3c2ce842.|2.6.31
[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 _0x33a4=['create','options','raw','UpdateVoiceAgentReport','update','attributes','limit','util','moment','bluebird','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateVoiceAgentReport','VoiceAgentReport'];(function(_0x2c0dc0,_0x19900d){var _0x4c0990=function(_0x530791){while(--_0x530791){_0x2c0dc0['push'](_0x2c0dc0['shift']());}};_0x4c0990(++_0x19900d);}(_0x33a4,0xf7));var _0x433a=function(_0x2c935b,_0x5e4857){_0x2c935b=_0x2c935b-0x0;var _0x4829a6=_0x33a4[_0x2c935b];return _0x4829a6;};'use strict';var _=require('lodash');var util=require(_0x433a('0x0'));var moment=require(_0x433a('0x1'));var BPromise=require(_0x433a('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x433a('0x3'))(_0x433a('0x4'));var config=require(_0x433a('0x5'));var jayson=require(_0x433a('0x6'));var client=jayson[_0x433a('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1ba5c7,_0x2b5396,_0x2c8d6c){return new BPromise(function(_0x256d94,_0x326321){return client[_0x433a('0x8')](_0x1ba5c7,_0x2c8d6c)[_0x433a('0x9')](function(_0x4d38e4){logger[_0x433a('0xa')](_0x433a('0xb'),_0x2b5396,_0x433a('0xc'));logger[_0x433a('0xd')](_0x433a('0xe'),_0x2b5396,_0x433a('0xc'),JSON[_0x433a('0xf')](_0x4d38e4));if(_0x4d38e4[_0x433a('0x10')]){if(_0x4d38e4['error'][_0x433a('0x11')]===0x1f4){logger[_0x433a('0x10')](_0x433a('0xb'),_0x2b5396,_0x4d38e4[_0x433a('0x10')][_0x433a('0x12')]);return _0x326321(_0x4d38e4[_0x433a('0x10')][_0x433a('0x12')]);}logger[_0x433a('0x10')]('VoiceAgentReport,\x20%s,\x20%s',_0x2b5396,_0x4d38e4[_0x433a('0x10')][_0x433a('0x12')]);return _0x256d94(_0x4d38e4[_0x433a('0x10')]['message']);}else{logger[_0x433a('0xa')](_0x433a('0xb'),_0x2b5396,_0x433a('0xc'));_0x256d94(_0x4d38e4[_0x433a('0x13')][_0x433a('0x12')]);}})[_0x433a('0x14')](function(_0x3c39e9){logger[_0x433a('0x10')]('VoiceAgentReport,\x20%s,\x20%s',_0x2b5396,_0x3c39e9);_0x326321(_0x3c39e9);});});}exports[_0x433a('0x15')]=function(_0xfad8fb){var _0x412600=this;return new Promise(function(_0x3a2dbd,_0x23db71){return db[_0x433a('0x16')][_0x433a('0x17')](_0xfad8fb['body'],{'raw':_0xfad8fb[_0x433a('0x18')]?_0xfad8fb[_0x433a('0x18')][_0x433a('0x19')]===undefined?!![]:![]:!![]})[_0x433a('0x9')](function(_0x15bc46){logger[_0x433a('0xa')]('CreateVoiceAgentReport',_0xfad8fb);logger[_0x433a('0xd')](_0x433a('0x15'),_0xfad8fb,JSON['stringify'](_0x15bc46));_0x3a2dbd(_0x15bc46);})[_0x433a('0x14')](function(_0x251cc1){logger[_0x433a('0x10')](_0x433a('0x15'),_0x251cc1[_0x433a('0x12')],_0xfad8fb);_0x23db71(_0x412600[_0x433a('0x10')](0x1f4,_0x251cc1[_0x433a('0x12')]));});});};exports[_0x433a('0x1a')]=function(_0x839594){var _0x1769c3=this;return new Promise(function(_0x2d74dc,_0x51c99d){return db[_0x433a('0x16')][_0x433a('0x1b')](_0x839594['body'],{'raw':_0x839594[_0x433a('0x18')]?_0x839594[_0x433a('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x839594['options']?_0x839594['options']['where']||null:null,'attributes':_0x839594['options']?_0x839594[_0x433a('0x18')][_0x433a('0x1c')]||null:null,'limit':_0x839594['options']?_0x839594[_0x433a('0x18')][_0x433a('0x1d')]||null:null})[_0x433a('0x9')](function(_0x45c15c){logger[_0x433a('0xa')](_0x433a('0x1a'),_0x839594);logger[_0x433a('0xd')](_0x433a('0x1a'),_0x839594,JSON['stringify'](_0x45c15c));_0x2d74dc(_0x45c15c);})[_0x433a('0x14')](function(_0x34b6a7){logger['error'](_0x433a('0x1a'),_0x34b6a7[_0x433a('0x12')],_0x839594);_0x51c99d(_0x1769c3[_0x433a('0x10')](0x1f4,_0x34b6a7[_0x433a('0x12')]));});});};