Built motion from commit 3a7e82ea.|2.6.29
[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 _0x6c8a=['info','request\x20sent','debug','stringify','error','code','VoiceAgentReport,\x20%s,\x20%s','message','result','CreateVoiceAgentReport','options','raw','catch','UpdateVoiceAgentReport','VoiceAgentReport','body','where','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then'];(function(_0x3a710f,_0x3509a8){var _0x11e9fc=function(_0x122165){while(--_0x122165){_0x3a710f['push'](_0x3a710f['shift']());}};_0x11e9fc(++_0x3509a8);}(_0x6c8a,0x92));var _0xa6c8=function(_0x13f8ac,_0x5c892){_0x13f8ac=_0x13f8ac-0x0;var _0x241192=_0x6c8a[_0x13f8ac];return _0x241192;};'use strict';var _=require(_0xa6c8('0x0'));var util=require(_0xa6c8('0x1'));var moment=require(_0xa6c8('0x2'));var BPromise=require(_0xa6c8('0x3'));var rs=require(_0xa6c8('0x4'));var fs=require('fs');var Redis=require(_0xa6c8('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xa6c8('0x6'));var logger=require(_0xa6c8('0x7'))(_0xa6c8('0x8'));var config=require(_0xa6c8('0x9'));var jayson=require(_0xa6c8('0xa'));var client=jayson[_0xa6c8('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3bdbd0,_0x4e7c69,_0x2dd8b6){return new BPromise(function(_0x81d6e6,_0x1c33fb){return client[_0xa6c8('0xc')](_0x3bdbd0,_0x2dd8b6)[_0xa6c8('0xd')](function(_0x180c5c){logger[_0xa6c8('0xe')]('VoiceAgentReport,\x20%s,\x20%s',_0x4e7c69,_0xa6c8('0xf'));logger[_0xa6c8('0x10')]('VoiceAgentReport,\x20%s,\x20%s,\x20%s',_0x4e7c69,_0xa6c8('0xf'),JSON[_0xa6c8('0x11')](_0x180c5c));if(_0x180c5c[_0xa6c8('0x12')]){if(_0x180c5c[_0xa6c8('0x12')][_0xa6c8('0x13')]===0x1f4){logger[_0xa6c8('0x12')](_0xa6c8('0x14'),_0x4e7c69,_0x180c5c[_0xa6c8('0x12')][_0xa6c8('0x15')]);return _0x1c33fb(_0x180c5c['error']['message']);}logger[_0xa6c8('0x12')]('VoiceAgentReport,\x20%s,\x20%s',_0x4e7c69,_0x180c5c[_0xa6c8('0x12')][_0xa6c8('0x15')]);return _0x81d6e6(_0x180c5c[_0xa6c8('0x12')][_0xa6c8('0x15')]);}else{logger['info'](_0xa6c8('0x14'),_0x4e7c69,_0xa6c8('0xf'));_0x81d6e6(_0x180c5c[_0xa6c8('0x16')][_0xa6c8('0x15')]);}})['catch'](function(_0x3dddf6){logger[_0xa6c8('0x12')](_0xa6c8('0x14'),_0x4e7c69,_0x3dddf6);_0x1c33fb(_0x3dddf6);});});}exports[_0xa6c8('0x17')]=function(_0x3eb894){var _0x3bf601=this;return new Promise(function(_0x379253,_0x521740){return db['VoiceAgentReport']['create'](_0x3eb894['body'],{'raw':_0x3eb894[_0xa6c8('0x18')]?_0x3eb894[_0xa6c8('0x18')][_0xa6c8('0x19')]===undefined?!![]:![]:!![]})[_0xa6c8('0xd')](function(_0x3d7798){logger[_0xa6c8('0xe')](_0xa6c8('0x17'),_0x3eb894);logger[_0xa6c8('0x10')]('CreateVoiceAgentReport',_0x3eb894,JSON[_0xa6c8('0x11')](_0x3d7798));_0x379253(_0x3d7798);})[_0xa6c8('0x1a')](function(_0x4bb4ac){logger['error'](_0xa6c8('0x17'),_0x4bb4ac[_0xa6c8('0x15')],_0x3eb894);_0x521740(_0x3bf601[_0xa6c8('0x12')](0x1f4,_0x4bb4ac[_0xa6c8('0x15')]));});});};exports[_0xa6c8('0x1b')]=function(_0x1f505b){var _0x273f6d=this;return new Promise(function(_0xc80729,_0x2ba2cc){return db[_0xa6c8('0x1c')]['update'](_0x1f505b[_0xa6c8('0x1d')],{'raw':_0x1f505b[_0xa6c8('0x18')]?_0x1f505b[_0xa6c8('0x18')][_0xa6c8('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1f505b[_0xa6c8('0x18')]?_0x1f505b['options'][_0xa6c8('0x1e')]||null:null,'attributes':_0x1f505b[_0xa6c8('0x18')]?_0x1f505b[_0xa6c8('0x18')]['attributes']||null:null,'limit':_0x1f505b[_0xa6c8('0x18')]?_0x1f505b['options'][_0xa6c8('0x1f')]||null:null})[_0xa6c8('0xd')](function(_0x1f8fe4){logger[_0xa6c8('0xe')](_0xa6c8('0x1b'),_0x1f505b);logger['debug'](_0xa6c8('0x1b'),_0x1f505b,JSON[_0xa6c8('0x11')](_0x1f8fe4));_0xc80729(_0x1f8fe4);})[_0xa6c8('0x1a')](function(_0x4b1c19){logger[_0xa6c8('0x12')](_0xa6c8('0x1b'),_0x4b1c19[_0xa6c8('0x15')],_0x1f505b);_0x2ba2cc(_0x273f6d[_0xa6c8('0x12')](0x1f4,_0x4b1c19[_0xa6c8('0x15')]));});});};