Built motion from commit c738b9ac.|2.6.25
[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 _0x6784=['result','catch','create','options','raw','CreateChatQueueReport','UpdateChatQueueReport','ChatQueueReport','update','body','where','attributes','limit','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','info','ChatQueueReport,\x20%s,\x20%s','request\x20sent','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify','code','error','message'];(function(_0x412e27,_0x20a978){var _0x53da42=function(_0x43cae5){while(--_0x43cae5){_0x412e27['push'](_0x412e27['shift']());}};_0x53da42(++_0x20a978);}(_0x6784,0x136));var _0x4678=function(_0x4e9628,_0x250573){_0x4e9628=_0x4e9628-0x0;var _0x27bc8c=_0x6784[_0x4e9628];return _0x27bc8c;};'use strict';var _=require('lodash');var util=require(_0x4678('0x0'));var moment=require(_0x4678('0x1'));var BPromise=require(_0x4678('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4678('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x4678('0x4'));var logger=require(_0x4678('0x5'))(_0x4678('0x6'));var config=require(_0x4678('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x4678('0x8')][_0x4678('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x51e6e4,_0x5396bb,_0x3b2880){return new BPromise(function(_0x22b5f2,_0x49d91a){return client['request'](_0x51e6e4,_0x3b2880)[_0x4678('0xa')](function(_0x1b5998){logger[_0x4678('0xb')](_0x4678('0xc'),_0x5396bb,_0x4678('0xd'));logger[_0x4678('0xe')](_0x4678('0xf'),_0x5396bb,_0x4678('0xd'),JSON[_0x4678('0x10')](_0x1b5998));if(_0x1b5998['error']){if(_0x1b5998['error'][_0x4678('0x11')]===0x1f4){logger[_0x4678('0x12')]('ChatQueueReport,\x20%s,\x20%s',_0x5396bb,_0x1b5998[_0x4678('0x12')][_0x4678('0x13')]);return _0x49d91a(_0x1b5998[_0x4678('0x12')][_0x4678('0x13')]);}logger[_0x4678('0x12')](_0x4678('0xc'),_0x5396bb,_0x1b5998[_0x4678('0x12')]['message']);return _0x22b5f2(_0x1b5998[_0x4678('0x12')]['message']);}else{logger[_0x4678('0xb')](_0x4678('0xc'),_0x5396bb,_0x4678('0xd'));_0x22b5f2(_0x1b5998[_0x4678('0x14')]['message']);}})[_0x4678('0x15')](function(_0x454ed1){logger['error'](_0x4678('0xc'),_0x5396bb,_0x454ed1);_0x49d91a(_0x454ed1);});});}exports['CreateChatQueueReport']=function(_0x4a0628){var _0x3d9e9c=this;return new Promise(function(_0x519fef,_0x54838c){return db['ChatQueueReport'][_0x4678('0x16')](_0x4a0628['body'],{'raw':_0x4a0628[_0x4678('0x17')]?_0x4a0628[_0x4678('0x17')][_0x4678('0x18')]===undefined?!![]:![]:!![]})[_0x4678('0xa')](function(_0x40c15){logger[_0x4678('0xb')](_0x4678('0x19'),_0x4a0628);logger['debug'](_0x4678('0x19'),_0x4a0628,JSON[_0x4678('0x10')](_0x40c15));_0x519fef(_0x40c15);})[_0x4678('0x15')](function(_0x1c75b2){logger[_0x4678('0x12')](_0x4678('0x19'),_0x1c75b2[_0x4678('0x13')],_0x4a0628);_0x54838c(_0x3d9e9c[_0x4678('0x12')](0x1f4,_0x1c75b2['message']));});});};exports[_0x4678('0x1a')]=function(_0x4d55dd){var _0x5a07f7=this;return new Promise(function(_0x4a7b61,_0x576e03){return db[_0x4678('0x1b')][_0x4678('0x1c')](_0x4d55dd[_0x4678('0x1d')],{'raw':_0x4d55dd[_0x4678('0x17')]?_0x4d55dd['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4d55dd['options']?_0x4d55dd[_0x4678('0x17')][_0x4678('0x1e')]||null:null,'attributes':_0x4d55dd[_0x4678('0x17')]?_0x4d55dd[_0x4678('0x17')][_0x4678('0x1f')]||null:null,'limit':_0x4d55dd[_0x4678('0x17')]?_0x4d55dd[_0x4678('0x17')][_0x4678('0x20')]||null:null})[_0x4678('0xa')](function(_0x576c98){logger[_0x4678('0xb')](_0x4678('0x1a'),_0x4d55dd);logger[_0x4678('0xe')](_0x4678('0x1a'),_0x4d55dd,JSON[_0x4678('0x10')](_0x576c98));_0x4a7b61(_0x576c98);})[_0x4678('0x15')](function(_0x4bcdfb){logger[_0x4678('0x12')](_0x4678('0x1a'),_0x4bcdfb[_0x4678('0x13')],_0x4d55dd);_0x576e03(_0x5a07f7[_0x4678('0x12')](0x1f4,_0x4bcdfb[_0x4678('0x13')]));});});};