Built motion from commit db94841.|2.5.3
[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 _0x66b3=['code','message','VoiceCallReport,\x20%s,\x20%s','result','catch','GetVoiceCallReport','findAll','options','raw','where','attributes','limit','map','include','model','CreateVoiceCallReport','create','body','UpdateVoiceCallReport','VoiceCallReport','update','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x68ee8b,_0x3cc6c5){var _0x5148f7=function(_0x5dcbd5){while(--_0x5dcbd5){_0x68ee8b['push'](_0x68ee8b['shift']());}};_0x5148f7(++_0x3cc6c5);}(_0x66b3,0xe2));var _0x366b=function(_0x3bed34,_0x18b845){_0x3bed34=_0x3bed34-0x0;var _0x48de0c=_0x66b3[_0x3bed34];return _0x48de0c;};'use strict';var _=require(_0x366b('0x0'));var util=require(_0x366b('0x1'));var moment=require(_0x366b('0x2'));var BPromise=require(_0x366b('0x3'));var rs=require(_0x366b('0x4'));var fs=require('fs');var Redis=require(_0x366b('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x366b('0x6'));var logger=require(_0x366b('0x7'))(_0x366b('0x8'));var config=require('../../config/environment');var jayson=require(_0x366b('0x9'));var client=jayson[_0x366b('0xa')][_0x366b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1c86b4,_0x5e4a8e,_0x222841){return new BPromise(function(_0x178eb4,_0x373d95){return client[_0x366b('0xc')](_0x1c86b4,_0x222841)[_0x366b('0xd')](function(_0x37efa8){logger[_0x366b('0xe')]('VoiceCallReport,\x20%s,\x20%s',_0x5e4a8e,'request\x20sent');logger[_0x366b('0xf')](_0x366b('0x10'),_0x5e4a8e,_0x366b('0x11'),JSON[_0x366b('0x12')](_0x37efa8));if(_0x37efa8[_0x366b('0x13')]){if(_0x37efa8[_0x366b('0x13')][_0x366b('0x14')]===0x1f4){logger['error']('VoiceCallReport,\x20%s,\x20%s',_0x5e4a8e,_0x37efa8[_0x366b('0x13')][_0x366b('0x15')]);return _0x373d95(_0x37efa8['error'][_0x366b('0x15')]);}logger[_0x366b('0x13')](_0x366b('0x16'),_0x5e4a8e,_0x37efa8[_0x366b('0x13')]['message']);return _0x178eb4(_0x37efa8[_0x366b('0x13')][_0x366b('0x15')]);}else{logger[_0x366b('0xe')](_0x366b('0x16'),_0x5e4a8e,_0x366b('0x11'));_0x178eb4(_0x37efa8[_0x366b('0x17')][_0x366b('0x15')]);}})[_0x366b('0x18')](function(_0x395b8a){logger[_0x366b('0x13')](_0x366b('0x16'),_0x5e4a8e,_0x395b8a);_0x373d95(_0x395b8a);});});}exports[_0x366b('0x19')]=function(_0xac752d){var _0x48019e=this;return new Promise(function(_0x3d544f,_0x19bfe8){return db['VoiceCallReport'][_0x366b('0x1a')]({'raw':_0xac752d[_0x366b('0x1b')]?_0xac752d['options'][_0x366b('0x1c')]===undefined?!![]:![]:!![],'where':_0xac752d[_0x366b('0x1b')]?_0xac752d['options'][_0x366b('0x1d')]||null:null,'attributes':_0xac752d[_0x366b('0x1b')]?_0xac752d[_0x366b('0x1b')][_0x366b('0x1e')]||null:null,'limit':_0xac752d[_0x366b('0x1b')]?_0xac752d[_0x366b('0x1b')][_0x366b('0x1f')]||null:null,'include':_0xac752d[_0x366b('0x1b')]?_0xac752d[_0x366b('0x1b')]['include']?_[_0x366b('0x20')](_0xac752d[_0x366b('0x1b')][_0x366b('0x21')],function(_0x4e9206){return{'model':db[_0x4e9206[_0x366b('0x22')]],'as':_0x4e9206['as'],'attributes':_0x4e9206['attributes'],'include':_0x4e9206[_0x366b('0x21')]?_[_0x366b('0x20')](_0x4e9206[_0x366b('0x21')],function(_0x4585c4){return{'model':db[_0x4585c4['model']],'as':_0x4585c4['as'],'attributes':_0x4585c4[_0x366b('0x1e')],'include':_0x4585c4['include']?_[_0x366b('0x20')](_0x4585c4[_0x366b('0x21')],function(_0x2c0c91){return{'model':db[_0x2c0c91['model']],'as':_0x2c0c91['as'],'attributes':_0x2c0c91[_0x366b('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x366b('0xd')](function(_0x320945){logger[_0x366b('0xe')](_0x366b('0x19'),_0xac752d);logger[_0x366b('0xf')](_0x366b('0x19'),_0xac752d,JSON['stringify'](_0x320945));_0x3d544f(_0x320945);})[_0x366b('0x18')](function(_0x56f5bc){logger[_0x366b('0x13')](_0x366b('0x19'),_0x56f5bc[_0x366b('0x15')],_0xac752d);_0x19bfe8(_0x48019e[_0x366b('0x13')](0x1f4,_0x56f5bc[_0x366b('0x15')]));});});};exports[_0x366b('0x23')]=function(_0x27ba0a){var _0x5ccee0=this;return new Promise(function(_0x5e7cce,_0x695c35){return db['VoiceCallReport'][_0x366b('0x24')](_0x27ba0a[_0x366b('0x25')],{'raw':_0x27ba0a[_0x366b('0x1b')]?_0x27ba0a[_0x366b('0x1b')]['raw']===undefined?!![]:![]:!![]})[_0x366b('0xd')](function(_0x4c39f7){logger[_0x366b('0xe')](_0x366b('0x23'),_0x27ba0a);logger[_0x366b('0xf')](_0x366b('0x23'),_0x27ba0a,JSON[_0x366b('0x12')](_0x4c39f7));_0x5e7cce(_0x4c39f7);})[_0x366b('0x18')](function(_0x53f333){logger[_0x366b('0x13')]('CreateVoiceCallReport',_0x53f333[_0x366b('0x15')],_0x27ba0a);_0x695c35(_0x5ccee0['error'](0x1f4,_0x53f333[_0x366b('0x15')]));});});};exports[_0x366b('0x26')]=function(_0x24d0d9){var _0x1f13d6=this;return new Promise(function(_0x2ba28e,_0xc5da90){return db[_0x366b('0x27')][_0x366b('0x28')](_0x24d0d9[_0x366b('0x25')],{'raw':_0x24d0d9[_0x366b('0x1b')]?_0x24d0d9[_0x366b('0x1b')][_0x366b('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x24d0d9[_0x366b('0x1b')]?_0x24d0d9[_0x366b('0x1b')]['where']||null:null,'attributes':_0x24d0d9[_0x366b('0x1b')]?_0x24d0d9[_0x366b('0x1b')][_0x366b('0x1e')]||null:null,'limit':_0x24d0d9[_0x366b('0x1b')]?_0x24d0d9[_0x366b('0x1b')][_0x366b('0x1f')]||null:null})[_0x366b('0xd')](function(_0x19377e){logger['info'](_0x366b('0x26'),_0x24d0d9);logger[_0x366b('0xf')](_0x366b('0x26'),_0x24d0d9,JSON['stringify'](_0x19377e));_0x2ba28e(_0x19377e);})[_0x366b('0x18')](function(_0x10b502){logger[_0x366b('0x13')](_0x366b('0x26'),_0x10b502[_0x366b('0x15')],_0x24d0d9);_0xc5da90(_0x1f13d6[_0x366b('0x13')](0x1f4,_0x10b502[_0x366b('0x15')]));});});};