Built motion from commit (unavailable).|2.5.21
[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 _0x6dd6=['../../config/environment','jayson/promise','client','http','request','then','info','ChatQueueReport,\x20%s,\x20%s','request\x20sent','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify','code','error','message','ChatQueueReport','create','body','options','raw','CreateChatQueueReport','catch','UpdateChatQueueReport','where','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x58ff28,_0x1aa25b){var _0x23495a=function(_0x2612e6){while(--_0x2612e6){_0x58ff28['push'](_0x58ff28['shift']());}};_0x23495a(++_0x1aa25b);}(_0x6dd6,0x9c));var _0x66dd=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0x6dd6[_0x297fd3];return _0x2af381;};'use strict';var _=require(_0x66dd('0x0'));var util=require(_0x66dd('0x1'));var moment=require(_0x66dd('0x2'));var BPromise=require(_0x66dd('0x3'));var rs=require(_0x66dd('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x66dd('0x5'))['db'];var utils=require(_0x66dd('0x6'));var logger=require(_0x66dd('0x7'))(_0x66dd('0x8'));var config=require(_0x66dd('0x9'));var jayson=require(_0x66dd('0xa'));var client=jayson[_0x66dd('0xb')][_0x66dd('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1cace4,_0x12df75,_0x50385e){return new BPromise(function(_0x4d264c,_0x3d3c57){return client[_0x66dd('0xd')](_0x1cace4,_0x50385e)[_0x66dd('0xe')](function(_0x280954){logger[_0x66dd('0xf')](_0x66dd('0x10'),_0x12df75,_0x66dd('0x11'));logger[_0x66dd('0x12')](_0x66dd('0x13'),_0x12df75,_0x66dd('0x11'),JSON[_0x66dd('0x14')](_0x280954));if(_0x280954['error']){if(_0x280954['error'][_0x66dd('0x15')]===0x1f4){logger[_0x66dd('0x16')](_0x66dd('0x10'),_0x12df75,_0x280954['error'][_0x66dd('0x17')]);return _0x3d3c57(_0x280954['error'][_0x66dd('0x17')]);}logger[_0x66dd('0x16')](_0x66dd('0x10'),_0x12df75,_0x280954[_0x66dd('0x16')][_0x66dd('0x17')]);return _0x4d264c(_0x280954[_0x66dd('0x16')][_0x66dd('0x17')]);}else{logger['info'](_0x66dd('0x10'),_0x12df75,_0x66dd('0x11'));_0x4d264c(_0x280954['result'][_0x66dd('0x17')]);}})['catch'](function(_0x18835d){logger[_0x66dd('0x16')](_0x66dd('0x10'),_0x12df75,_0x18835d);_0x3d3c57(_0x18835d);});});}exports['CreateChatQueueReport']=function(_0x4321fb){var _0x3d6d9c=this;return new Promise(function(_0x36d49f,_0x52b7fe){return db[_0x66dd('0x18')][_0x66dd('0x19')](_0x4321fb[_0x66dd('0x1a')],{'raw':_0x4321fb['options']?_0x4321fb[_0x66dd('0x1b')][_0x66dd('0x1c')]===undefined?!![]:![]:!![]})[_0x66dd('0xe')](function(_0x2d0003){logger[_0x66dd('0xf')](_0x66dd('0x1d'),_0x4321fb);logger[_0x66dd('0x12')](_0x66dd('0x1d'),_0x4321fb,JSON['stringify'](_0x2d0003));_0x36d49f(_0x2d0003);})[_0x66dd('0x1e')](function(_0x45290b){logger[_0x66dd('0x16')]('CreateChatQueueReport',_0x45290b[_0x66dd('0x17')],_0x4321fb);_0x52b7fe(_0x3d6d9c[_0x66dd('0x16')](0x1f4,_0x45290b['message']));});});};exports[_0x66dd('0x1f')]=function(_0xade390){var _0x116f61=this;return new Promise(function(_0x4557f7,_0x20ab8b){return db[_0x66dd('0x18')]['update'](_0xade390['body'],{'raw':_0xade390[_0x66dd('0x1b')]?_0xade390[_0x66dd('0x1b')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xade390[_0x66dd('0x1b')]?_0xade390[_0x66dd('0x1b')][_0x66dd('0x20')]||null:null,'attributes':_0xade390[_0x66dd('0x1b')]?_0xade390[_0x66dd('0x1b')]['attributes']||null:null,'limit':_0xade390['options']?_0xade390[_0x66dd('0x1b')]['limit']||null:null})[_0x66dd('0xe')](function(_0x8bb960){logger[_0x66dd('0xf')](_0x66dd('0x1f'),_0xade390);logger[_0x66dd('0x12')](_0x66dd('0x1f'),_0xade390,JSON[_0x66dd('0x14')](_0x8bb960));_0x4557f7(_0x8bb960);})[_0x66dd('0x1e')](function(_0x405435){logger['error']('UpdateChatQueueReport',_0x405435['message'],_0xade390);_0x20ab8b(_0x116f61[_0x66dd('0x16')](0x1f4,_0x405435[_0x66dd('0x17')]));});});};