Built motion from commit (unavailable).|2.4.20
[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 _0x7382=['error','code','message','result','catch','CreateOpenchannelQueueReport','OpenchannelQueueReport','body','options','raw','stringify','UpdateOpenchannelQueueReport','update','util','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','OpenchannelQueueReport,\x20%s,\x20%s','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x489166,_0x22a91b){var _0x2ab3ad=function(_0x191bba){while(--_0x191bba){_0x489166['push'](_0x489166['shift']());}};_0x2ab3ad(++_0x22a91b);}(_0x7382,0x111));var _0x2738=function(_0x3a724f,_0x484850){_0x3a724f=_0x3a724f-0x0;var _0x1b845f=_0x7382[_0x3a724f];return _0x1b845f;};'use strict';var _=require('lodash');var util=require(_0x2738('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x2738('0x1'));var logger=require(_0x2738('0x2'))(_0x2738('0x3'));var config=require(_0x2738('0x4'));var jayson=require(_0x2738('0x5'));var client=jayson['client'][_0x2738('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x2bc38a,_0xd74b07,_0x523aef){return new BPromise(function(_0x4235e7,_0x487d14){return client[_0x2738('0x7')](_0x2bc38a,_0x523aef)['then'](function(_0x476864){logger[_0x2738('0x8')](_0x2738('0x9'),_0xd74b07,'request\x20sent');logger[_0x2738('0xa')](_0x2738('0xb'),_0xd74b07,_0x2738('0xc'),JSON['stringify'](_0x476864));if(_0x476864['error']){if(_0x476864[_0x2738('0xd')][_0x2738('0xe')]===0x1f4){logger[_0x2738('0xd')](_0x2738('0x9'),_0xd74b07,_0x476864[_0x2738('0xd')][_0x2738('0xf')]);return _0x487d14(_0x476864[_0x2738('0xd')][_0x2738('0xf')]);}logger[_0x2738('0xd')](_0x2738('0x9'),_0xd74b07,_0x476864[_0x2738('0xd')]['message']);return _0x4235e7(_0x476864[_0x2738('0xd')][_0x2738('0xf')]);}else{logger['info'](_0x2738('0x9'),_0xd74b07,'request\x20sent');_0x4235e7(_0x476864[_0x2738('0x10')]['message']);}})[_0x2738('0x11')](function(_0x568065){logger[_0x2738('0xd')](_0x2738('0x9'),_0xd74b07,_0x568065);_0x487d14(_0x568065);});});}exports[_0x2738('0x12')]=function(_0x3c6810){var _0x1d0aca=this;return new Promise(function(_0x1e0f57,_0x42685a){return db[_0x2738('0x13')]['create'](_0x3c6810[_0x2738('0x14')],{'raw':_0x3c6810['options']?_0x3c6810[_0x2738('0x15')][_0x2738('0x16')]===undefined?!![]:![]:!![]})['then'](function(_0x5a1d61){logger[_0x2738('0x8')](_0x2738('0x12'),_0x3c6810);logger[_0x2738('0xa')](_0x2738('0x12'),_0x3c6810,JSON[_0x2738('0x17')](_0x5a1d61));_0x1e0f57(_0x5a1d61);})[_0x2738('0x11')](function(_0x18e1d8){logger[_0x2738('0xd')](_0x2738('0x12'),_0x18e1d8[_0x2738('0xf')],_0x3c6810);_0x42685a(_0x1d0aca[_0x2738('0xd')](0x1f4,_0x18e1d8['message']));});});};exports[_0x2738('0x18')]=function(_0x537c5f){var _0x51ee19=this;return new Promise(function(_0x3e3b2d,_0x2d8c5b){return db[_0x2738('0x13')][_0x2738('0x19')](_0x537c5f[_0x2738('0x14')],{'raw':_0x537c5f[_0x2738('0x15')]?_0x537c5f[_0x2738('0x15')][_0x2738('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x537c5f['options']?_0x537c5f[_0x2738('0x15')]['where']||null:null,'attributes':_0x537c5f[_0x2738('0x15')]?_0x537c5f[_0x2738('0x15')]['attributes']||null:null,'limit':_0x537c5f[_0x2738('0x15')]?_0x537c5f[_0x2738('0x15')]['limit']||null:null})['then'](function(_0x4fad4c){logger['info'](_0x2738('0x18'),_0x537c5f);logger[_0x2738('0xa')](_0x2738('0x18'),_0x537c5f,JSON[_0x2738('0x17')](_0x4fad4c));_0x3e3b2d(_0x4fad4c);})[_0x2738('0x11')](function(_0x2b317c){logger['error'](_0x2738('0x18'),_0x2b317c[_0x2738('0xf')],_0x537c5f);_0x2d8c5b(_0x51ee19[_0x2738('0xd')](0x1f4,_0x2b317c[_0x2738('0xf')]));});});};