Built motion from commit (unavailable).|2.5.2
[motion2.git] / server / api / openchannelQueueReport / openchannelQueueReport.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 _0x34bd=['debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateOpenchannelQueueReport','body','options','raw','where','attributes','limit','UpdateOpenchannelQueueReport','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','request','then','info','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent'];(function(_0x2c2f41,_0xb6f278){var _0x2cff31=function(_0x4064d7){while(--_0x4064d7){_0x2c2f41['push'](_0x2c2f41['shift']());}};_0x2cff31(++_0xb6f278);}(_0x34bd,0x1d2));var _0xd34b=function(_0x18bf17,_0x32626e){_0x18bf17=_0x18bf17-0x0;var _0x7c4e02=_0x34bd[_0x18bf17];return _0x7c4e02;};'use strict';var _=require(_0xd34b('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xd34b('0x1'));var rs=require(_0xd34b('0x2'));var fs=require('fs');var Redis=require(_0xd34b('0x3'));var db=require(_0xd34b('0x4'))['db'];var utils=require(_0xd34b('0x5'));var logger=require(_0xd34b('0x6'))(_0xd34b('0x7'));var config=require('../../config/environment');var jayson=require(_0xd34b('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x56e3eb,_0x30d93b,_0x3654a5){return new BPromise(function(_0xf51a08,_0x25bce7){return client[_0xd34b('0x9')](_0x56e3eb,_0x3654a5)[_0xd34b('0xa')](function(_0x738328){logger[_0xd34b('0xb')](_0xd34b('0xc'),_0x30d93b,_0xd34b('0xd'));logger[_0xd34b('0xe')](_0xd34b('0xf'),_0x30d93b,'request\x20sent',JSON[_0xd34b('0x10')](_0x738328));if(_0x738328['error']){if(_0x738328[_0xd34b('0x11')][_0xd34b('0x12')]===0x1f4){logger[_0xd34b('0x11')](_0xd34b('0xc'),_0x30d93b,_0x738328[_0xd34b('0x11')][_0xd34b('0x13')]);return _0x25bce7(_0x738328['error'][_0xd34b('0x13')]);}logger[_0xd34b('0x11')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x30d93b,_0x738328[_0xd34b('0x11')][_0xd34b('0x13')]);return _0xf51a08(_0x738328[_0xd34b('0x11')]['message']);}else{logger[_0xd34b('0xb')](_0xd34b('0xc'),_0x30d93b,'request\x20sent');_0xf51a08(_0x738328[_0xd34b('0x14')]['message']);}})[_0xd34b('0x15')](function(_0x438b61){logger[_0xd34b('0x11')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x30d93b,_0x438b61);_0x25bce7(_0x438b61);});});}exports[_0xd34b('0x16')]=function(_0x193965){var _0x1bbbb1=this;return new Promise(function(_0x105f67,_0x206f16){return db['OpenchannelQueueReport']['create'](_0x193965[_0xd34b('0x17')],{'raw':_0x193965[_0xd34b('0x18')]?_0x193965[_0xd34b('0x18')][_0xd34b('0x19')]===undefined?!![]:![]:!![]})[_0xd34b('0xa')](function(_0x3152a9){logger['info'](_0xd34b('0x16'),_0x193965);logger[_0xd34b('0xe')](_0xd34b('0x16'),_0x193965,JSON[_0xd34b('0x10')](_0x3152a9));_0x105f67(_0x3152a9);})['catch'](function(_0x45c569){logger[_0xd34b('0x11')](_0xd34b('0x16'),_0x45c569[_0xd34b('0x13')],_0x193965);_0x206f16(_0x1bbbb1[_0xd34b('0x11')](0x1f4,_0x45c569[_0xd34b('0x13')]));});});};exports['UpdateOpenchannelQueueReport']=function(_0x50da22){var _0x49c485=this;return new Promise(function(_0x2187c0,_0x2ae0e1){return db['OpenchannelQueueReport']['update'](_0x50da22['body'],{'raw':_0x50da22[_0xd34b('0x18')]?_0x50da22[_0xd34b('0x18')][_0xd34b('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x50da22['options']?_0x50da22[_0xd34b('0x18')][_0xd34b('0x1a')]||null:null,'attributes':_0x50da22['options']?_0x50da22[_0xd34b('0x18')][_0xd34b('0x1b')]||null:null,'limit':_0x50da22[_0xd34b('0x18')]?_0x50da22['options'][_0xd34b('0x1c')]||null:null})['then'](function(_0x182266){logger[_0xd34b('0xb')](_0xd34b('0x1d'),_0x50da22);logger['debug'](_0xd34b('0x1d'),_0x50da22,JSON['stringify'](_0x182266));_0x2187c0(_0x182266);})[_0xd34b('0x15')](function(_0x47c0b3){logger[_0xd34b('0x11')]('UpdateOpenchannelQueueReport',_0x47c0b3[_0xd34b('0x13')],_0x50da22);_0x2ae0e1(_0x49c485[_0xd34b('0x11')](0x1f4,_0x47c0b3['message']));});});};