1f6cee494d5e79e58a701683eb522f6c365bebe3
[motion2.git] / server / api / voiceCallReport / voiceCallReport.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 _0xa929=['map','attributes','then','create','CreateVoiceCallReport','body','where','UpdateVoiceCallReport','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','info','VoiceCallReport,\x20%s,\x20%s','request\x20sent','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetVoiceCallReport','VoiceCallReport','findAll','options','raw','limit','include','model'];(function(_0x5b67db,_0x33c4f0){var _0x16b751=function(_0x416fcf){while(--_0x416fcf){_0x5b67db['push'](_0x5b67db['shift']());}};_0x16b751(++_0x33c4f0);}(_0xa929,0x1c0));var _0x9a92=function(_0x4b9bd0,_0x23b665){_0x4b9bd0=_0x4b9bd0-0x0;var _0x59d49f=_0xa929[_0x4b9bd0];return _0x59d49f;};'use strict';var _=require(_0x9a92('0x0'));var util=require(_0x9a92('0x1'));var moment=require(_0x9a92('0x2'));var BPromise=require(_0x9a92('0x3'));var rs=require(_0x9a92('0x4'));var fs=require('fs');var Redis=require(_0x9a92('0x5'));var db=require(_0x9a92('0x6'))['db'];var utils=require(_0x9a92('0x7'));var logger=require(_0x9a92('0x8'))(_0x9a92('0x9'));var config=require(_0x9a92('0xa'));var jayson=require('jayson/promise');var client=jayson['client'][_0x9a92('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x47ffaa,_0x26656b,_0x59f68f){return new BPromise(function(_0x1a12db,_0x509e86){return client[_0x9a92('0xc')](_0x47ffaa,_0x59f68f)['then'](function(_0x326ae2){logger[_0x9a92('0xd')](_0x9a92('0xe'),_0x26656b,_0x9a92('0xf'));logger[_0x9a92('0x10')](_0x9a92('0x11'),_0x26656b,_0x9a92('0xf'),JSON[_0x9a92('0x12')](_0x326ae2));if(_0x326ae2['error']){if(_0x326ae2[_0x9a92('0x13')][_0x9a92('0x14')]===0x1f4){logger[_0x9a92('0x13')]('VoiceCallReport,\x20%s,\x20%s',_0x26656b,_0x326ae2[_0x9a92('0x13')][_0x9a92('0x15')]);return _0x509e86(_0x326ae2['error'][_0x9a92('0x15')]);}logger['error']('VoiceCallReport,\x20%s,\x20%s',_0x26656b,_0x326ae2[_0x9a92('0x13')][_0x9a92('0x15')]);return _0x1a12db(_0x326ae2[_0x9a92('0x13')][_0x9a92('0x15')]);}else{logger[_0x9a92('0xd')](_0x9a92('0xe'),_0x26656b,'request\x20sent');_0x1a12db(_0x326ae2[_0x9a92('0x16')][_0x9a92('0x15')]);}})[_0x9a92('0x17')](function(_0x35d9fc){logger[_0x9a92('0x13')](_0x9a92('0xe'),_0x26656b,_0x35d9fc);_0x509e86(_0x35d9fc);});});}exports[_0x9a92('0x18')]=function(_0x323bf9){var _0x3c4fc0=this;return new Promise(function(_0x59f375,_0x487a07){return db[_0x9a92('0x19')][_0x9a92('0x1a')]({'raw':_0x323bf9[_0x9a92('0x1b')]?_0x323bf9[_0x9a92('0x1b')][_0x9a92('0x1c')]===undefined?!![]:![]:!![],'where':_0x323bf9[_0x9a92('0x1b')]?_0x323bf9[_0x9a92('0x1b')]['where']||null:null,'attributes':_0x323bf9[_0x9a92('0x1b')]?_0x323bf9[_0x9a92('0x1b')]['attributes']||null:null,'limit':_0x323bf9[_0x9a92('0x1b')]?_0x323bf9[_0x9a92('0x1b')][_0x9a92('0x1d')]||null:null,'include':_0x323bf9[_0x9a92('0x1b')]?_0x323bf9[_0x9a92('0x1b')][_0x9a92('0x1e')]?_['map'](_0x323bf9[_0x9a92('0x1b')][_0x9a92('0x1e')],function(_0x4af079){return{'model':db[_0x4af079[_0x9a92('0x1f')]],'as':_0x4af079['as'],'attributes':_0x4af079['attributes'],'include':_0x4af079[_0x9a92('0x1e')]?_[_0x9a92('0x20')](_0x4af079['include'],function(_0x4c44e2){return{'model':db[_0x4c44e2[_0x9a92('0x1f')]],'as':_0x4c44e2['as'],'attributes':_0x4c44e2[_0x9a92('0x21')],'include':_0x4c44e2['include']?_[_0x9a92('0x20')](_0x4c44e2['include'],function(_0x260d68){return{'model':db[_0x260d68[_0x9a92('0x1f')]],'as':_0x260d68['as'],'attributes':_0x260d68[_0x9a92('0x21')]};}):[]};}):[]};}):[]:[]})[_0x9a92('0x22')](function(_0x63e91f){logger[_0x9a92('0xd')](_0x9a92('0x18'),_0x323bf9);logger['debug'](_0x9a92('0x18'),_0x323bf9,JSON[_0x9a92('0x12')](_0x63e91f));_0x59f375(_0x63e91f);})[_0x9a92('0x17')](function(_0x3a197f){logger[_0x9a92('0x13')](_0x9a92('0x18'),_0x3a197f[_0x9a92('0x15')],_0x323bf9);_0x487a07(_0x3c4fc0[_0x9a92('0x13')](0x1f4,_0x3a197f[_0x9a92('0x15')]));});});};exports['CreateVoiceCallReport']=function(_0xd5959d){var _0x15df2b=this;return new Promise(function(_0x3cfeb1,_0x9727b3){return db[_0x9a92('0x19')][_0x9a92('0x23')](_0xd5959d['body'],{'raw':_0xd5959d['options']?_0xd5959d['options'][_0x9a92('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x53224c){logger[_0x9a92('0xd')](_0x9a92('0x24'),_0xd5959d);logger['debug'](_0x9a92('0x24'),_0xd5959d,JSON[_0x9a92('0x12')](_0x53224c));_0x3cfeb1(_0x53224c);})['catch'](function(_0x1bedc2){logger['error'](_0x9a92('0x24'),_0x1bedc2[_0x9a92('0x15')],_0xd5959d);_0x9727b3(_0x15df2b[_0x9a92('0x13')](0x1f4,_0x1bedc2[_0x9a92('0x15')]));});});};exports['UpdateVoiceCallReport']=function(_0x3fce73){var _0x41cc48=this;return new Promise(function(_0x4a3be7,_0xa2607a){return db[_0x9a92('0x19')]['update'](_0x3fce73[_0x9a92('0x25')],{'raw':_0x3fce73[_0x9a92('0x1b')]?_0x3fce73['options'][_0x9a92('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3fce73['options']?_0x3fce73[_0x9a92('0x1b')][_0x9a92('0x26')]||null:null,'attributes':_0x3fce73[_0x9a92('0x1b')]?_0x3fce73[_0x9a92('0x1b')]['attributes']||null:null,'limit':_0x3fce73['options']?_0x3fce73[_0x9a92('0x1b')][_0x9a92('0x1d')]||null:null})[_0x9a92('0x22')](function(_0x21db2a){logger[_0x9a92('0xd')]('UpdateVoiceCallReport',_0x3fce73);logger[_0x9a92('0x10')](_0x9a92('0x27'),_0x3fce73,JSON[_0x9a92('0x12')](_0x21db2a));_0x4a3be7(_0x21db2a);})[_0x9a92('0x17')](function(_0x2c1d75){logger[_0x9a92('0x13')](_0x9a92('0x27'),_0x2c1d75[_0x9a92('0x15')],_0x3fce73);_0xa2607a(_0x41cc48[_0x9a92('0x13')](0x1f4,_0x2c1d75[_0x9a92('0x15')]));});});};