efd9b3fe5c0e297fdf1f964cb27720fb46ee3d37
[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 _0x8bec=['attributes','limit','stringify','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','info','request\x20sent','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','error','code','ChatQueueReport,\x20%s,\x20%s','message','result','catch','CreateChatQueueReport','create','body','raw','then','UpdateChatQueueReport','ChatQueueReport','update','options'];(function(_0x1b126b,_0x211e5b){var _0x551c85=function(_0x293fa1){while(--_0x293fa1){_0x1b126b['push'](_0x1b126b['shift']());}};_0x551c85(++_0x211e5b);}(_0x8bec,0x83));var _0xc8be=function(_0x61bf97,_0x418aec){_0x61bf97=_0x61bf97-0x0;var _0x39d7d5=_0x8bec[_0x61bf97];return _0x39d7d5;};'use strict';var _=require(_0xc8be('0x0'));var util=require(_0xc8be('0x1'));var moment=require(_0xc8be('0x2'));var BPromise=require(_0xc8be('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc8be('0x4'));var db=require(_0xc8be('0x5'))['db'];var utils=require(_0xc8be('0x6'));var logger=require(_0xc8be('0x7'))(_0xc8be('0x8'));var config=require(_0xc8be('0x9'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x162dd6,_0x5f00c2,_0x4fc1c2){return new BPromise(function(_0x1b7c02,_0x15ed3c){return client['request'](_0x162dd6,_0x4fc1c2)['then'](function(_0x31a4e8){logger[_0xc8be('0xa')]('ChatQueueReport,\x20%s,\x20%s',_0x5f00c2,_0xc8be('0xb'));logger[_0xc8be('0xc')](_0xc8be('0xd'),_0x5f00c2,'request\x20sent',JSON['stringify'](_0x31a4e8));if(_0x31a4e8['error']){if(_0x31a4e8[_0xc8be('0xe')][_0xc8be('0xf')]===0x1f4){logger['error'](_0xc8be('0x10'),_0x5f00c2,_0x31a4e8['error']['message']);return _0x15ed3c(_0x31a4e8[_0xc8be('0xe')]['message']);}logger[_0xc8be('0xe')](_0xc8be('0x10'),_0x5f00c2,_0x31a4e8['error'][_0xc8be('0x11')]);return _0x1b7c02(_0x31a4e8[_0xc8be('0xe')][_0xc8be('0x11')]);}else{logger[_0xc8be('0xa')]('ChatQueueReport,\x20%s,\x20%s',_0x5f00c2,_0xc8be('0xb'));_0x1b7c02(_0x31a4e8[_0xc8be('0x12')]['message']);}})[_0xc8be('0x13')](function(_0x3b661b){logger[_0xc8be('0xe')](_0xc8be('0x10'),_0x5f00c2,_0x3b661b);_0x15ed3c(_0x3b661b);});});}exports[_0xc8be('0x14')]=function(_0x53b644){var _0x236091=this;return new Promise(function(_0x13e3d2,_0x89b4ec){return db['ChatQueueReport'][_0xc8be('0x15')](_0x53b644[_0xc8be('0x16')],{'raw':_0x53b644['options']?_0x53b644['options'][_0xc8be('0x17')]===undefined?!![]:![]:!![]})[_0xc8be('0x18')](function(_0x1960d0){logger[_0xc8be('0xa')](_0xc8be('0x14'),_0x53b644);logger[_0xc8be('0xc')](_0xc8be('0x14'),_0x53b644,JSON['stringify'](_0x1960d0));_0x13e3d2(_0x1960d0);})[_0xc8be('0x13')](function(_0x24b940){logger[_0xc8be('0xe')](_0xc8be('0x14'),_0x24b940[_0xc8be('0x11')],_0x53b644);_0x89b4ec(_0x236091[_0xc8be('0xe')](0x1f4,_0x24b940[_0xc8be('0x11')]));});});};exports[_0xc8be('0x19')]=function(_0x26b8ee){var _0x3cf24a=this;return new Promise(function(_0x2e67a8,_0x460773){return db[_0xc8be('0x1a')][_0xc8be('0x1b')](_0x26b8ee[_0xc8be('0x16')],{'raw':_0x26b8ee[_0xc8be('0x1c')]?_0x26b8ee['options'][_0xc8be('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x26b8ee[_0xc8be('0x1c')]?_0x26b8ee[_0xc8be('0x1c')]['where']||null:null,'attributes':_0x26b8ee['options']?_0x26b8ee['options'][_0xc8be('0x1d')]||null:null,'limit':_0x26b8ee[_0xc8be('0x1c')]?_0x26b8ee[_0xc8be('0x1c')][_0xc8be('0x1e')]||null:null})[_0xc8be('0x18')](function(_0x1a7bfe){logger['info'](_0xc8be('0x19'),_0x26b8ee);logger[_0xc8be('0xc')](_0xc8be('0x19'),_0x26b8ee,JSON[_0xc8be('0x1f')](_0x1a7bfe));_0x2e67a8(_0x1a7bfe);})['catch'](function(_0x45ea6b){logger['error'](_0xc8be('0x19'),_0x45ea6b[_0xc8be('0x11')],_0x26b8ee);_0x460773(_0x3cf24a[_0xc8be('0xe')](0x1f4,_0x45ea6b[_0xc8be('0x11')]));});});};