a0afd5185640a4d1ea00f6c6ef036d58266eb06a
[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 _0x4788=['VoiceAgentReport,\x20%s,\x20%s','request\x20sent','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateVoiceAgentReport','VoiceAgentReport','create','body','options','raw','then','UpdateVoiceAgentReport','update','where','attributes','limit','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info'];(function(_0x1c0f41,_0x26d95d){var _0x369a9f=function(_0x251234){while(--_0x251234){_0x1c0f41['push'](_0x1c0f41['shift']());}};_0x369a9f(++_0x26d95d);}(_0x4788,0x13e));var _0x8478=function(_0x208218,_0x3fc62e){_0x208218=_0x208218-0x0;var _0x4ecec8=_0x4788[_0x208218];return _0x4ecec8;};'use strict';var _=require(_0x8478('0x0'));var util=require(_0x8478('0x1'));var moment=require(_0x8478('0x2'));var BPromise=require('bluebird');var rs=require(_0x8478('0x3'));var fs=require('fs');var Redis=require(_0x8478('0x4'));var db=require(_0x8478('0x5'))['db'];var utils=require(_0x8478('0x6'));var logger=require(_0x8478('0x7'))(_0x8478('0x8'));var config=require(_0x8478('0x9'));var jayson=require(_0x8478('0xa'));var client=jayson[_0x8478('0xb')][_0x8478('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5dd28c,_0x42570d,_0xe93107){return new BPromise(function(_0x24ebd5,_0x903882){return client[_0x8478('0xd')](_0x5dd28c,_0xe93107)['then'](function(_0x3b00cd){logger[_0x8478('0xe')](_0x8478('0xf'),_0x42570d,_0x8478('0x10'));logger[_0x8478('0x11')](_0x8478('0x12'),_0x42570d,_0x8478('0x10'),JSON[_0x8478('0x13')](_0x3b00cd));if(_0x3b00cd[_0x8478('0x14')]){if(_0x3b00cd[_0x8478('0x14')][_0x8478('0x15')]===0x1f4){logger[_0x8478('0x14')](_0x8478('0xf'),_0x42570d,_0x3b00cd[_0x8478('0x14')][_0x8478('0x16')]);return _0x903882(_0x3b00cd[_0x8478('0x14')][_0x8478('0x16')]);}logger[_0x8478('0x14')](_0x8478('0xf'),_0x42570d,_0x3b00cd[_0x8478('0x14')][_0x8478('0x16')]);return _0x24ebd5(_0x3b00cd[_0x8478('0x14')][_0x8478('0x16')]);}else{logger['info'](_0x8478('0xf'),_0x42570d,_0x8478('0x10'));_0x24ebd5(_0x3b00cd[_0x8478('0x17')][_0x8478('0x16')]);}})[_0x8478('0x18')](function(_0x461384){logger[_0x8478('0x14')](_0x8478('0xf'),_0x42570d,_0x461384);_0x903882(_0x461384);});});}exports[_0x8478('0x19')]=function(_0x47a7ca){var _0x1f2299=this;return new Promise(function(_0x398675,_0x106475){return db[_0x8478('0x1a')][_0x8478('0x1b')](_0x47a7ca[_0x8478('0x1c')],{'raw':_0x47a7ca[_0x8478('0x1d')]?_0x47a7ca['options'][_0x8478('0x1e')]===undefined?!![]:![]:!![]})[_0x8478('0x1f')](function(_0x177454){logger['info'](_0x8478('0x19'),_0x47a7ca);logger[_0x8478('0x11')](_0x8478('0x19'),_0x47a7ca,JSON[_0x8478('0x13')](_0x177454));_0x398675(_0x177454);})[_0x8478('0x18')](function(_0x362bac){logger[_0x8478('0x14')](_0x8478('0x19'),_0x362bac[_0x8478('0x16')],_0x47a7ca);_0x106475(_0x1f2299[_0x8478('0x14')](0x1f4,_0x362bac['message']));});});};exports[_0x8478('0x20')]=function(_0x37efe6){var _0x55051d=this;return new Promise(function(_0x4e8a00,_0x210ff8){return db['VoiceAgentReport'][_0x8478('0x21')](_0x37efe6[_0x8478('0x1c')],{'raw':_0x37efe6[_0x8478('0x1d')]?_0x37efe6[_0x8478('0x1d')][_0x8478('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x37efe6['options']?_0x37efe6[_0x8478('0x1d')][_0x8478('0x22')]||null:null,'attributes':_0x37efe6[_0x8478('0x1d')]?_0x37efe6[_0x8478('0x1d')][_0x8478('0x23')]||null:null,'limit':_0x37efe6[_0x8478('0x1d')]?_0x37efe6[_0x8478('0x1d')][_0x8478('0x24')]||null:null})[_0x8478('0x1f')](function(_0x1239a3){logger[_0x8478('0xe')](_0x8478('0x20'),_0x37efe6);logger['debug'](_0x8478('0x20'),_0x37efe6,JSON[_0x8478('0x13')](_0x1239a3));_0x4e8a00(_0x1239a3);})[_0x8478('0x18')](function(_0x178145){logger['error']('UpdateVoiceAgentReport',_0x178145[_0x8478('0x16')],_0x37efe6);_0x210ff8(_0x55051d[_0x8478('0x14')](0x1f4,_0x178145[_0x8478('0x16')]));});});};