Built motion from commit 87cd5f02.|2.5.48
[motion2.git] / server / api / openchannelQueueReport / openchannelQueueReport.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 _0x955f=['../../mysqldb','rpc','jayson/promise','client','http','request','then','info','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','create','body','options','raw','CreateOpenchannelQueueReport','UpdateOpenchannelQueueReport','OpenchannelQueueReport','where','attributes','limit','lodash','util','moment','bluebird','randomstring'];(function(_0x456fb1,_0x859a1d){var _0x4083d6=function(_0xe1d0f2){while(--_0xe1d0f2){_0x456fb1['push'](_0x456fb1['shift']());}};_0x4083d6(++_0x859a1d);}(_0x955f,0x1eb));var _0xf955=function(_0x489575,_0x126ac4){_0x489575=_0x489575-0x0;var _0x5e1e85=_0x955f[_0x489575];return _0x5e1e85;};'use strict';var _=require(_0xf955('0x0'));var util=require(_0xf955('0x1'));var moment=require(_0xf955('0x2'));var BPromise=require(_0xf955('0x3'));var rs=require(_0xf955('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf955('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xf955('0x6'));var config=require('../../config/environment');var jayson=require(_0xf955('0x7'));var client=jayson[_0xf955('0x8')][_0xf955('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x59d5b3,_0x18432f,_0x20c096){return new BPromise(function(_0x4f58fb,_0x254b38){return client[_0xf955('0xa')](_0x59d5b3,_0x20c096)[_0xf955('0xb')](function(_0x38b190){logger[_0xf955('0xc')](_0xf955('0xd'),_0x18432f,_0xf955('0xe'));logger['debug'](_0xf955('0xf'),_0x18432f,'request\x20sent',JSON[_0xf955('0x10')](_0x38b190));if(_0x38b190[_0xf955('0x11')]){if(_0x38b190[_0xf955('0x11')]['code']===0x1f4){logger[_0xf955('0x11')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x18432f,_0x38b190[_0xf955('0x11')]['message']);return _0x254b38(_0x38b190[_0xf955('0x11')][_0xf955('0x12')]);}logger[_0xf955('0x11')](_0xf955('0xd'),_0x18432f,_0x38b190[_0xf955('0x11')][_0xf955('0x12')]);return _0x4f58fb(_0x38b190[_0xf955('0x11')][_0xf955('0x12')]);}else{logger[_0xf955('0xc')](_0xf955('0xd'),_0x18432f,'request\x20sent');_0x4f58fb(_0x38b190[_0xf955('0x13')]['message']);}})[_0xf955('0x14')](function(_0x3a814f){logger[_0xf955('0x11')](_0xf955('0xd'),_0x18432f,_0x3a814f);_0x254b38(_0x3a814f);});});}exports['CreateOpenchannelQueueReport']=function(_0x5ac6cb){var _0x1e20d1=this;return new Promise(function(_0xe6de5c,_0x3c49c0){return db['OpenchannelQueueReport'][_0xf955('0x15')](_0x5ac6cb[_0xf955('0x16')],{'raw':_0x5ac6cb[_0xf955('0x17')]?_0x5ac6cb[_0xf955('0x17')][_0xf955('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x17d86a){logger[_0xf955('0xc')](_0xf955('0x19'),_0x5ac6cb);logger['debug'](_0xf955('0x19'),_0x5ac6cb,JSON['stringify'](_0x17d86a));_0xe6de5c(_0x17d86a);})[_0xf955('0x14')](function(_0x43b078){logger[_0xf955('0x11')](_0xf955('0x19'),_0x43b078[_0xf955('0x12')],_0x5ac6cb);_0x3c49c0(_0x1e20d1['error'](0x1f4,_0x43b078[_0xf955('0x12')]));});});};exports[_0xf955('0x1a')]=function(_0x3585c7){var _0x13a1a7=this;return new Promise(function(_0x17dec2,_0x102e36){return db[_0xf955('0x1b')]['update'](_0x3585c7[_0xf955('0x16')],{'raw':_0x3585c7[_0xf955('0x17')]?_0x3585c7[_0xf955('0x17')][_0xf955('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3585c7[_0xf955('0x17')]?_0x3585c7[_0xf955('0x17')][_0xf955('0x1c')]||null:null,'attributes':_0x3585c7['options']?_0x3585c7[_0xf955('0x17')][_0xf955('0x1d')]||null:null,'limit':_0x3585c7[_0xf955('0x17')]?_0x3585c7[_0xf955('0x17')][_0xf955('0x1e')]||null:null})[_0xf955('0xb')](function(_0x4d4af0){logger[_0xf955('0xc')](_0xf955('0x1a'),_0x3585c7);logger['debug'](_0xf955('0x1a'),_0x3585c7,JSON[_0xf955('0x10')](_0x4d4af0));_0x17dec2(_0x4d4af0);})[_0xf955('0x14')](function(_0x1ef794){logger['error'](_0xf955('0x1a'),_0x1ef794['message'],_0x3585c7);_0x102e36(_0x13a1a7[_0xf955('0x11')](0x1f4,_0x1ef794[_0xf955('0x12')]));});});};