Built motion from commit 7ab0e143.|2.5.49
[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 _0x39a6=['result','catch','options','then','stringify','CreateVoiceAgentReport','UpdateVoiceAgentReport','VoiceAgentReport','update','body','where','attributes','limit','util','moment','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','info','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','debug','error','message'];(function(_0x364d4a,_0x160236){var _0x47811a=function(_0x5a2ae3){while(--_0x5a2ae3){_0x364d4a['push'](_0x364d4a['shift']());}};_0x47811a(++_0x160236);}(_0x39a6,0x1dd));var _0x639a=function(_0x5796a3,_0x46da6d){_0x5796a3=_0x5796a3-0x0;var _0x4b2ef1=_0x39a6[_0x5796a3];return _0x4b2ef1;};'use strict';var _=require('lodash');var util=require(_0x639a('0x0'));var moment=require(_0x639a('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x639a('0x2'));var db=require(_0x639a('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x639a('0x4'))(_0x639a('0x5'));var config=require('../../config/environment');var jayson=require(_0x639a('0x6'));var client=jayson[_0x639a('0x7')][_0x639a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x113c1f,_0x2450be,_0x42aab5){return new BPromise(function(_0x2d997f,_0x5781a9){return client[_0x639a('0x9')](_0x113c1f,_0x42aab5)['then'](function(_0x1dac1b){logger[_0x639a('0xa')](_0x639a('0xb'),_0x2450be,_0x639a('0xc'));logger[_0x639a('0xd')]('VoiceAgentReport,\x20%s,\x20%s,\x20%s',_0x2450be,_0x639a('0xc'),JSON['stringify'](_0x1dac1b));if(_0x1dac1b[_0x639a('0xe')]){if(_0x1dac1b[_0x639a('0xe')]['code']===0x1f4){logger[_0x639a('0xe')](_0x639a('0xb'),_0x2450be,_0x1dac1b[_0x639a('0xe')]['message']);return _0x5781a9(_0x1dac1b[_0x639a('0xe')][_0x639a('0xf')]);}logger[_0x639a('0xe')]('VoiceAgentReport,\x20%s,\x20%s',_0x2450be,_0x1dac1b[_0x639a('0xe')][_0x639a('0xf')]);return _0x2d997f(_0x1dac1b[_0x639a('0xe')][_0x639a('0xf')]);}else{logger[_0x639a('0xa')]('VoiceAgentReport,\x20%s,\x20%s',_0x2450be,_0x639a('0xc'));_0x2d997f(_0x1dac1b[_0x639a('0x10')]['message']);}})[_0x639a('0x11')](function(_0x223447){logger[_0x639a('0xe')]('VoiceAgentReport,\x20%s,\x20%s',_0x2450be,_0x223447);_0x5781a9(_0x223447);});});}exports['CreateVoiceAgentReport']=function(_0x56b26b){var _0x449ef0=this;return new Promise(function(_0x341d7f,_0x46f661){return db['VoiceAgentReport']['create'](_0x56b26b['body'],{'raw':_0x56b26b[_0x639a('0x12')]?_0x56b26b['options']['raw']===undefined?!![]:![]:!![]})[_0x639a('0x13')](function(_0x2d8f35){logger[_0x639a('0xa')]('CreateVoiceAgentReport',_0x56b26b);logger[_0x639a('0xd')]('CreateVoiceAgentReport',_0x56b26b,JSON[_0x639a('0x14')](_0x2d8f35));_0x341d7f(_0x2d8f35);})[_0x639a('0x11')](function(_0x250b60){logger[_0x639a('0xe')](_0x639a('0x15'),_0x250b60['message'],_0x56b26b);_0x46f661(_0x449ef0[_0x639a('0xe')](0x1f4,_0x250b60['message']));});});};exports[_0x639a('0x16')]=function(_0x342e05){var _0x34b4c8=this;return new Promise(function(_0x1a023b,_0x3624df){return db[_0x639a('0x17')][_0x639a('0x18')](_0x342e05[_0x639a('0x19')],{'raw':_0x342e05[_0x639a('0x12')]?_0x342e05[_0x639a('0x12')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x342e05['options']?_0x342e05['options'][_0x639a('0x1a')]||null:null,'attributes':_0x342e05[_0x639a('0x12')]?_0x342e05['options'][_0x639a('0x1b')]||null:null,'limit':_0x342e05['options']?_0x342e05[_0x639a('0x12')][_0x639a('0x1c')]||null:null})[_0x639a('0x13')](function(_0x5302ec){logger[_0x639a('0xa')](_0x639a('0x16'),_0x342e05);logger[_0x639a('0xd')](_0x639a('0x16'),_0x342e05,JSON['stringify'](_0x5302ec));_0x1a023b(_0x5302ec);})[_0x639a('0x11')](function(_0x3492d4){logger[_0x639a('0xe')](_0x639a('0x16'),_0x3492d4['message'],_0x342e05);_0x3624df(_0x34b4c8[_0x639a('0xe')](0x1f4,_0x3492d4[_0x639a('0xf')]));});});};