Built motion from commit 746c7d2a.|2.5.35
[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 _0xb8fc=['attributes','limit','include','map','model','CreateVoiceCallReport','create','update','body','UpdateVoiceCallReport','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','VoiceCallReport,\x20%s,\x20%s','request\x20sent','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetVoiceCallReport','VoiceCallReport','options','where'];(function(_0x4d770a,_0x4bd9ca){var _0x154cac=function(_0x2e8e1d){while(--_0x2e8e1d){_0x4d770a['push'](_0x4d770a['shift']());}};_0x154cac(++_0x4bd9ca);}(_0xb8fc,0x186));var _0xcb8f=function(_0x38d034,_0x22f267){_0x38d034=_0x38d034-0x0;var _0x1a3768=_0xb8fc[_0x38d034];return _0x1a3768;};'use strict';var _=require(_0xcb8f('0x0'));var util=require(_0xcb8f('0x1'));var moment=require(_0xcb8f('0x2'));var BPromise=require(_0xcb8f('0x3'));var rs=require(_0xcb8f('0x4'));var fs=require('fs');var Redis=require(_0xcb8f('0x5'));var db=require(_0xcb8f('0x6'))['db'];var utils=require(_0xcb8f('0x7'));var logger=require(_0xcb8f('0x8'))(_0xcb8f('0x9'));var config=require('../../config/environment');var jayson=require(_0xcb8f('0xa'));var client=jayson['client'][_0xcb8f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x468a7d,_0x437c0d,_0x163a92){return new BPromise(function(_0x48ca55,_0x32a6e5){return client[_0xcb8f('0xc')](_0x468a7d,_0x163a92)[_0xcb8f('0xd')](function(_0x1691c3){logger[_0xcb8f('0xe')](_0xcb8f('0xf'),_0x437c0d,_0xcb8f('0x10'));logger[_0xcb8f('0x11')](_0xcb8f('0x12'),_0x437c0d,_0xcb8f('0x10'),JSON[_0xcb8f('0x13')](_0x1691c3));if(_0x1691c3[_0xcb8f('0x14')]){if(_0x1691c3['error'][_0xcb8f('0x15')]===0x1f4){logger['error'](_0xcb8f('0xf'),_0x437c0d,_0x1691c3[_0xcb8f('0x14')][_0xcb8f('0x16')]);return _0x32a6e5(_0x1691c3[_0xcb8f('0x14')][_0xcb8f('0x16')]);}logger[_0xcb8f('0x14')]('VoiceCallReport,\x20%s,\x20%s',_0x437c0d,_0x1691c3[_0xcb8f('0x14')][_0xcb8f('0x16')]);return _0x48ca55(_0x1691c3['error'][_0xcb8f('0x16')]);}else{logger[_0xcb8f('0xe')](_0xcb8f('0xf'),_0x437c0d,_0xcb8f('0x10'));_0x48ca55(_0x1691c3['result']['message']);}})[_0xcb8f('0x17')](function(_0x4ede6e){logger[_0xcb8f('0x14')](_0xcb8f('0xf'),_0x437c0d,_0x4ede6e);_0x32a6e5(_0x4ede6e);});});}exports[_0xcb8f('0x18')]=function(_0xa623c){var _0x338bb6=this;return new Promise(function(_0x1b273e,_0x124d68){return db[_0xcb8f('0x19')]['findAll']({'raw':_0xa623c[_0xcb8f('0x1a')]?_0xa623c[_0xcb8f('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0xa623c[_0xcb8f('0x1a')]?_0xa623c[_0xcb8f('0x1a')][_0xcb8f('0x1b')]||null:null,'attributes':_0xa623c[_0xcb8f('0x1a')]?_0xa623c[_0xcb8f('0x1a')][_0xcb8f('0x1c')]||null:null,'limit':_0xa623c[_0xcb8f('0x1a')]?_0xa623c[_0xcb8f('0x1a')][_0xcb8f('0x1d')]||null:null,'include':_0xa623c[_0xcb8f('0x1a')]?_0xa623c[_0xcb8f('0x1a')][_0xcb8f('0x1e')]?_[_0xcb8f('0x1f')](_0xa623c[_0xcb8f('0x1a')][_0xcb8f('0x1e')],function(_0x4e2b6f){return{'model':db[_0x4e2b6f[_0xcb8f('0x20')]],'as':_0x4e2b6f['as'],'attributes':_0x4e2b6f[_0xcb8f('0x1c')],'include':_0x4e2b6f[_0xcb8f('0x1e')]?_['map'](_0x4e2b6f[_0xcb8f('0x1e')],function(_0x57580d){return{'model':db[_0x57580d[_0xcb8f('0x20')]],'as':_0x57580d['as'],'attributes':_0x57580d[_0xcb8f('0x1c')],'include':_0x57580d[_0xcb8f('0x1e')]?_['map'](_0x57580d[_0xcb8f('0x1e')],function(_0x18633b){return{'model':db[_0x18633b[_0xcb8f('0x20')]],'as':_0x18633b['as'],'attributes':_0x18633b[_0xcb8f('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xcb8f('0xd')](function(_0x3068f4){logger[_0xcb8f('0xe')]('GetVoiceCallReport',_0xa623c);logger['debug']('GetVoiceCallReport',_0xa623c,JSON['stringify'](_0x3068f4));_0x1b273e(_0x3068f4);})['catch'](function(_0x4d41c3){logger['error'](_0xcb8f('0x18'),_0x4d41c3[_0xcb8f('0x16')],_0xa623c);_0x124d68(_0x338bb6['error'](0x1f4,_0x4d41c3['message']));});});};exports[_0xcb8f('0x21')]=function(_0x3e3acc){var _0x319b82=this;return new Promise(function(_0x58a0d8,_0x54dcd){return db[_0xcb8f('0x19')][_0xcb8f('0x22')](_0x3e3acc['body'],{'raw':_0x3e3acc['options']?_0x3e3acc['options']['raw']===undefined?!![]:![]:!![]})['then'](function(_0x82aff4){logger['info']('CreateVoiceCallReport',_0x3e3acc);logger[_0xcb8f('0x11')](_0xcb8f('0x21'),_0x3e3acc,JSON[_0xcb8f('0x13')](_0x82aff4));_0x58a0d8(_0x82aff4);})[_0xcb8f('0x17')](function(_0x1ab70c){logger[_0xcb8f('0x14')]('CreateVoiceCallReport',_0x1ab70c[_0xcb8f('0x16')],_0x3e3acc);_0x54dcd(_0x319b82['error'](0x1f4,_0x1ab70c[_0xcb8f('0x16')]));});});};exports['UpdateVoiceCallReport']=function(_0x260242){var _0x322f0a=this;return new Promise(function(_0x908c67,_0x1cfab5){return db['VoiceCallReport'][_0xcb8f('0x23')](_0x260242[_0xcb8f('0x24')],{'raw':_0x260242[_0xcb8f('0x1a')]?_0x260242['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x260242['options']?_0x260242[_0xcb8f('0x1a')][_0xcb8f('0x1b')]||null:null,'attributes':_0x260242['options']?_0x260242[_0xcb8f('0x1a')][_0xcb8f('0x1c')]||null:null,'limit':_0x260242['options']?_0x260242['options'][_0xcb8f('0x1d')]||null:null})[_0xcb8f('0xd')](function(_0x4cda55){logger[_0xcb8f('0xe')](_0xcb8f('0x25'),_0x260242);logger[_0xcb8f('0x11')](_0xcb8f('0x25'),_0x260242,JSON['stringify'](_0x4cda55));_0x908c67(_0x4cda55);})['catch'](function(_0x4105f7){logger[_0xcb8f('0x14')](_0xcb8f('0x25'),_0x4105f7[_0xcb8f('0x16')],_0x260242);_0x1cfab5(_0x322f0a[_0xcb8f('0x14')](0x1f4,_0x4105f7[_0xcb8f('0x16')]));});});};