c95df2932a8abd374ebe51163394f6fee2a81bfb
[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 _0x7fea=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','info','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','CreateOpenchannelQueueReport','OpenchannelQueueReport','create','options','raw','then','debug','stringify','update','body','where','attributes','limit','UpdateOpenchannelQueueReport','util'];(function(_0x29f6e6,_0x5e1b32){var _0x1a1e72=function(_0x4ee062){while(--_0x4ee062){_0x29f6e6['push'](_0x29f6e6['shift']());}};_0x1a1e72(++_0x5e1b32);}(_0x7fea,0x149));var _0xa7fe=function(_0x117cfa,_0x2ca9cb){_0x117cfa=_0x117cfa-0x0;var _0x4d014b=_0x7fea[_0x117cfa];return _0x4d014b;};'use strict';var _=require('lodash');var util=require(_0xa7fe('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xa7fe('0x1'));var fs=require('fs');var Redis=require(_0xa7fe('0x2'));var db=require(_0xa7fe('0x3'))['db'];var utils=require(_0xa7fe('0x4'));var logger=require(_0xa7fe('0x5'))(_0xa7fe('0x6'));var config=require('../../config/environment');var jayson=require(_0xa7fe('0x7'));var client=jayson[_0xa7fe('0x8')][_0xa7fe('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1132f1,_0x45f967,_0x3597b0){return new BPromise(function(_0x4668f0,_0x3d9135){return client['request'](_0x1132f1,_0x3597b0)['then'](function(_0x1db10e){logger[_0xa7fe('0xa')](_0xa7fe('0xb'),_0x45f967,_0xa7fe('0xc'));logger['debug'](_0xa7fe('0xd'),_0x45f967,_0xa7fe('0xc'),JSON['stringify'](_0x1db10e));if(_0x1db10e[_0xa7fe('0xe')]){if(_0x1db10e['error'][_0xa7fe('0xf')]===0x1f4){logger['error']('OpenchannelQueueReport,\x20%s,\x20%s',_0x45f967,_0x1db10e[_0xa7fe('0xe')][_0xa7fe('0x10')]);return _0x3d9135(_0x1db10e[_0xa7fe('0xe')][_0xa7fe('0x10')]);}logger[_0xa7fe('0xe')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x45f967,_0x1db10e['error'][_0xa7fe('0x10')]);return _0x4668f0(_0x1db10e[_0xa7fe('0xe')][_0xa7fe('0x10')]);}else{logger[_0xa7fe('0xa')](_0xa7fe('0xb'),_0x45f967,'request\x20sent');_0x4668f0(_0x1db10e[_0xa7fe('0x11')][_0xa7fe('0x10')]);}})[_0xa7fe('0x12')](function(_0x253293){logger[_0xa7fe('0xe')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x45f967,_0x253293);_0x3d9135(_0x253293);});});}exports[_0xa7fe('0x13')]=function(_0x1e4966){var _0x2bf8db=this;return new Promise(function(_0x2ef53c,_0x179b9e){return db[_0xa7fe('0x14')][_0xa7fe('0x15')](_0x1e4966['body'],{'raw':_0x1e4966['options']?_0x1e4966[_0xa7fe('0x16')][_0xa7fe('0x17')]===undefined?!![]:![]:!![]})[_0xa7fe('0x18')](function(_0x529990){logger[_0xa7fe('0xa')](_0xa7fe('0x13'),_0x1e4966);logger[_0xa7fe('0x19')]('CreateOpenchannelQueueReport',_0x1e4966,JSON[_0xa7fe('0x1a')](_0x529990));_0x2ef53c(_0x529990);})[_0xa7fe('0x12')](function(_0x1619c1){logger[_0xa7fe('0xe')](_0xa7fe('0x13'),_0x1619c1[_0xa7fe('0x10')],_0x1e4966);_0x179b9e(_0x2bf8db[_0xa7fe('0xe')](0x1f4,_0x1619c1[_0xa7fe('0x10')]));});});};exports['UpdateOpenchannelQueueReport']=function(_0x3415b8){var _0x4fb801=this;return new Promise(function(_0x4ce2e7,_0x37c8fa){return db[_0xa7fe('0x14')][_0xa7fe('0x1b')](_0x3415b8[_0xa7fe('0x1c')],{'raw':_0x3415b8[_0xa7fe('0x16')]?_0x3415b8['options'][_0xa7fe('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3415b8[_0xa7fe('0x16')]?_0x3415b8[_0xa7fe('0x16')][_0xa7fe('0x1d')]||null:null,'attributes':_0x3415b8[_0xa7fe('0x16')]?_0x3415b8[_0xa7fe('0x16')][_0xa7fe('0x1e')]||null:null,'limit':_0x3415b8[_0xa7fe('0x16')]?_0x3415b8[_0xa7fe('0x16')][_0xa7fe('0x1f')]||null:null})[_0xa7fe('0x18')](function(_0x19dd83){logger[_0xa7fe('0xa')](_0xa7fe('0x20'),_0x3415b8);logger[_0xa7fe('0x19')](_0xa7fe('0x20'),_0x3415b8,JSON[_0xa7fe('0x1a')](_0x19dd83));_0x4ce2e7(_0x19dd83);})[_0xa7fe('0x12')](function(_0x1c9e5a){logger[_0xa7fe('0xe')]('UpdateOpenchannelQueueReport',_0x1c9e5a[_0xa7fe('0x10')],_0x3415b8);_0x37c8fa(_0x4fb801[_0xa7fe('0xe')](0x1f4,_0x1c9e5a['message']));});});};