Built motion from commit 3c2ce842.|2.6.31
[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 _0xe2cf=['debug','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateOpenchannelQueueReport','OpenchannelQueueReport','create','body','options','raw','info','UpdateOpenchannelQueueReport','update','where','attributes','limit'];(function(_0x2e426f,_0x28ed37){var _0x273af8=function(_0x30f0c0){while(--_0x30f0c0){_0x2e426f['push'](_0x2e426f['shift']());}};_0x273af8(++_0x28ed37);}(_0xe2cf,0x1a1));var _0xfe2c=function(_0x27f569,_0x11892a){_0x27f569=_0x27f569-0x0;var _0x3774c4=_0xe2cf[_0x27f569];return _0x3774c4;};'use strict';var _=require('lodash');var util=require(_0xfe2c('0x0'));var moment=require('moment');var BPromise=require(_0xfe2c('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfe2c('0x2'));var db=require(_0xfe2c('0x3'))['db'];var utils=require(_0xfe2c('0x4'));var logger=require(_0xfe2c('0x5'))('rpc');var config=require(_0xfe2c('0x6'));var jayson=require(_0xfe2c('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4e0b97,_0x417bc4,_0x5e5b46){return new BPromise(function(_0x485a24,_0x30aafe){return client[_0xfe2c('0x8')](_0x4e0b97,_0x5e5b46)[_0xfe2c('0x9')](function(_0x562414){logger['info'](_0xfe2c('0xa'),_0x417bc4,_0xfe2c('0xb'));logger['debug'](_0xfe2c('0xc'),_0x417bc4,_0xfe2c('0xb'),JSON[_0xfe2c('0xd')](_0x562414));if(_0x562414[_0xfe2c('0xe')]){if(_0x562414[_0xfe2c('0xe')][_0xfe2c('0xf')]===0x1f4){logger[_0xfe2c('0xe')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x417bc4,_0x562414['error']['message']);return _0x30aafe(_0x562414['error'][_0xfe2c('0x10')]);}logger['error']('OpenchannelQueueReport,\x20%s,\x20%s',_0x417bc4,_0x562414[_0xfe2c('0xe')][_0xfe2c('0x10')]);return _0x485a24(_0x562414[_0xfe2c('0xe')][_0xfe2c('0x10')]);}else{logger['info']('OpenchannelQueueReport,\x20%s,\x20%s',_0x417bc4,_0xfe2c('0xb'));_0x485a24(_0x562414[_0xfe2c('0x11')][_0xfe2c('0x10')]);}})[_0xfe2c('0x12')](function(_0x565f40){logger[_0xfe2c('0xe')](_0xfe2c('0xa'),_0x417bc4,_0x565f40);_0x30aafe(_0x565f40);});});}exports[_0xfe2c('0x13')]=function(_0x23242b){var _0x36aeec=this;return new Promise(function(_0x13f233,_0x4afea3){return db[_0xfe2c('0x14')][_0xfe2c('0x15')](_0x23242b[_0xfe2c('0x16')],{'raw':_0x23242b[_0xfe2c('0x17')]?_0x23242b['options'][_0xfe2c('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x4e9137){logger[_0xfe2c('0x19')](_0xfe2c('0x13'),_0x23242b);logger['debug'](_0xfe2c('0x13'),_0x23242b,JSON[_0xfe2c('0xd')](_0x4e9137));_0x13f233(_0x4e9137);})['catch'](function(_0x1bd50e){logger['error'](_0xfe2c('0x13'),_0x1bd50e[_0xfe2c('0x10')],_0x23242b);_0x4afea3(_0x36aeec[_0xfe2c('0xe')](0x1f4,_0x1bd50e[_0xfe2c('0x10')]));});});};exports[_0xfe2c('0x1a')]=function(_0x2ee3b3){var _0x57cd6d=this;return new Promise(function(_0x41a545,_0x45a722){return db[_0xfe2c('0x14')][_0xfe2c('0x1b')](_0x2ee3b3[_0xfe2c('0x16')],{'raw':_0x2ee3b3[_0xfe2c('0x17')]?_0x2ee3b3['options'][_0xfe2c('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2ee3b3['options']?_0x2ee3b3[_0xfe2c('0x17')][_0xfe2c('0x1c')]||null:null,'attributes':_0x2ee3b3[_0xfe2c('0x17')]?_0x2ee3b3['options'][_0xfe2c('0x1d')]||null:null,'limit':_0x2ee3b3[_0xfe2c('0x17')]?_0x2ee3b3['options'][_0xfe2c('0x1e')]||null:null})[_0xfe2c('0x9')](function(_0x3352e8){logger[_0xfe2c('0x19')](_0xfe2c('0x1a'),_0x2ee3b3);logger[_0xfe2c('0x1f')]('UpdateOpenchannelQueueReport',_0x2ee3b3,JSON['stringify'](_0x3352e8));_0x41a545(_0x3352e8);})[_0xfe2c('0x12')](function(_0x13e9a9){logger[_0xfe2c('0xe')](_0xfe2c('0x1a'),_0x13e9a9[_0xfe2c('0x10')],_0x2ee3b3);_0x45a722(_0x57cd6d['error'](0x1f4,_0x13e9a9[_0xfe2c('0x10')]));});});};