23dd3478fdef688a128bc9772a9778fba12fdbb4
[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 _0x6561=['options','raw','UpdateChatQueueReport','update','where','attributes','limit','catch','moment','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','code','ChatQueueReport,\x20%s,\x20%s','message','result','CreateChatQueueReport','ChatQueueReport','create','body'];(function(_0x5de214,_0x107e9d){var _0x4df627=function(_0x4199e1){while(--_0x4199e1){_0x5de214['push'](_0x5de214['shift']());}};_0x4df627(++_0x107e9d);}(_0x6561,0x1e8));var _0x1656=function(_0x1a3cc7,_0x2900e3){_0x1a3cc7=_0x1a3cc7-0x0;var _0x338438=_0x6561[_0x1a3cc7];return _0x338438;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1656('0x0'));var BPromise=require(_0x1656('0x1'));var rs=require(_0x1656('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1656('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x1656('0x4'))('rpc');var config=require(_0x1656('0x5'));var jayson=require(_0x1656('0x6'));var client=jayson[_0x1656('0x7')][_0x1656('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2739c7,_0x371c3f,_0x10fa7c){return new BPromise(function(_0x271349,_0x20b9f2){return client[_0x1656('0x9')](_0x2739c7,_0x10fa7c)[_0x1656('0xa')](function(_0x1d6a2d){logger[_0x1656('0xb')]('ChatQueueReport,\x20%s,\x20%s',_0x371c3f,_0x1656('0xc'));logger[_0x1656('0xd')]('ChatQueueReport,\x20%s,\x20%s,\x20%s',_0x371c3f,_0x1656('0xc'),JSON[_0x1656('0xe')](_0x1d6a2d));if(_0x1d6a2d[_0x1656('0xf')]){if(_0x1d6a2d['error'][_0x1656('0x10')]===0x1f4){logger[_0x1656('0xf')](_0x1656('0x11'),_0x371c3f,_0x1d6a2d[_0x1656('0xf')][_0x1656('0x12')]);return _0x20b9f2(_0x1d6a2d[_0x1656('0xf')][_0x1656('0x12')]);}logger[_0x1656('0xf')](_0x1656('0x11'),_0x371c3f,_0x1d6a2d[_0x1656('0xf')][_0x1656('0x12')]);return _0x271349(_0x1d6a2d[_0x1656('0xf')][_0x1656('0x12')]);}else{logger['info'](_0x1656('0x11'),_0x371c3f,_0x1656('0xc'));_0x271349(_0x1d6a2d[_0x1656('0x13')][_0x1656('0x12')]);}})['catch'](function(_0x4f9ff4){logger['error'](_0x1656('0x11'),_0x371c3f,_0x4f9ff4);_0x20b9f2(_0x4f9ff4);});});}exports[_0x1656('0x14')]=function(_0x1cf4da){var _0xbccf04=this;return new Promise(function(_0x465365,_0x4662ee){return db[_0x1656('0x15')][_0x1656('0x16')](_0x1cf4da[_0x1656('0x17')],{'raw':_0x1cf4da[_0x1656('0x18')]?_0x1cf4da[_0x1656('0x18')][_0x1656('0x19')]===undefined?!![]:![]:!![]})[_0x1656('0xa')](function(_0x78fd43){logger[_0x1656('0xb')](_0x1656('0x14'),_0x1cf4da);logger['debug'](_0x1656('0x14'),_0x1cf4da,JSON[_0x1656('0xe')](_0x78fd43));_0x465365(_0x78fd43);})['catch'](function(_0x411b2d){logger[_0x1656('0xf')](_0x1656('0x14'),_0x411b2d[_0x1656('0x12')],_0x1cf4da);_0x4662ee(_0xbccf04['error'](0x1f4,_0x411b2d[_0x1656('0x12')]));});});};exports[_0x1656('0x1a')]=function(_0x1d9ccf){var _0x39da5a=this;return new Promise(function(_0xfd4147,_0x3ac1f8){return db[_0x1656('0x15')][_0x1656('0x1b')](_0x1d9ccf[_0x1656('0x17')],{'raw':_0x1d9ccf['options']?_0x1d9ccf[_0x1656('0x18')][_0x1656('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1d9ccf[_0x1656('0x18')]?_0x1d9ccf[_0x1656('0x18')][_0x1656('0x1c')]||null:null,'attributes':_0x1d9ccf[_0x1656('0x18')]?_0x1d9ccf[_0x1656('0x18')][_0x1656('0x1d')]||null:null,'limit':_0x1d9ccf[_0x1656('0x18')]?_0x1d9ccf['options'][_0x1656('0x1e')]||null:null})[_0x1656('0xa')](function(_0x1b583e){logger[_0x1656('0xb')]('UpdateChatQueueReport',_0x1d9ccf);logger[_0x1656('0xd')](_0x1656('0x1a'),_0x1d9ccf,JSON['stringify'](_0x1b583e));_0xfd4147(_0x1b583e);})[_0x1656('0x1f')](function(_0x4db0c7){logger['error'](_0x1656('0x1a'),_0x4db0c7[_0x1656('0x12')],_0x1d9ccf);_0x3ac1f8(_0x39da5a[_0x1656('0xf')](0x1f4,_0x4db0c7[_0x1656('0x12')]));});});};