232459e72b0629a39a65def3c48d5b2c62cce258
[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 _0xea28=['request\x20sent','stringify','error','code','message','result','catch','CreateOpenchannelQueueReport','OpenchannelQueueReport','create','body','options','debug','UpdateOpenchannelQueueReport','update','raw','attributes','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','info','OpenchannelQueueReport,\x20%s,\x20%s'];(function(_0x750888,_0x22fd3f){var _0x30b506=function(_0x223ae4){while(--_0x223ae4){_0x750888['push'](_0x750888['shift']());}};_0x30b506(++_0x22fd3f);}(_0xea28,0x13a));var _0x8ea2=function(_0x1ea61d,_0x5142c1){_0x1ea61d=_0x1ea61d-0x0;var _0x3f0817=_0xea28[_0x1ea61d];return _0x3f0817;};'use strict';var _=require(_0x8ea2('0x0'));var util=require(_0x8ea2('0x1'));var moment=require(_0x8ea2('0x2'));var BPromise=require(_0x8ea2('0x3'));var rs=require(_0x8ea2('0x4'));var fs=require('fs');var Redis=require(_0x8ea2('0x5'));var db=require(_0x8ea2('0x6'))['db'];var utils=require(_0x8ea2('0x7'));var logger=require('../../config/logger')(_0x8ea2('0x8'));var config=require(_0x8ea2('0x9'));var jayson=require(_0x8ea2('0xa'));var client=jayson['client'][_0x8ea2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x435d78,_0xb7f278,_0x39b1fa){return new BPromise(function(_0x28b5b8,_0x929304){return client[_0x8ea2('0xc')](_0x435d78,_0x39b1fa)[_0x8ea2('0xd')](function(_0x3de4a1){logger[_0x8ea2('0xe')](_0x8ea2('0xf'),_0xb7f278,_0x8ea2('0x10'));logger['debug']('OpenchannelQueueReport,\x20%s,\x20%s,\x20%s',_0xb7f278,_0x8ea2('0x10'),JSON[_0x8ea2('0x11')](_0x3de4a1));if(_0x3de4a1[_0x8ea2('0x12')]){if(_0x3de4a1['error'][_0x8ea2('0x13')]===0x1f4){logger[_0x8ea2('0x12')](_0x8ea2('0xf'),_0xb7f278,_0x3de4a1[_0x8ea2('0x12')][_0x8ea2('0x14')]);return _0x929304(_0x3de4a1['error'][_0x8ea2('0x14')]);}logger['error']('OpenchannelQueueReport,\x20%s,\x20%s',_0xb7f278,_0x3de4a1[_0x8ea2('0x12')][_0x8ea2('0x14')]);return _0x28b5b8(_0x3de4a1[_0x8ea2('0x12')][_0x8ea2('0x14')]);}else{logger[_0x8ea2('0xe')](_0x8ea2('0xf'),_0xb7f278,_0x8ea2('0x10'));_0x28b5b8(_0x3de4a1[_0x8ea2('0x15')][_0x8ea2('0x14')]);}})[_0x8ea2('0x16')](function(_0x2dfa7c){logger[_0x8ea2('0x12')](_0x8ea2('0xf'),_0xb7f278,_0x2dfa7c);_0x929304(_0x2dfa7c);});});}exports[_0x8ea2('0x17')]=function(_0x1b64cf){var _0x174ef2=this;return new Promise(function(_0x467045,_0x2a0329){return db[_0x8ea2('0x18')][_0x8ea2('0x19')](_0x1b64cf[_0x8ea2('0x1a')],{'raw':_0x1b64cf[_0x8ea2('0x1b')]?_0x1b64cf['options']['raw']===undefined?!![]:![]:!![]})[_0x8ea2('0xd')](function(_0x248c18){logger[_0x8ea2('0xe')]('CreateOpenchannelQueueReport',_0x1b64cf);logger[_0x8ea2('0x1c')](_0x8ea2('0x17'),_0x1b64cf,JSON['stringify'](_0x248c18));_0x467045(_0x248c18);})[_0x8ea2('0x16')](function(_0x283f00){logger[_0x8ea2('0x12')](_0x8ea2('0x17'),_0x283f00[_0x8ea2('0x14')],_0x1b64cf);_0x2a0329(_0x174ef2[_0x8ea2('0x12')](0x1f4,_0x283f00[_0x8ea2('0x14')]));});});};exports[_0x8ea2('0x1d')]=function(_0x18ec34){var _0x4d5030=this;return new Promise(function(_0x433bc5,_0x4f48bd){return db[_0x8ea2('0x18')][_0x8ea2('0x1e')](_0x18ec34[_0x8ea2('0x1a')],{'raw':_0x18ec34['options']?_0x18ec34['options'][_0x8ea2('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x18ec34['options']?_0x18ec34[_0x8ea2('0x1b')]['where']||null:null,'attributes':_0x18ec34[_0x8ea2('0x1b')]?_0x18ec34[_0x8ea2('0x1b')][_0x8ea2('0x20')]||null:null,'limit':_0x18ec34[_0x8ea2('0x1b')]?_0x18ec34['options']['limit']||null:null})[_0x8ea2('0xd')](function(_0x4da5b3){logger[_0x8ea2('0xe')](_0x8ea2('0x1d'),_0x18ec34);logger[_0x8ea2('0x1c')](_0x8ea2('0x1d'),_0x18ec34,JSON[_0x8ea2('0x11')](_0x4da5b3));_0x433bc5(_0x4da5b3);})[_0x8ea2('0x16')](function(_0x32e225){logger[_0x8ea2('0x12')](_0x8ea2('0x1d'),_0x32e225[_0x8ea2('0x14')],_0x18ec34);_0x4f48bd(_0x4d5030['error'](0x1f4,_0x32e225['message']));});});};