Built motion from commit 1fd437e9.|2.6.19
[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 _0x4a37=['limit','UpdateChatQueueReport','lodash','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','ChatQueueReport,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','CreateChatQueueReport','ChatQueueReport','create','body','options','raw','debug','update'];(function(_0x27a630,_0x3ba6c7){var _0x26a5fb=function(_0x369314){while(--_0x369314){_0x27a630['push'](_0x27a630['shift']());}};_0x26a5fb(++_0x3ba6c7);}(_0x4a37,0x12e));var _0x74a3=function(_0x1d7586,_0x3d5b25){_0x1d7586=_0x1d7586-0x0;var _0x5975db=_0x4a37[_0x1d7586];return _0x5975db;};'use strict';var _=require(_0x74a3('0x0'));var util=require('util');var moment=require(_0x74a3('0x1'));var BPromise=require(_0x74a3('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x74a3('0x3'))['db'];var utils=require(_0x74a3('0x4'));var logger=require(_0x74a3('0x5'))('rpc');var config=require(_0x74a3('0x6'));var jayson=require(_0x74a3('0x7'));var client=jayson[_0x74a3('0x8')][_0x74a3('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x437908,_0x5bdf8c,_0x15d3a1){return new BPromise(function(_0x5ceec8,_0x1acffd){return client[_0x74a3('0xa')](_0x437908,_0x15d3a1)[_0x74a3('0xb')](function(_0x7ade76){logger[_0x74a3('0xc')](_0x74a3('0xd'),_0x5bdf8c,_0x74a3('0xe'));logger['debug']('ChatQueueReport,\x20%s,\x20%s,\x20%s',_0x5bdf8c,'request\x20sent',JSON[_0x74a3('0xf')](_0x7ade76));if(_0x7ade76[_0x74a3('0x10')]){if(_0x7ade76[_0x74a3('0x10')]['code']===0x1f4){logger['error'](_0x74a3('0xd'),_0x5bdf8c,_0x7ade76['error'][_0x74a3('0x11')]);return _0x1acffd(_0x7ade76[_0x74a3('0x10')][_0x74a3('0x11')]);}logger[_0x74a3('0x10')](_0x74a3('0xd'),_0x5bdf8c,_0x7ade76[_0x74a3('0x10')][_0x74a3('0x11')]);return _0x5ceec8(_0x7ade76[_0x74a3('0x10')][_0x74a3('0x11')]);}else{logger['info']('ChatQueueReport,\x20%s,\x20%s',_0x5bdf8c,_0x74a3('0xe'));_0x5ceec8(_0x7ade76[_0x74a3('0x12')]['message']);}})[_0x74a3('0x13')](function(_0x137ad7){logger[_0x74a3('0x10')]('ChatQueueReport,\x20%s,\x20%s',_0x5bdf8c,_0x137ad7);_0x1acffd(_0x137ad7);});});}exports[_0x74a3('0x14')]=function(_0x3210ae){var _0x14de06=this;return new Promise(function(_0x844d64,_0x14f25e){return db[_0x74a3('0x15')][_0x74a3('0x16')](_0x3210ae[_0x74a3('0x17')],{'raw':_0x3210ae[_0x74a3('0x18')]?_0x3210ae[_0x74a3('0x18')][_0x74a3('0x19')]===undefined?!![]:![]:!![]})[_0x74a3('0xb')](function(_0x4a80c3){logger['info'](_0x74a3('0x14'),_0x3210ae);logger[_0x74a3('0x1a')]('CreateChatQueueReport',_0x3210ae,JSON['stringify'](_0x4a80c3));_0x844d64(_0x4a80c3);})[_0x74a3('0x13')](function(_0x3f7914){logger['error'](_0x74a3('0x14'),_0x3f7914[_0x74a3('0x11')],_0x3210ae);_0x14f25e(_0x14de06[_0x74a3('0x10')](0x1f4,_0x3f7914[_0x74a3('0x11')]));});});};exports['UpdateChatQueueReport']=function(_0x454dc9){var _0x1d07c5=this;return new Promise(function(_0x53be10,_0x2fced6){return db['ChatQueueReport'][_0x74a3('0x1b')](_0x454dc9[_0x74a3('0x17')],{'raw':_0x454dc9[_0x74a3('0x18')]?_0x454dc9[_0x74a3('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x454dc9['options']?_0x454dc9[_0x74a3('0x18')]['where']||null:null,'attributes':_0x454dc9[_0x74a3('0x18')]?_0x454dc9[_0x74a3('0x18')]['attributes']||null:null,'limit':_0x454dc9['options']?_0x454dc9[_0x74a3('0x18')][_0x74a3('0x1c')]||null:null})[_0x74a3('0xb')](function(_0xca25ff){logger['info'](_0x74a3('0x1d'),_0x454dc9);logger[_0x74a3('0x1a')](_0x74a3('0x1d'),_0x454dc9,JSON[_0x74a3('0xf')](_0xca25ff));_0x53be10(_0xca25ff);})['catch'](function(_0x4fd09a){logger[_0x74a3('0x10')](_0x74a3('0x1d'),_0x4fd09a[_0x74a3('0x11')],_0x454dc9);_0x2fced6(_0x1d07c5[_0x74a3('0x10')](0x1f4,_0x4fd09a[_0x74a3('0x11')]));});});};