Built motion from commit (unavailable).|2.5.17
[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 _0xe47b=['lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','VoiceAgentReport,\x20%s,\x20%s,\x20%s','error','code','VoiceAgentReport,\x20%s,\x20%s','message','result','catch','VoiceAgentReport','create','body','options','debug','stringify','CreateVoiceAgentReport','UpdateVoiceAgentReport','update','where','attributes','limit'];(function(_0x52523c,_0x25ebc2){var _0x2e01cb=function(_0x26b8fb){while(--_0x26b8fb){_0x52523c['push'](_0x52523c['shift']());}};_0x2e01cb(++_0x25ebc2);}(_0xe47b,0x8c));var _0xbe47=function(_0x18f0b5,_0x19f113){_0x18f0b5=_0x18f0b5-0x0;var _0x1883c7=_0xe47b[_0x18f0b5];return _0x1883c7;};'use strict';var _=require(_0xbe47('0x0'));var util=require(_0xbe47('0x1'));var moment=require('moment');var BPromise=require(_0xbe47('0x2'));var rs=require(_0xbe47('0x3'));var fs=require('fs');var Redis=require(_0xbe47('0x4'));var db=require(_0xbe47('0x5'))['db'];var utils=require(_0xbe47('0x6'));var logger=require(_0xbe47('0x7'))('rpc');var config=require(_0xbe47('0x8'));var jayson=require(_0xbe47('0x9'));var client=jayson[_0xbe47('0xa')][_0xbe47('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xc5260e,_0x41d917,_0x2ca8a5){return new BPromise(function(_0xf3c45f,_0x294c79){return client[_0xbe47('0xc')](_0xc5260e,_0x2ca8a5)[_0xbe47('0xd')](function(_0x4555fd){logger[_0xbe47('0xe')]('VoiceAgentReport,\x20%s,\x20%s',_0x41d917,_0xbe47('0xf'));logger['debug'](_0xbe47('0x10'),_0x41d917,_0xbe47('0xf'),JSON['stringify'](_0x4555fd));if(_0x4555fd[_0xbe47('0x11')]){if(_0x4555fd[_0xbe47('0x11')][_0xbe47('0x12')]===0x1f4){logger[_0xbe47('0x11')](_0xbe47('0x13'),_0x41d917,_0x4555fd[_0xbe47('0x11')][_0xbe47('0x14')]);return _0x294c79(_0x4555fd[_0xbe47('0x11')][_0xbe47('0x14')]);}logger['error']('VoiceAgentReport,\x20%s,\x20%s',_0x41d917,_0x4555fd['error'][_0xbe47('0x14')]);return _0xf3c45f(_0x4555fd[_0xbe47('0x11')][_0xbe47('0x14')]);}else{logger[_0xbe47('0xe')](_0xbe47('0x13'),_0x41d917,_0xbe47('0xf'));_0xf3c45f(_0x4555fd[_0xbe47('0x15')][_0xbe47('0x14')]);}})[_0xbe47('0x16')](function(_0x217a70){logger[_0xbe47('0x11')](_0xbe47('0x13'),_0x41d917,_0x217a70);_0x294c79(_0x217a70);});});}exports['CreateVoiceAgentReport']=function(_0x20a82e){var _0x3a3567=this;return new Promise(function(_0x3083fd,_0x2f9353){return db[_0xbe47('0x17')][_0xbe47('0x18')](_0x20a82e[_0xbe47('0x19')],{'raw':_0x20a82e[_0xbe47('0x1a')]?_0x20a82e[_0xbe47('0x1a')]['raw']===undefined?!![]:![]:!![]})[_0xbe47('0xd')](function(_0x147173){logger['info']('CreateVoiceAgentReport',_0x20a82e);logger[_0xbe47('0x1b')]('CreateVoiceAgentReport',_0x20a82e,JSON[_0xbe47('0x1c')](_0x147173));_0x3083fd(_0x147173);})[_0xbe47('0x16')](function(_0x39e285){logger[_0xbe47('0x11')](_0xbe47('0x1d'),_0x39e285[_0xbe47('0x14')],_0x20a82e);_0x2f9353(_0x3a3567[_0xbe47('0x11')](0x1f4,_0x39e285[_0xbe47('0x14')]));});});};exports[_0xbe47('0x1e')]=function(_0x4fcbbe){var _0x4507d1=this;return new Promise(function(_0x4a390a,_0x3b4a2c){return db['VoiceAgentReport'][_0xbe47('0x1f')](_0x4fcbbe['body'],{'raw':_0x4fcbbe[_0xbe47('0x1a')]?_0x4fcbbe[_0xbe47('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4fcbbe['options']?_0x4fcbbe['options'][_0xbe47('0x20')]||null:null,'attributes':_0x4fcbbe['options']?_0x4fcbbe[_0xbe47('0x1a')][_0xbe47('0x21')]||null:null,'limit':_0x4fcbbe['options']?_0x4fcbbe[_0xbe47('0x1a')][_0xbe47('0x22')]||null:null})['then'](function(_0x393457){logger['info'](_0xbe47('0x1e'),_0x4fcbbe);logger[_0xbe47('0x1b')](_0xbe47('0x1e'),_0x4fcbbe,JSON['stringify'](_0x393457));_0x4a390a(_0x393457);})['catch'](function(_0x26a4b9){logger[_0xbe47('0x11')]('UpdateVoiceAgentReport',_0x26a4b9[_0xbe47('0x14')],_0x4fcbbe);_0x3b4a2c(_0x4507d1[_0xbe47('0x11')](0x1f4,_0x26a4b9[_0xbe47('0x14')]));});});};