Built motion from commit (unavailable).|2.4.20
[motion2.git] / server / api / voiceDialReport / voiceDialReport.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 _0x1c42=['debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','error','code','message','catch','CreateVoiceDialReport','VoiceDialReport','create','body','options','raw','UpdateVoiceDialReport','update','where','attributes','stringify','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','VoiceDialReport,\x20%s,\x20%s','request\x20sent'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x1c42,0x13a));var _0x21c4=function(_0x544f5e,_0x2d6ad6){_0x544f5e=_0x544f5e-0x0;var _0x177018=_0x1c42[_0x544f5e];return _0x177018;};'use strict';var _=require('lodash');var util=require(_0x21c4('0x0'));var moment=require(_0x21c4('0x1'));var BPromise=require(_0x21c4('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x21c4('0x3'));var db=require(_0x21c4('0x4'))['db'];var utils=require(_0x21c4('0x5'));var logger=require(_0x21c4('0x6'))(_0x21c4('0x7'));var config=require(_0x21c4('0x8'));var jayson=require(_0x21c4('0x9'));var client=jayson[_0x21c4('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x247ec9,_0x472df1,_0x54b2ea){return new BPromise(function(_0x184e75,_0x57e04f){return client[_0x21c4('0xb')](_0x247ec9,_0x54b2ea)[_0x21c4('0xc')](function(_0x1fac06){logger[_0x21c4('0xd')](_0x21c4('0xe'),_0x472df1,_0x21c4('0xf'));logger[_0x21c4('0x10')](_0x21c4('0x11'),_0x472df1,_0x21c4('0xf'),JSON['stringify'](_0x1fac06));if(_0x1fac06[_0x21c4('0x12')]){if(_0x1fac06['error'][_0x21c4('0x13')]===0x1f4){logger['error'](_0x21c4('0xe'),_0x472df1,_0x1fac06[_0x21c4('0x12')][_0x21c4('0x14')]);return _0x57e04f(_0x1fac06[_0x21c4('0x12')][_0x21c4('0x14')]);}logger[_0x21c4('0x12')](_0x21c4('0xe'),_0x472df1,_0x1fac06[_0x21c4('0x12')][_0x21c4('0x14')]);return _0x184e75(_0x1fac06[_0x21c4('0x12')][_0x21c4('0x14')]);}else{logger[_0x21c4('0xd')](_0x21c4('0xe'),_0x472df1,'request\x20sent');_0x184e75(_0x1fac06['result'][_0x21c4('0x14')]);}})[_0x21c4('0x15')](function(_0x230dce){logger[_0x21c4('0x12')](_0x21c4('0xe'),_0x472df1,_0x230dce);_0x57e04f(_0x230dce);});});}exports[_0x21c4('0x16')]=function(_0x38fa2b){var _0x9cd43c=this;return new Promise(function(_0x2309f6,_0x113604){return db[_0x21c4('0x17')][_0x21c4('0x18')](_0x38fa2b[_0x21c4('0x19')],{'raw':_0x38fa2b[_0x21c4('0x1a')]?_0x38fa2b[_0x21c4('0x1a')][_0x21c4('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x4ad6ed){logger[_0x21c4('0xd')](_0x21c4('0x16'),_0x38fa2b);logger['debug'](_0x21c4('0x16'),_0x38fa2b,JSON['stringify'](_0x4ad6ed));_0x2309f6(_0x4ad6ed);})[_0x21c4('0x15')](function(_0x3c1998){logger[_0x21c4('0x12')](_0x21c4('0x16'),_0x3c1998[_0x21c4('0x14')],_0x38fa2b);_0x113604(_0x9cd43c[_0x21c4('0x12')](0x1f4,_0x3c1998[_0x21c4('0x14')]));});});};exports[_0x21c4('0x1c')]=function(_0x6f53ae){var _0x58c25f=this;return new Promise(function(_0x48abbc,_0x159fb0){return db['VoiceDialReport'][_0x21c4('0x1d')](_0x6f53ae[_0x21c4('0x19')],{'raw':_0x6f53ae[_0x21c4('0x1a')]?_0x6f53ae[_0x21c4('0x1a')][_0x21c4('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x6f53ae[_0x21c4('0x1a')]?_0x6f53ae['options'][_0x21c4('0x1e')]||null:null,'attributes':_0x6f53ae[_0x21c4('0x1a')]?_0x6f53ae['options'][_0x21c4('0x1f')]||null:null,'limit':_0x6f53ae[_0x21c4('0x1a')]?_0x6f53ae[_0x21c4('0x1a')]['limit']||null:null})['then'](function(_0x469888){logger[_0x21c4('0xd')](_0x21c4('0x1c'),_0x6f53ae);logger[_0x21c4('0x10')](_0x21c4('0x1c'),_0x6f53ae,JSON[_0x21c4('0x20')](_0x469888));_0x48abbc(_0x469888);})['catch'](function(_0x5017ac){logger['error'](_0x21c4('0x1c'),_0x5017ac['message'],_0x6f53ae);_0x159fb0(_0x58c25f['error'](0x1f4,_0x5017ac['message']));});});};