64ca22aeb0b4423083cdff2c02eb528668cb1720
[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 _0x57b2=['options','raw','UpdateChatQueueReport','update','body','where','attributes','info','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','then','ChatQueueReport,\x20%s,\x20%s','request\x20sent','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','CreateChatQueueReport','ChatQueueReport','create'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x57b2,0xda));var _0x257b=function(_0x422a3b,_0x2a6f6f){_0x422a3b=_0x422a3b-0x0;var _0x1a8e79=_0x57b2[_0x422a3b];return _0x1a8e79;};'use strict';var _=require(_0x257b('0x0'));var util=require(_0x257b('0x1'));var moment=require(_0x257b('0x2'));var BPromise=require(_0x257b('0x3'));var rs=require(_0x257b('0x4'));var fs=require('fs');var Redis=require(_0x257b('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x257b('0x6'));var logger=require(_0x257b('0x7'))(_0x257b('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1adf73,_0x4a5c36,_0x873b77){return new BPromise(function(_0xa58e13,_0x19f8dc){return client['request'](_0x1adf73,_0x873b77)[_0x257b('0x9')](function(_0x45eca9){logger['info'](_0x257b('0xa'),_0x4a5c36,_0x257b('0xb'));logger[_0x257b('0xc')](_0x257b('0xd'),_0x4a5c36,_0x257b('0xb'),JSON[_0x257b('0xe')](_0x45eca9));if(_0x45eca9[_0x257b('0xf')]){if(_0x45eca9[_0x257b('0xf')][_0x257b('0x10')]===0x1f4){logger[_0x257b('0xf')](_0x257b('0xa'),_0x4a5c36,_0x45eca9[_0x257b('0xf')][_0x257b('0x11')]);return _0x19f8dc(_0x45eca9[_0x257b('0xf')][_0x257b('0x11')]);}logger['error'](_0x257b('0xa'),_0x4a5c36,_0x45eca9[_0x257b('0xf')][_0x257b('0x11')]);return _0xa58e13(_0x45eca9[_0x257b('0xf')][_0x257b('0x11')]);}else{logger['info']('ChatQueueReport,\x20%s,\x20%s',_0x4a5c36,_0x257b('0xb'));_0xa58e13(_0x45eca9['result'][_0x257b('0x11')]);}})[_0x257b('0x12')](function(_0x317e86){logger[_0x257b('0xf')](_0x257b('0xa'),_0x4a5c36,_0x317e86);_0x19f8dc(_0x317e86);});});}exports[_0x257b('0x13')]=function(_0xd0ab4e){var _0x37eb35=this;return new Promise(function(_0x50122b,_0x2dece2){return db[_0x257b('0x14')][_0x257b('0x15')](_0xd0ab4e['body'],{'raw':_0xd0ab4e[_0x257b('0x16')]?_0xd0ab4e['options'][_0x257b('0x17')]===undefined?!![]:![]:!![]})[_0x257b('0x9')](function(_0x147868){logger['info'](_0x257b('0x13'),_0xd0ab4e);logger[_0x257b('0xc')]('CreateChatQueueReport',_0xd0ab4e,JSON[_0x257b('0xe')](_0x147868));_0x50122b(_0x147868);})[_0x257b('0x12')](function(_0x24e74a){logger[_0x257b('0xf')](_0x257b('0x13'),_0x24e74a[_0x257b('0x11')],_0xd0ab4e);_0x2dece2(_0x37eb35['error'](0x1f4,_0x24e74a[_0x257b('0x11')]));});});};exports[_0x257b('0x18')]=function(_0x22a722){var _0x3f2148=this;return new Promise(function(_0x3e2f34,_0x9023cc){return db['ChatQueueReport'][_0x257b('0x19')](_0x22a722[_0x257b('0x1a')],{'raw':_0x22a722['options']?_0x22a722[_0x257b('0x16')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x22a722[_0x257b('0x16')]?_0x22a722[_0x257b('0x16')][_0x257b('0x1b')]||null:null,'attributes':_0x22a722[_0x257b('0x16')]?_0x22a722[_0x257b('0x16')][_0x257b('0x1c')]||null:null,'limit':_0x22a722[_0x257b('0x16')]?_0x22a722[_0x257b('0x16')]['limit']||null:null})[_0x257b('0x9')](function(_0x5988e0){logger[_0x257b('0x1d')](_0x257b('0x18'),_0x22a722);logger[_0x257b('0xc')](_0x257b('0x18'),_0x22a722,JSON[_0x257b('0xe')](_0x5988e0));_0x3e2f34(_0x5988e0);})[_0x257b('0x12')](function(_0x572361){logger['error'](_0x257b('0x18'),_0x572361['message'],_0x22a722);_0x9023cc(_0x3f2148['error'](0x1f4,_0x572361[_0x257b('0x11')]));});});};