478bdde329868721f91d431328d5f2ca5e772616
[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 _0x4c99=['moment','../../mysqldb','../../config/utils','rpc','../../config/environment','client','request','then','info','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','CreateOpenchannelQueueReport','OpenchannelQueueReport','create','body','options','raw','catch','update','attributes','limit','UpdateOpenchannelQueueReport','lodash'];(function(_0x438182,_0x389269){var _0x5df065=function(_0xb24d22){while(--_0xb24d22){_0x438182['push'](_0x438182['shift']());}};_0x5df065(++_0x389269);}(_0x4c99,0x1ec));var _0x94c9=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x4c99[_0x4a9fb1];return _0x348672;};'use strict';var _=require(_0x94c9('0x0'));var util=require('util');var moment=require(_0x94c9('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x94c9('0x2'))['db'];var utils=require(_0x94c9('0x3'));var logger=require('../../config/logger')(_0x94c9('0x4'));var config=require(_0x94c9('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x94c9('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4ebd2b,_0x49b85b,_0x23d961){return new BPromise(function(_0x4403ba,_0x3a1743){return client[_0x94c9('0x7')](_0x4ebd2b,_0x23d961)[_0x94c9('0x8')](function(_0x1c0983){logger[_0x94c9('0x9')](_0x94c9('0xa'),_0x49b85b,_0x94c9('0xb'));logger[_0x94c9('0xc')]('OpenchannelQueueReport,\x20%s,\x20%s,\x20%s',_0x49b85b,_0x94c9('0xb'),JSON[_0x94c9('0xd')](_0x1c0983));if(_0x1c0983[_0x94c9('0xe')]){if(_0x1c0983['error'][_0x94c9('0xf')]===0x1f4){logger[_0x94c9('0xe')](_0x94c9('0xa'),_0x49b85b,_0x1c0983[_0x94c9('0xe')][_0x94c9('0x10')]);return _0x3a1743(_0x1c0983[_0x94c9('0xe')][_0x94c9('0x10')]);}logger[_0x94c9('0xe')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x49b85b,_0x1c0983['error']['message']);return _0x4403ba(_0x1c0983[_0x94c9('0xe')][_0x94c9('0x10')]);}else{logger['info'](_0x94c9('0xa'),_0x49b85b,_0x94c9('0xb'));_0x4403ba(_0x1c0983[_0x94c9('0x11')]['message']);}})['catch'](function(_0x447937){logger[_0x94c9('0xe')](_0x94c9('0xa'),_0x49b85b,_0x447937);_0x3a1743(_0x447937);});});}exports[_0x94c9('0x12')]=function(_0x5ab49f){var _0xb3d5d6=this;return new Promise(function(_0x2bca02,_0x3a38cc){return db[_0x94c9('0x13')][_0x94c9('0x14')](_0x5ab49f[_0x94c9('0x15')],{'raw':_0x5ab49f[_0x94c9('0x16')]?_0x5ab49f['options'][_0x94c9('0x17')]===undefined?!![]:![]:!![]})[_0x94c9('0x8')](function(_0x4d7a9b){logger[_0x94c9('0x9')](_0x94c9('0x12'),_0x5ab49f);logger[_0x94c9('0xc')](_0x94c9('0x12'),_0x5ab49f,JSON[_0x94c9('0xd')](_0x4d7a9b));_0x2bca02(_0x4d7a9b);})[_0x94c9('0x18')](function(_0x410f00){logger[_0x94c9('0xe')](_0x94c9('0x12'),_0x410f00[_0x94c9('0x10')],_0x5ab49f);_0x3a38cc(_0xb3d5d6['error'](0x1f4,_0x410f00[_0x94c9('0x10')]));});});};exports['UpdateOpenchannelQueueReport']=function(_0xf5ce65){var _0x497c31=this;return new Promise(function(_0x21ffd9,_0x12b535){return db[_0x94c9('0x13')][_0x94c9('0x19')](_0xf5ce65[_0x94c9('0x15')],{'raw':_0xf5ce65[_0x94c9('0x16')]?_0xf5ce65['options'][_0x94c9('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xf5ce65[_0x94c9('0x16')]?_0xf5ce65[_0x94c9('0x16')]['where']||null:null,'attributes':_0xf5ce65[_0x94c9('0x16')]?_0xf5ce65['options'][_0x94c9('0x1a')]||null:null,'limit':_0xf5ce65[_0x94c9('0x16')]?_0xf5ce65[_0x94c9('0x16')][_0x94c9('0x1b')]||null:null})[_0x94c9('0x8')](function(_0x46a8fc){logger['info'](_0x94c9('0x1c'),_0xf5ce65);logger[_0x94c9('0xc')](_0x94c9('0x1c'),_0xf5ce65,JSON['stringify'](_0x46a8fc));_0x21ffd9(_0x46a8fc);})[_0x94c9('0x18')](function(_0x1e7b25){logger[_0x94c9('0xe')](_0x94c9('0x1c'),_0x1e7b25['message'],_0xf5ce65);_0x12b535(_0x497c31[_0x94c9('0xe')](0x1f4,_0x1e7b25[_0x94c9('0x10')]));});});};