e3bfa7685ab0f513c2e4642ca2abc5982ed0524b
[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 _0x89af=['VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceAgentReport,\x20%s,\x20%s','message','info','catch','VoiceAgentReport','create','options','raw','CreateVoiceAgentReport','UpdateVoiceAgentReport','update','body','where','attributes','limit','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','request','then','request\x20sent','debug'];(function(_0x3de7aa,_0x25bcc7){var _0x57f554=function(_0x126e4b){while(--_0x126e4b){_0x3de7aa['push'](_0x3de7aa['shift']());}};_0x57f554(++_0x25bcc7);}(_0x89af,0xde));var _0xf89a=function(_0x27f6a6,_0x1959a0){_0x27f6a6=_0x27f6a6-0x0;var _0x485ab9=_0x89af[_0x27f6a6];return _0x485ab9;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xf89a('0x0'));var BPromise=require(_0xf89a('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf89a('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0xf89a('0x3'))(_0xf89a('0x4'));var config=require(_0xf89a('0x5'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x8590ab,_0x599bf0,_0x2c87cb){return new BPromise(function(_0x9961f0,_0xd28369){return client[_0xf89a('0x6')](_0x8590ab,_0x2c87cb)[_0xf89a('0x7')](function(_0x1f30d3){logger['info']('VoiceAgentReport,\x20%s,\x20%s',_0x599bf0,_0xf89a('0x8'));logger[_0xf89a('0x9')](_0xf89a('0xa'),_0x599bf0,_0xf89a('0x8'),JSON[_0xf89a('0xb')](_0x1f30d3));if(_0x1f30d3[_0xf89a('0xc')]){if(_0x1f30d3[_0xf89a('0xc')][_0xf89a('0xd')]===0x1f4){logger['error'](_0xf89a('0xe'),_0x599bf0,_0x1f30d3['error'][_0xf89a('0xf')]);return _0xd28369(_0x1f30d3[_0xf89a('0xc')][_0xf89a('0xf')]);}logger['error'](_0xf89a('0xe'),_0x599bf0,_0x1f30d3['error'][_0xf89a('0xf')]);return _0x9961f0(_0x1f30d3[_0xf89a('0xc')][_0xf89a('0xf')]);}else{logger[_0xf89a('0x10')](_0xf89a('0xe'),_0x599bf0,_0xf89a('0x8'));_0x9961f0(_0x1f30d3['result'][_0xf89a('0xf')]);}})[_0xf89a('0x11')](function(_0x250601){logger[_0xf89a('0xc')](_0xf89a('0xe'),_0x599bf0,_0x250601);_0xd28369(_0x250601);});});}exports['CreateVoiceAgentReport']=function(_0x585448){var _0x1cd988=this;return new Promise(function(_0x1e5e1d,_0x3585dc){return db[_0xf89a('0x12')][_0xf89a('0x13')](_0x585448['body'],{'raw':_0x585448[_0xf89a('0x14')]?_0x585448[_0xf89a('0x14')][_0xf89a('0x15')]===undefined?!![]:![]:!![]})['then'](function(_0x549b42){logger[_0xf89a('0x10')](_0xf89a('0x16'),_0x585448);logger[_0xf89a('0x9')](_0xf89a('0x16'),_0x585448,JSON['stringify'](_0x549b42));_0x1e5e1d(_0x549b42);})[_0xf89a('0x11')](function(_0x5742eb){logger['error'](_0xf89a('0x16'),_0x5742eb[_0xf89a('0xf')],_0x585448);_0x3585dc(_0x1cd988[_0xf89a('0xc')](0x1f4,_0x5742eb[_0xf89a('0xf')]));});});};exports[_0xf89a('0x17')]=function(_0x53e526){var _0xb425a6=this;return new Promise(function(_0x25a07f,_0x2cc9aa){return db[_0xf89a('0x12')][_0xf89a('0x18')](_0x53e526[_0xf89a('0x19')],{'raw':_0x53e526[_0xf89a('0x14')]?_0x53e526[_0xf89a('0x14')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x53e526[_0xf89a('0x14')]?_0x53e526[_0xf89a('0x14')][_0xf89a('0x1a')]||null:null,'attributes':_0x53e526[_0xf89a('0x14')]?_0x53e526[_0xf89a('0x14')][_0xf89a('0x1b')]||null:null,'limit':_0x53e526[_0xf89a('0x14')]?_0x53e526[_0xf89a('0x14')][_0xf89a('0x1c')]||null:null})[_0xf89a('0x7')](function(_0x42b978){logger[_0xf89a('0x10')](_0xf89a('0x17'),_0x53e526);logger[_0xf89a('0x9')]('UpdateVoiceAgentReport',_0x53e526,JSON[_0xf89a('0xb')](_0x42b978));_0x25a07f(_0x42b978);})[_0xf89a('0x11')](function(_0xaba7ba){logger['error']('UpdateVoiceAgentReport',_0xaba7ba[_0xf89a('0xf')],_0x53e526);_0x2cc9aa(_0xb425a6[_0xf89a('0xc')](0x1f4,_0xaba7ba['message']));});});};