441a0e220ea54190d1b18680284c691db897d81c
[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 _0xf1e4=['../../config/environment','jayson/promise','then','info','ChatQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','code','error','ChatQueueReport,\x20%s,\x20%s','message','result','catch','ChatQueueReport','create','body','options','raw','debug','CreateChatQueueReport','update','attributes','limit','UpdateChatQueueReport','stringify','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x1c6b44,_0x108f43){var _0x3dbbb1=function(_0x3b706d){while(--_0x3b706d){_0x1c6b44['push'](_0x1c6b44['shift']());}};_0x3dbbb1(++_0x108f43);}(_0xf1e4,0xb8));var _0x4f1e=function(_0x326c26,_0x9e132a){_0x326c26=_0x326c26-0x0;var _0x4b1467=_0xf1e4[_0x326c26];return _0x4b1467;};'use strict';var _=require(_0x4f1e('0x0'));var util=require(_0x4f1e('0x1'));var moment=require('moment');var BPromise=require(_0x4f1e('0x2'));var rs=require(_0x4f1e('0x3'));var fs=require('fs');var Redis=require(_0x4f1e('0x4'));var db=require(_0x4f1e('0x5'))['db'];var utils=require(_0x4f1e('0x6'));var logger=require('../../config/logger')(_0x4f1e('0x7'));var config=require(_0x4f1e('0x8'));var jayson=require(_0x4f1e('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x28e051,_0xc6f8e4,_0x1a2cfc){return new BPromise(function(_0x1bb0fb,_0x391a6f){return client['request'](_0x28e051,_0x1a2cfc)[_0x4f1e('0xa')](function(_0x14f49c){logger[_0x4f1e('0xb')]('ChatQueueReport,\x20%s,\x20%s',_0xc6f8e4,'request\x20sent');logger['debug'](_0x4f1e('0xc'),_0xc6f8e4,_0x4f1e('0xd'),JSON['stringify'](_0x14f49c));if(_0x14f49c['error']){if(_0x14f49c['error'][_0x4f1e('0xe')]===0x1f4){logger[_0x4f1e('0xf')](_0x4f1e('0x10'),_0xc6f8e4,_0x14f49c[_0x4f1e('0xf')]['message']);return _0x391a6f(_0x14f49c[_0x4f1e('0xf')][_0x4f1e('0x11')]);}logger['error'](_0x4f1e('0x10'),_0xc6f8e4,_0x14f49c[_0x4f1e('0xf')]['message']);return _0x1bb0fb(_0x14f49c[_0x4f1e('0xf')][_0x4f1e('0x11')]);}else{logger['info'](_0x4f1e('0x10'),_0xc6f8e4,_0x4f1e('0xd'));_0x1bb0fb(_0x14f49c[_0x4f1e('0x12')][_0x4f1e('0x11')]);}})[_0x4f1e('0x13')](function(_0x5f0f73){logger[_0x4f1e('0xf')](_0x4f1e('0x10'),_0xc6f8e4,_0x5f0f73);_0x391a6f(_0x5f0f73);});});}exports['CreateChatQueueReport']=function(_0x1b172e){var _0xa94b7f=this;return new Promise(function(_0x494454,_0x70c908){return db[_0x4f1e('0x14')][_0x4f1e('0x15')](_0x1b172e[_0x4f1e('0x16')],{'raw':_0x1b172e[_0x4f1e('0x17')]?_0x1b172e[_0x4f1e('0x17')][_0x4f1e('0x18')]===undefined?!![]:![]:!![]})[_0x4f1e('0xa')](function(_0x5be2b9){logger[_0x4f1e('0xb')]('CreateChatQueueReport',_0x1b172e);logger[_0x4f1e('0x19')]('CreateChatQueueReport',_0x1b172e,JSON['stringify'](_0x5be2b9));_0x494454(_0x5be2b9);})[_0x4f1e('0x13')](function(_0xdc0eaa){logger[_0x4f1e('0xf')](_0x4f1e('0x1a'),_0xdc0eaa[_0x4f1e('0x11')],_0x1b172e);_0x70c908(_0xa94b7f[_0x4f1e('0xf')](0x1f4,_0xdc0eaa[_0x4f1e('0x11')]));});});};exports['UpdateChatQueueReport']=function(_0xb0757c){var _0x3e0d90=this;return new Promise(function(_0x382222,_0x30a26c){return db[_0x4f1e('0x14')][_0x4f1e('0x1b')](_0xb0757c['body'],{'raw':_0xb0757c[_0x4f1e('0x17')]?_0xb0757c['options'][_0x4f1e('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xb0757c[_0x4f1e('0x17')]?_0xb0757c[_0x4f1e('0x17')]['where']||null:null,'attributes':_0xb0757c[_0x4f1e('0x17')]?_0xb0757c[_0x4f1e('0x17')][_0x4f1e('0x1c')]||null:null,'limit':_0xb0757c[_0x4f1e('0x17')]?_0xb0757c[_0x4f1e('0x17')][_0x4f1e('0x1d')]||null:null})[_0x4f1e('0xa')](function(_0x510f78){logger[_0x4f1e('0xb')]('UpdateChatQueueReport',_0xb0757c);logger['debug'](_0x4f1e('0x1e'),_0xb0757c,JSON[_0x4f1e('0x1f')](_0x510f78));_0x382222(_0x510f78);})[_0x4f1e('0x13')](function(_0x40ef9e){logger[_0x4f1e('0xf')](_0x4f1e('0x1e'),_0x40ef9e[_0x4f1e('0x11')],_0xb0757c);_0x30a26c(_0x3e0d90[_0x4f1e('0xf')](0x1f4,_0x40ef9e[_0x4f1e('0x11')]));});});};