1ba7279da570f915e62a27120ce2309dea4eb9b7
[motion2.git] / server / api / chatQueueReport / chatQueueReport.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 _0xa3e1=['../../mysqldb','../../config/logger','rpc','http','request','then','info','request\x20sent','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','ChatQueueReport,\x20%s,\x20%s','catch','CreateChatQueueReport','ChatQueueReport','create','body','options','raw','update','where','attributes','limit','UpdateChatQueueReport','stringify','util','moment','bluebird','randomstring','ioredis'];(function(_0x3434c7,_0x301679){var _0x2432a0=function(_0x101cfe){while(--_0x101cfe){_0x3434c7['push'](_0x3434c7['shift']());}};_0x2432a0(++_0x301679);}(_0xa3e1,0x13b));var _0x1a3e=function(_0x44d3d7,_0x1c6356){_0x44d3d7=_0x44d3d7-0x0;var _0x1886c0=_0xa3e1[_0x44d3d7];return _0x1886c0;};'use strict';var _=require('lodash');var util=require(_0x1a3e('0x0'));var moment=require(_0x1a3e('0x1'));var BPromise=require(_0x1a3e('0x2'));var rs=require(_0x1a3e('0x3'));var fs=require('fs');var Redis=require(_0x1a3e('0x4'));var db=require(_0x1a3e('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x1a3e('0x6'))(_0x1a3e('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x1a3e('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x34663e,_0x609cd0,_0x31891a){return new BPromise(function(_0x3f724f,_0xa09273){return client[_0x1a3e('0x9')](_0x34663e,_0x31891a)[_0x1a3e('0xa')](function(_0x2ba883){logger[_0x1a3e('0xb')]('ChatQueueReport,\x20%s,\x20%s',_0x609cd0,_0x1a3e('0xc'));logger[_0x1a3e('0xd')](_0x1a3e('0xe'),_0x609cd0,_0x1a3e('0xc'),JSON['stringify'](_0x2ba883));if(_0x2ba883[_0x1a3e('0xf')]){if(_0x2ba883[_0x1a3e('0xf')][_0x1a3e('0x10')]===0x1f4){logger['error']('ChatQueueReport,\x20%s,\x20%s',_0x609cd0,_0x2ba883[_0x1a3e('0xf')][_0x1a3e('0x11')]);return _0xa09273(_0x2ba883[_0x1a3e('0xf')][_0x1a3e('0x11')]);}logger['error'](_0x1a3e('0x12'),_0x609cd0,_0x2ba883['error'][_0x1a3e('0x11')]);return _0x3f724f(_0x2ba883['error'][_0x1a3e('0x11')]);}else{logger[_0x1a3e('0xb')](_0x1a3e('0x12'),_0x609cd0,_0x1a3e('0xc'));_0x3f724f(_0x2ba883['result']['message']);}})[_0x1a3e('0x13')](function(_0x4f3580){logger[_0x1a3e('0xf')](_0x1a3e('0x12'),_0x609cd0,_0x4f3580);_0xa09273(_0x4f3580);});});}exports[_0x1a3e('0x14')]=function(_0x40b091){var _0x37a876=this;return new Promise(function(_0x53025a,_0x34fd4b){return db[_0x1a3e('0x15')][_0x1a3e('0x16')](_0x40b091[_0x1a3e('0x17')],{'raw':_0x40b091[_0x1a3e('0x18')]?_0x40b091[_0x1a3e('0x18')][_0x1a3e('0x19')]===undefined?!![]:![]:!![]})[_0x1a3e('0xa')](function(_0x341bce){logger[_0x1a3e('0xb')](_0x1a3e('0x14'),_0x40b091);logger[_0x1a3e('0xd')](_0x1a3e('0x14'),_0x40b091,JSON['stringify'](_0x341bce));_0x53025a(_0x341bce);})[_0x1a3e('0x13')](function(_0x23987c){logger[_0x1a3e('0xf')](_0x1a3e('0x14'),_0x23987c['message'],_0x40b091);_0x34fd4b(_0x37a876[_0x1a3e('0xf')](0x1f4,_0x23987c[_0x1a3e('0x11')]));});});};exports['UpdateChatQueueReport']=function(_0x5d87a6){var _0xf55ca1=this;return new Promise(function(_0x1abdf2,_0x3d7199){return db['ChatQueueReport'][_0x1a3e('0x1a')](_0x5d87a6[_0x1a3e('0x17')],{'raw':_0x5d87a6[_0x1a3e('0x18')]?_0x5d87a6['options'][_0x1a3e('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5d87a6[_0x1a3e('0x18')]?_0x5d87a6[_0x1a3e('0x18')][_0x1a3e('0x1b')]||null:null,'attributes':_0x5d87a6[_0x1a3e('0x18')]?_0x5d87a6[_0x1a3e('0x18')][_0x1a3e('0x1c')]||null:null,'limit':_0x5d87a6[_0x1a3e('0x18')]?_0x5d87a6[_0x1a3e('0x18')][_0x1a3e('0x1d')]||null:null})[_0x1a3e('0xa')](function(_0x30957c){logger[_0x1a3e('0xb')](_0x1a3e('0x1e'),_0x5d87a6);logger[_0x1a3e('0xd')](_0x1a3e('0x1e'),_0x5d87a6,JSON[_0x1a3e('0x1f')](_0x30957c));_0x1abdf2(_0x30957c);})['catch'](function(_0x2df155){logger[_0x1a3e('0xf')](_0x1a3e('0x1e'),_0x2df155['message'],_0x5d87a6);_0x3d7199(_0xf55ca1[_0x1a3e('0xf')](0x1f4,_0x2df155['message']));});});};