Built motion from commit 53172ac8.|2.6.30
[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 _0xdc91=['stringify','error','code','message','catch','CreateOpenchannelQueueReport','OpenchannelQueueReport','create','body','options','raw','UpdateOpenchannelQueueReport','update','attributes','limit','lodash','util','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s'];(function(_0x3d1db0,_0x5e2587){var _0x374cab=function(_0x5eac8b){while(--_0x5eac8b){_0x3d1db0['push'](_0x3d1db0['shift']());}};_0x374cab(++_0x5e2587);}(_0xdc91,0x8b));var _0x1dc9=function(_0x1b859a,_0x16f1c2){_0x1b859a=_0x1b859a-0x0;var _0x401b65=_0xdc91[_0x1b859a];return _0x401b65;};'use strict';var _=require(_0x1dc9('0x0'));var util=require(_0x1dc9('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1dc9('0x2'))['db'];var utils=require(_0x1dc9('0x3'));var logger=require(_0x1dc9('0x4'))(_0x1dc9('0x5'));var config=require(_0x1dc9('0x6'));var jayson=require(_0x1dc9('0x7'));var client=jayson[_0x1dc9('0x8')][_0x1dc9('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5ac058,_0x2c6e6c,_0x25a752){return new BPromise(function(_0x316995,_0x3d1772){return client[_0x1dc9('0xa')](_0x5ac058,_0x25a752)[_0x1dc9('0xb')](function(_0x43c405){logger[_0x1dc9('0xc')](_0x1dc9('0xd'),_0x2c6e6c,_0x1dc9('0xe'));logger['debug'](_0x1dc9('0xf'),_0x2c6e6c,'request\x20sent',JSON[_0x1dc9('0x10')](_0x43c405));if(_0x43c405['error']){if(_0x43c405[_0x1dc9('0x11')][_0x1dc9('0x12')]===0x1f4){logger[_0x1dc9('0x11')](_0x1dc9('0xd'),_0x2c6e6c,_0x43c405['error'][_0x1dc9('0x13')]);return _0x3d1772(_0x43c405[_0x1dc9('0x11')]['message']);}logger[_0x1dc9('0x11')](_0x1dc9('0xd'),_0x2c6e6c,_0x43c405['error']['message']);return _0x316995(_0x43c405[_0x1dc9('0x11')][_0x1dc9('0x13')]);}else{logger[_0x1dc9('0xc')](_0x1dc9('0xd'),_0x2c6e6c,'request\x20sent');_0x316995(_0x43c405['result'][_0x1dc9('0x13')]);}})[_0x1dc9('0x14')](function(_0x5cccb9){logger[_0x1dc9('0x11')](_0x1dc9('0xd'),_0x2c6e6c,_0x5cccb9);_0x3d1772(_0x5cccb9);});});}exports[_0x1dc9('0x15')]=function(_0x197bcd){var _0x335590=this;return new Promise(function(_0x1e845a,_0x2442d0){return db[_0x1dc9('0x16')][_0x1dc9('0x17')](_0x197bcd[_0x1dc9('0x18')],{'raw':_0x197bcd[_0x1dc9('0x19')]?_0x197bcd[_0x1dc9('0x19')][_0x1dc9('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x49bd5b){logger[_0x1dc9('0xc')]('CreateOpenchannelQueueReport',_0x197bcd);logger['debug']('CreateOpenchannelQueueReport',_0x197bcd,JSON[_0x1dc9('0x10')](_0x49bd5b));_0x1e845a(_0x49bd5b);})[_0x1dc9('0x14')](function(_0x277499){logger[_0x1dc9('0x11')](_0x1dc9('0x15'),_0x277499[_0x1dc9('0x13')],_0x197bcd);_0x2442d0(_0x335590[_0x1dc9('0x11')](0x1f4,_0x277499['message']));});});};exports[_0x1dc9('0x1b')]=function(_0x2a4740){var _0x14181d=this;return new Promise(function(_0x4c6e65,_0x39f3f7){return db[_0x1dc9('0x16')][_0x1dc9('0x1c')](_0x2a4740[_0x1dc9('0x18')],{'raw':_0x2a4740[_0x1dc9('0x19')]?_0x2a4740[_0x1dc9('0x19')][_0x1dc9('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2a4740[_0x1dc9('0x19')]?_0x2a4740[_0x1dc9('0x19')]['where']||null:null,'attributes':_0x2a4740['options']?_0x2a4740[_0x1dc9('0x19')][_0x1dc9('0x1d')]||null:null,'limit':_0x2a4740[_0x1dc9('0x19')]?_0x2a4740[_0x1dc9('0x19')][_0x1dc9('0x1e')]||null:null})[_0x1dc9('0xb')](function(_0x10123d){logger[_0x1dc9('0xc')](_0x1dc9('0x1b'),_0x2a4740);logger['debug'](_0x1dc9('0x1b'),_0x2a4740,JSON[_0x1dc9('0x10')](_0x10123d));_0x4c6e65(_0x10123d);})[_0x1dc9('0x14')](function(_0x2d75bc){logger[_0x1dc9('0x11')](_0x1dc9('0x1b'),_0x2d75bc['message'],_0x2a4740);_0x39f3f7(_0x14181d['error'](0x1f4,_0x2d75bc[_0x1dc9('0x13')]));});});};