Built motion from commit f74363e9.|2.6.34
[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 _0x17b1=['stringify','error','code','ChatQueueReport,\x20%s,\x20%s','message','result','CreateChatQueueReport','ChatQueueReport','create','body','options','raw','info','UpdateChatQueueReport','update','where','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x17b1,0x7a));var _0x117b=function(_0x512e72,_0x49ffe1){_0x512e72=_0x512e72-0x0;var _0x143086=_0x17b1[_0x512e72];return _0x143086;};'use strict';var _=require(_0x117b('0x0'));var util=require(_0x117b('0x1'));var moment=require(_0x117b('0x2'));var BPromise=require(_0x117b('0x3'));var rs=require(_0x117b('0x4'));var fs=require('fs');var Redis=require(_0x117b('0x5'));var db=require(_0x117b('0x6'))['db'];var utils=require(_0x117b('0x7'));var logger=require('../../config/logger')(_0x117b('0x8'));var config=require(_0x117b('0x9'));var jayson=require(_0x117b('0xa'));var client=jayson[_0x117b('0xb')][_0x117b('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2dd4f0,_0x5c56fb,_0x54edd9){return new BPromise(function(_0x2e8c3f,_0x46bc89){return client[_0x117b('0xd')](_0x2dd4f0,_0x54edd9)[_0x117b('0xe')](function(_0x23cf5c){logger['info']('ChatQueueReport,\x20%s,\x20%s',_0x5c56fb,'request\x20sent');logger[_0x117b('0xf')](_0x117b('0x10'),_0x5c56fb,_0x117b('0x11'),JSON[_0x117b('0x12')](_0x23cf5c));if(_0x23cf5c['error']){if(_0x23cf5c[_0x117b('0x13')][_0x117b('0x14')]===0x1f4){logger['error'](_0x117b('0x15'),_0x5c56fb,_0x23cf5c[_0x117b('0x13')][_0x117b('0x16')]);return _0x46bc89(_0x23cf5c[_0x117b('0x13')][_0x117b('0x16')]);}logger['error'](_0x117b('0x15'),_0x5c56fb,_0x23cf5c['error']['message']);return _0x2e8c3f(_0x23cf5c[_0x117b('0x13')][_0x117b('0x16')]);}else{logger['info'](_0x117b('0x15'),_0x5c56fb,_0x117b('0x11'));_0x2e8c3f(_0x23cf5c[_0x117b('0x17')][_0x117b('0x16')]);}})['catch'](function(_0x24caf4){logger[_0x117b('0x13')](_0x117b('0x15'),_0x5c56fb,_0x24caf4);_0x46bc89(_0x24caf4);});});}exports[_0x117b('0x18')]=function(_0x14ccd0){var _0x4784c1=this;return new Promise(function(_0x25eded,_0xde3242){return db[_0x117b('0x19')][_0x117b('0x1a')](_0x14ccd0[_0x117b('0x1b')],{'raw':_0x14ccd0[_0x117b('0x1c')]?_0x14ccd0[_0x117b('0x1c')][_0x117b('0x1d')]===undefined?!![]:![]:!![]})[_0x117b('0xe')](function(_0x5286be){logger[_0x117b('0x1e')]('CreateChatQueueReport',_0x14ccd0);logger[_0x117b('0xf')]('CreateChatQueueReport',_0x14ccd0,JSON[_0x117b('0x12')](_0x5286be));_0x25eded(_0x5286be);})['catch'](function(_0x5d1bfc){logger[_0x117b('0x13')](_0x117b('0x18'),_0x5d1bfc[_0x117b('0x16')],_0x14ccd0);_0xde3242(_0x4784c1[_0x117b('0x13')](0x1f4,_0x5d1bfc['message']));});});};exports[_0x117b('0x1f')]=function(_0x5c9ba3){var _0x355af5=this;return new Promise(function(_0x129193,_0x30ed37){return db['ChatQueueReport'][_0x117b('0x20')](_0x5c9ba3[_0x117b('0x1b')],{'raw':_0x5c9ba3[_0x117b('0x1c')]?_0x5c9ba3[_0x117b('0x1c')][_0x117b('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5c9ba3[_0x117b('0x1c')]?_0x5c9ba3[_0x117b('0x1c')][_0x117b('0x21')]||null:null,'attributes':_0x5c9ba3[_0x117b('0x1c')]?_0x5c9ba3['options']['attributes']||null:null,'limit':_0x5c9ba3[_0x117b('0x1c')]?_0x5c9ba3[_0x117b('0x1c')][_0x117b('0x22')]||null:null})['then'](function(_0x9e7b82){logger['info'](_0x117b('0x1f'),_0x5c9ba3);logger[_0x117b('0xf')](_0x117b('0x1f'),_0x5c9ba3,JSON['stringify'](_0x9e7b82));_0x129193(_0x9e7b82);})['catch'](function(_0x4b608f){logger[_0x117b('0x13')](_0x117b('0x1f'),_0x4b608f[_0x117b('0x16')],_0x5c9ba3);_0x30ed37(_0x355af5['error'](0x1f4,_0x4b608f[_0x117b('0x16')]));});});};