Built motion from commit 71df090e.|2.6.31
[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 _0x4af8=['catch','CreateOpenchannelQueueReport','OpenchannelQueueReport','create','body','options','raw','stringify','UpdateOpenchannelQueueReport','update','where','attributes','limit','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','info','request\x20sent','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','OpenchannelQueueReport,\x20%s,\x20%s','result'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x4af8,0x1ad));var _0x84af=function(_0x4baae2,_0x487ab6){_0x4baae2=_0x4baae2-0x0;var _0x1a2285=_0x4af8[_0x4baae2];return _0x1a2285;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x84af('0x0'));var fs=require('fs');var Redis=require(_0x84af('0x1'));var db=require(_0x84af('0x2'))['db'];var utils=require(_0x84af('0x3'));var logger=require('../../config/logger')(_0x84af('0x4'));var config=require(_0x84af('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x84af('0x6')][_0x84af('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x550ee6,_0x422c5b,_0x294bc8){return new BPromise(function(_0x483ecc,_0x5b5e45){return client[_0x84af('0x8')](_0x550ee6,_0x294bc8)[_0x84af('0x9')](function(_0x479e1b){logger[_0x84af('0xa')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x422c5b,_0x84af('0xb'));logger[_0x84af('0xc')](_0x84af('0xd'),_0x422c5b,_0x84af('0xb'),JSON['stringify'](_0x479e1b));if(_0x479e1b[_0x84af('0xe')]){if(_0x479e1b['error'][_0x84af('0xf')]===0x1f4){logger[_0x84af('0xe')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x422c5b,_0x479e1b[_0x84af('0xe')][_0x84af('0x10')]);return _0x5b5e45(_0x479e1b[_0x84af('0xe')][_0x84af('0x10')]);}logger['error'](_0x84af('0x11'),_0x422c5b,_0x479e1b['error'][_0x84af('0x10')]);return _0x483ecc(_0x479e1b[_0x84af('0xe')]['message']);}else{logger[_0x84af('0xa')](_0x84af('0x11'),_0x422c5b,'request\x20sent');_0x483ecc(_0x479e1b[_0x84af('0x12')]['message']);}})[_0x84af('0x13')](function(_0x33baf1){logger['error']('OpenchannelQueueReport,\x20%s,\x20%s',_0x422c5b,_0x33baf1);_0x5b5e45(_0x33baf1);});});}exports[_0x84af('0x14')]=function(_0xd8120b){var _0x38a120=this;return new Promise(function(_0x4cf5b4,_0x4d0cf0){return db[_0x84af('0x15')][_0x84af('0x16')](_0xd8120b[_0x84af('0x17')],{'raw':_0xd8120b[_0x84af('0x18')]?_0xd8120b[_0x84af('0x18')][_0x84af('0x19')]===undefined?!![]:![]:!![]})[_0x84af('0x9')](function(_0x334875){logger[_0x84af('0xa')]('CreateOpenchannelQueueReport',_0xd8120b);logger[_0x84af('0xc')](_0x84af('0x14'),_0xd8120b,JSON[_0x84af('0x1a')](_0x334875));_0x4cf5b4(_0x334875);})['catch'](function(_0x2f40d6){logger[_0x84af('0xe')](_0x84af('0x14'),_0x2f40d6['message'],_0xd8120b);_0x4d0cf0(_0x38a120['error'](0x1f4,_0x2f40d6[_0x84af('0x10')]));});});};exports[_0x84af('0x1b')]=function(_0xf72093){var _0x24aa07=this;return new Promise(function(_0x21823e,_0x1b23fb){return db[_0x84af('0x15')][_0x84af('0x1c')](_0xf72093[_0x84af('0x17')],{'raw':_0xf72093[_0x84af('0x18')]?_0xf72093[_0x84af('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xf72093[_0x84af('0x18')]?_0xf72093[_0x84af('0x18')][_0x84af('0x1d')]||null:null,'attributes':_0xf72093[_0x84af('0x18')]?_0xf72093[_0x84af('0x18')][_0x84af('0x1e')]||null:null,'limit':_0xf72093[_0x84af('0x18')]?_0xf72093['options'][_0x84af('0x1f')]||null:null})[_0x84af('0x9')](function(_0x59417e){logger[_0x84af('0xa')](_0x84af('0x1b'),_0xf72093);logger[_0x84af('0xc')](_0x84af('0x1b'),_0xf72093,JSON['stringify'](_0x59417e));_0x21823e(_0x59417e);})['catch'](function(_0x3f37a0){logger[_0x84af('0xe')](_0x84af('0x1b'),_0x3f37a0[_0x84af('0x10')],_0xf72093);_0x1b23fb(_0x24aa07[_0x84af('0xe')](0x1f4,_0x3f37a0[_0x84af('0x10')]));});});};