Built motion from commit (unavailable).|2.5.10
[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 _0xc8b0=['stringify','error','code','message','result','CreateOpenchannelQueueReport','OpenchannelQueueReport','body','options','raw','then','catch','UpdateOpenchannelQueueReport','where','attributes','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s'];(function(_0x263b0e,_0xc6479f){var _0x113fee=function(_0x803881){while(--_0x803881){_0x263b0e['push'](_0x263b0e['shift']());}};_0x113fee(++_0xc6479f);}(_0xc8b0,0x1d1));var _0x0c8b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc8b0[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x0c8b('0x0'));var BPromise=require(_0x0c8b('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0c8b('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x0c8b('0x3'));var logger=require(_0x0c8b('0x4'))(_0x0c8b('0x5'));var config=require(_0x0c8b('0x6'));var jayson=require(_0x0c8b('0x7'));var client=jayson[_0x0c8b('0x8')][_0x0c8b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x17ebf2,_0xdaaa1,_0x4eb8d8){return new BPromise(function(_0xd18dbd,_0x5526b9){return client['request'](_0x17ebf2,_0x4eb8d8)['then'](function(_0xfc31c6){logger[_0x0c8b('0xa')](_0x0c8b('0xb'),_0xdaaa1,_0x0c8b('0xc'));logger[_0x0c8b('0xd')](_0x0c8b('0xe'),_0xdaaa1,_0x0c8b('0xc'),JSON[_0x0c8b('0xf')](_0xfc31c6));if(_0xfc31c6['error']){if(_0xfc31c6[_0x0c8b('0x10')][_0x0c8b('0x11')]===0x1f4){logger[_0x0c8b('0x10')]('OpenchannelQueueReport,\x20%s,\x20%s',_0xdaaa1,_0xfc31c6['error'][_0x0c8b('0x12')]);return _0x5526b9(_0xfc31c6[_0x0c8b('0x10')]['message']);}logger[_0x0c8b('0x10')]('OpenchannelQueueReport,\x20%s,\x20%s',_0xdaaa1,_0xfc31c6[_0x0c8b('0x10')][_0x0c8b('0x12')]);return _0xd18dbd(_0xfc31c6[_0x0c8b('0x10')][_0x0c8b('0x12')]);}else{logger[_0x0c8b('0xa')](_0x0c8b('0xb'),_0xdaaa1,'request\x20sent');_0xd18dbd(_0xfc31c6[_0x0c8b('0x13')]['message']);}})['catch'](function(_0x2988cb){logger['error'](_0x0c8b('0xb'),_0xdaaa1,_0x2988cb);_0x5526b9(_0x2988cb);});});}exports[_0x0c8b('0x14')]=function(_0xd64343){var _0x575777=this;return new Promise(function(_0x1d7013,_0x2cd85d){return db[_0x0c8b('0x15')]['create'](_0xd64343[_0x0c8b('0x16')],{'raw':_0xd64343[_0x0c8b('0x17')]?_0xd64343[_0x0c8b('0x17')][_0x0c8b('0x18')]===undefined?!![]:![]:!![]})[_0x0c8b('0x19')](function(_0x1c21a3){logger[_0x0c8b('0xa')](_0x0c8b('0x14'),_0xd64343);logger[_0x0c8b('0xd')](_0x0c8b('0x14'),_0xd64343,JSON['stringify'](_0x1c21a3));_0x1d7013(_0x1c21a3);})[_0x0c8b('0x1a')](function(_0x2b65bc){logger[_0x0c8b('0x10')](_0x0c8b('0x14'),_0x2b65bc[_0x0c8b('0x12')],_0xd64343);_0x2cd85d(_0x575777[_0x0c8b('0x10')](0x1f4,_0x2b65bc['message']));});});};exports[_0x0c8b('0x1b')]=function(_0x121b0d){var _0x8d20c0=this;return new Promise(function(_0x5dbf81,_0x23a091){return db[_0x0c8b('0x15')]['update'](_0x121b0d[_0x0c8b('0x16')],{'raw':_0x121b0d[_0x0c8b('0x17')]?_0x121b0d[_0x0c8b('0x17')][_0x0c8b('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x121b0d['options']?_0x121b0d[_0x0c8b('0x17')][_0x0c8b('0x1c')]||null:null,'attributes':_0x121b0d[_0x0c8b('0x17')]?_0x121b0d[_0x0c8b('0x17')][_0x0c8b('0x1d')]||null:null,'limit':_0x121b0d[_0x0c8b('0x17')]?_0x121b0d[_0x0c8b('0x17')]['limit']||null:null})[_0x0c8b('0x19')](function(_0x348606){logger[_0x0c8b('0xa')]('UpdateOpenchannelQueueReport',_0x121b0d);logger['debug']('UpdateOpenchannelQueueReport',_0x121b0d,JSON[_0x0c8b('0xf')](_0x348606));_0x5dbf81(_0x348606);})['catch'](function(_0x259358){logger['error'](_0x0c8b('0x1b'),_0x259358[_0x0c8b('0x12')],_0x121b0d);_0x23a091(_0x8d20c0[_0x0c8b('0x10')](0x1f4,_0x259358[_0x0c8b('0x12')]));});});};