Built motion from commit e0fa946e.|2.6.5
[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 _0x6bea=['../../config/logger','rpc','jayson/promise','client','http','request','then','info','ChatQueueReport,\x20%s,\x20%s','request\x20sent','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','error','message','result','CreateChatQueueReport','ChatQueueReport','create','body','options','raw','stringify','catch','UpdateChatQueueReport','update','where','attributes','limit','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x6bea,0x85));var _0xa6be=function(_0x270f3b,_0x3c7948){_0x270f3b=_0x270f3b-0x0;var _0x14ffd8=_0x6bea[_0x270f3b];return _0x14ffd8;};'use strict';var _=require('lodash');var util=require(_0xa6be('0x0'));var moment=require(_0xa6be('0x1'));var BPromise=require(_0xa6be('0x2'));var rs=require(_0xa6be('0x3'));var fs=require('fs');var Redis=require(_0xa6be('0x4'));var db=require(_0xa6be('0x5'))['db'];var utils=require(_0xa6be('0x6'));var logger=require(_0xa6be('0x7'))(_0xa6be('0x8'));var config=require('../../config/environment');var jayson=require(_0xa6be('0x9'));var client=jayson[_0xa6be('0xa')][_0xa6be('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4ac1c4,_0x55a0be,_0x4eea11){return new BPromise(function(_0x508a4b,_0x1dacdd){return client[_0xa6be('0xc')](_0x4ac1c4,_0x4eea11)[_0xa6be('0xd')](function(_0x285bd4){logger[_0xa6be('0xe')](_0xa6be('0xf'),_0x55a0be,_0xa6be('0x10'));logger[_0xa6be('0x11')](_0xa6be('0x12'),_0x55a0be,_0xa6be('0x10'),JSON['stringify'](_0x285bd4));if(_0x285bd4[_0xa6be('0x13')]){if(_0x285bd4['error']['code']===0x1f4){logger[_0xa6be('0x13')]('ChatQueueReport,\x20%s,\x20%s',_0x55a0be,_0x285bd4[_0xa6be('0x13')][_0xa6be('0x14')]);return _0x1dacdd(_0x285bd4[_0xa6be('0x13')][_0xa6be('0x14')]);}logger[_0xa6be('0x13')](_0xa6be('0xf'),_0x55a0be,_0x285bd4[_0xa6be('0x13')]['message']);return _0x508a4b(_0x285bd4[_0xa6be('0x13')][_0xa6be('0x14')]);}else{logger[_0xa6be('0xe')](_0xa6be('0xf'),_0x55a0be,_0xa6be('0x10'));_0x508a4b(_0x285bd4[_0xa6be('0x15')][_0xa6be('0x14')]);}})['catch'](function(_0xfdb50d){logger['error'](_0xa6be('0xf'),_0x55a0be,_0xfdb50d);_0x1dacdd(_0xfdb50d);});});}exports[_0xa6be('0x16')]=function(_0x105128){var _0x5194cf=this;return new Promise(function(_0x30f0f6,_0x264ec3){return db[_0xa6be('0x17')][_0xa6be('0x18')](_0x105128[_0xa6be('0x19')],{'raw':_0x105128[_0xa6be('0x1a')]?_0x105128['options'][_0xa6be('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0xdf4e25){logger[_0xa6be('0xe')]('CreateChatQueueReport',_0x105128);logger[_0xa6be('0x11')](_0xa6be('0x16'),_0x105128,JSON[_0xa6be('0x1c')](_0xdf4e25));_0x30f0f6(_0xdf4e25);})[_0xa6be('0x1d')](function(_0x4e82a1){logger['error']('CreateChatQueueReport',_0x4e82a1[_0xa6be('0x14')],_0x105128);_0x264ec3(_0x5194cf[_0xa6be('0x13')](0x1f4,_0x4e82a1[_0xa6be('0x14')]));});});};exports[_0xa6be('0x1e')]=function(_0x5a898c){var _0xec92d7=this;return new Promise(function(_0x570b48,_0x5de3c1){return db['ChatQueueReport'][_0xa6be('0x1f')](_0x5a898c[_0xa6be('0x19')],{'raw':_0x5a898c[_0xa6be('0x1a')]?_0x5a898c['options'][_0xa6be('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5a898c['options']?_0x5a898c['options'][_0xa6be('0x20')]||null:null,'attributes':_0x5a898c['options']?_0x5a898c[_0xa6be('0x1a')][_0xa6be('0x21')]||null:null,'limit':_0x5a898c[_0xa6be('0x1a')]?_0x5a898c[_0xa6be('0x1a')][_0xa6be('0x22')]||null:null})[_0xa6be('0xd')](function(_0x567eb3){logger[_0xa6be('0xe')](_0xa6be('0x1e'),_0x5a898c);logger[_0xa6be('0x11')](_0xa6be('0x1e'),_0x5a898c,JSON[_0xa6be('0x1c')](_0x567eb3));_0x570b48(_0x567eb3);})[_0xa6be('0x1d')](function(_0x2ba4a0){logger[_0xa6be('0x13')](_0xa6be('0x1e'),_0x2ba4a0[_0xa6be('0x14')],_0x5a898c);_0x5de3c1(_0xec92d7[_0xa6be('0x13')](0x1f4,_0x2ba4a0['message']));});});};