3da8db608a4bff8e4236d08e64fe3a6720e7ce07
[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 _0xa149=['result','catch','CreateOpenchannelQueueReport','create','options','stringify','UpdateOpenchannelQueueReport','OpenchannelQueueReport','update','body','where','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','then','info','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','error','message'];(function(_0x510ded,_0x8ab763){var _0x4db83b=function(_0xa88c4b){while(--_0xa88c4b){_0x510ded['push'](_0x510ded['shift']());}};_0x4db83b(++_0x8ab763);}(_0xa149,0x18c));var _0x9a14=function(_0x12cd76,_0x5ceea4){_0x12cd76=_0x12cd76-0x0;var _0xa8e693=_0xa149[_0x12cd76];return _0xa8e693;};'use strict';var _=require(_0x9a14('0x0'));var util=require(_0x9a14('0x1'));var moment=require(_0x9a14('0x2'));var BPromise=require(_0x9a14('0x3'));var rs=require(_0x9a14('0x4'));var fs=require('fs');var Redis=require(_0x9a14('0x5'));var db=require(_0x9a14('0x6'))['db'];var utils=require(_0x9a14('0x7'));var logger=require(_0x9a14('0x8'))('rpc');var config=require(_0x9a14('0x9'));var jayson=require(_0x9a14('0xa'));var client=jayson['client'][_0x9a14('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3beb93,_0x286760,_0x17d2e5){return new BPromise(function(_0x109f69,_0x26efc5){return client['request'](_0x3beb93,_0x17d2e5)[_0x9a14('0xc')](function(_0x4bdd6c){logger[_0x9a14('0xd')](_0x9a14('0xe'),_0x286760,_0x9a14('0xf'));logger[_0x9a14('0x10')](_0x9a14('0x11'),_0x286760,_0x9a14('0xf'),JSON['stringify'](_0x4bdd6c));if(_0x4bdd6c['error']){if(_0x4bdd6c['error']['code']===0x1f4){logger[_0x9a14('0x12')](_0x9a14('0xe'),_0x286760,_0x4bdd6c['error'][_0x9a14('0x13')]);return _0x26efc5(_0x4bdd6c['error'][_0x9a14('0x13')]);}logger['error']('OpenchannelQueueReport,\x20%s,\x20%s',_0x286760,_0x4bdd6c[_0x9a14('0x12')][_0x9a14('0x13')]);return _0x109f69(_0x4bdd6c[_0x9a14('0x12')][_0x9a14('0x13')]);}else{logger['info'](_0x9a14('0xe'),_0x286760,_0x9a14('0xf'));_0x109f69(_0x4bdd6c[_0x9a14('0x14')][_0x9a14('0x13')]);}})[_0x9a14('0x15')](function(_0x5b3a7a){logger[_0x9a14('0x12')](_0x9a14('0xe'),_0x286760,_0x5b3a7a);_0x26efc5(_0x5b3a7a);});});}exports[_0x9a14('0x16')]=function(_0x3aa654){var _0x38be44=this;return new Promise(function(_0x55a283,_0x5287e6){return db['OpenchannelQueueReport'][_0x9a14('0x17')](_0x3aa654['body'],{'raw':_0x3aa654[_0x9a14('0x18')]?_0x3aa654[_0x9a14('0x18')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x53e151){logger['info'](_0x9a14('0x16'),_0x3aa654);logger[_0x9a14('0x10')](_0x9a14('0x16'),_0x3aa654,JSON[_0x9a14('0x19')](_0x53e151));_0x55a283(_0x53e151);})[_0x9a14('0x15')](function(_0xc78dd7){logger[_0x9a14('0x12')]('CreateOpenchannelQueueReport',_0xc78dd7['message'],_0x3aa654);_0x5287e6(_0x38be44[_0x9a14('0x12')](0x1f4,_0xc78dd7[_0x9a14('0x13')]));});});};exports[_0x9a14('0x1a')]=function(_0x53aab4){var _0x3be9da=this;return new Promise(function(_0x1c8ae3,_0x1e477f){return db[_0x9a14('0x1b')][_0x9a14('0x1c')](_0x53aab4[_0x9a14('0x1d')],{'raw':_0x53aab4[_0x9a14('0x18')]?_0x53aab4[_0x9a14('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x53aab4['options']?_0x53aab4[_0x9a14('0x18')][_0x9a14('0x1e')]||null:null,'attributes':_0x53aab4[_0x9a14('0x18')]?_0x53aab4['options']['attributes']||null:null,'limit':_0x53aab4[_0x9a14('0x18')]?_0x53aab4[_0x9a14('0x18')][_0x9a14('0x1f')]||null:null})[_0x9a14('0xc')](function(_0x47755e){logger['info'](_0x9a14('0x1a'),_0x53aab4);logger[_0x9a14('0x10')]('UpdateOpenchannelQueueReport',_0x53aab4,JSON[_0x9a14('0x19')](_0x47755e));_0x1c8ae3(_0x47755e);})[_0x9a14('0x15')](function(_0x4cc000){logger[_0x9a14('0x12')]('UpdateOpenchannelQueueReport',_0x4cc000[_0x9a14('0x13')],_0x53aab4);_0x1e477f(_0x3be9da[_0x9a14('0x12')](0x1f4,_0x4cc000[_0x9a14('0x13')]));});});};