Built motion from commit e1760111.|2.6.18
[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 _0x0efe=['rpc','../../config/environment','jayson/promise','client','request','then','request\x20sent','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatQueueReport,\x20%s,\x20%s','message','info','result','catch','CreateChatQueueReport','ChatQueueReport','create','body','options','raw','UpdateChatQueueReport','update','where','limit','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x18bd60,_0x288c37){var _0x286d92=function(_0x4e1ce3){while(--_0x4e1ce3){_0x18bd60['push'](_0x18bd60['shift']());}};_0x286d92(++_0x288c37);}(_0x0efe,0x110));var _0xe0ef=function(_0x35cd08,_0x3f92e6){_0x35cd08=_0x35cd08-0x0;var _0x4ff6b4=_0x0efe[_0x35cd08];return _0x4ff6b4;};'use strict';var _=require(_0xe0ef('0x0'));var util=require(_0xe0ef('0x1'));var moment=require('moment');var BPromise=require(_0xe0ef('0x2'));var rs=require(_0xe0ef('0x3'));var fs=require('fs');var Redis=require(_0xe0ef('0x4'));var db=require(_0xe0ef('0x5'))['db'];var utils=require(_0xe0ef('0x6'));var logger=require(_0xe0ef('0x7'))(_0xe0ef('0x8'));var config=require(_0xe0ef('0x9'));var jayson=require(_0xe0ef('0xa'));var client=jayson[_0xe0ef('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x49643a,_0x3a6030,_0x1a57fb){return new BPromise(function(_0x161f87,_0xa4f9be){return client[_0xe0ef('0xc')](_0x49643a,_0x1a57fb)[_0xe0ef('0xd')](function(_0x18f982){logger['info']('ChatQueueReport,\x20%s,\x20%s',_0x3a6030,_0xe0ef('0xe'));logger[_0xe0ef('0xf')](_0xe0ef('0x10'),_0x3a6030,'request\x20sent',JSON[_0xe0ef('0x11')](_0x18f982));if(_0x18f982[_0xe0ef('0x12')]){if(_0x18f982['error'][_0xe0ef('0x13')]===0x1f4){logger['error'](_0xe0ef('0x14'),_0x3a6030,_0x18f982[_0xe0ef('0x12')][_0xe0ef('0x15')]);return _0xa4f9be(_0x18f982['error']['message']);}logger[_0xe0ef('0x12')](_0xe0ef('0x14'),_0x3a6030,_0x18f982[_0xe0ef('0x12')][_0xe0ef('0x15')]);return _0x161f87(_0x18f982[_0xe0ef('0x12')][_0xe0ef('0x15')]);}else{logger[_0xe0ef('0x16')](_0xe0ef('0x14'),_0x3a6030,'request\x20sent');_0x161f87(_0x18f982[_0xe0ef('0x17')][_0xe0ef('0x15')]);}})[_0xe0ef('0x18')](function(_0xe9b6d4){logger[_0xe0ef('0x12')]('ChatQueueReport,\x20%s,\x20%s',_0x3a6030,_0xe9b6d4);_0xa4f9be(_0xe9b6d4);});});}exports[_0xe0ef('0x19')]=function(_0x25ae21){var _0x1d6ff4=this;return new Promise(function(_0xe9d60f,_0x2a2f6f){return db[_0xe0ef('0x1a')][_0xe0ef('0x1b')](_0x25ae21[_0xe0ef('0x1c')],{'raw':_0x25ae21[_0xe0ef('0x1d')]?_0x25ae21[_0xe0ef('0x1d')][_0xe0ef('0x1e')]===undefined?!![]:![]:!![]})[_0xe0ef('0xd')](function(_0x450321){logger['info'](_0xe0ef('0x19'),_0x25ae21);logger[_0xe0ef('0xf')](_0xe0ef('0x19'),_0x25ae21,JSON[_0xe0ef('0x11')](_0x450321));_0xe9d60f(_0x450321);})['catch'](function(_0x140f42){logger[_0xe0ef('0x12')](_0xe0ef('0x19'),_0x140f42[_0xe0ef('0x15')],_0x25ae21);_0x2a2f6f(_0x1d6ff4[_0xe0ef('0x12')](0x1f4,_0x140f42[_0xe0ef('0x15')]));});});};exports[_0xe0ef('0x1f')]=function(_0x59b64c){var _0x375ed7=this;return new Promise(function(_0x32d59f,_0x5a44a9){return db[_0xe0ef('0x1a')][_0xe0ef('0x20')](_0x59b64c['body'],{'raw':_0x59b64c['options']?_0x59b64c['options'][_0xe0ef('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x59b64c['options']?_0x59b64c[_0xe0ef('0x1d')][_0xe0ef('0x21')]||null:null,'attributes':_0x59b64c[_0xe0ef('0x1d')]?_0x59b64c['options']['attributes']||null:null,'limit':_0x59b64c['options']?_0x59b64c[_0xe0ef('0x1d')][_0xe0ef('0x22')]||null:null})[_0xe0ef('0xd')](function(_0x31e576){logger[_0xe0ef('0x16')](_0xe0ef('0x1f'),_0x59b64c);logger['debug']('UpdateChatQueueReport',_0x59b64c,JSON[_0xe0ef('0x11')](_0x31e576));_0x32d59f(_0x31e576);})['catch'](function(_0x2bb21f){logger[_0xe0ef('0x12')]('UpdateChatQueueReport',_0x2bb21f['message'],_0x59b64c);_0x5a44a9(_0x375ed7[_0xe0ef('0x12')](0x1f4,_0x2bb21f[_0xe0ef('0x15')]));});});};