d4ccf516f477184b85c6ff3ba212dc4ebc6cc3f9
[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 _0x174b=['body','options','raw','CreateOpenchannelQueueReport','UpdateOpenchannelQueueReport','OpenchannelQueueReport','update','attributes','limit','stringify','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info','request\x20sent','debug','error','OpenchannelQueueReport,\x20%s,\x20%s','message','result','catch','create'];(function(_0x4f2f70,_0x4d23d8){var _0x125186=function(_0x2de2d5){while(--_0x2de2d5){_0x4f2f70['push'](_0x4f2f70['shift']());}};_0x125186(++_0x4d23d8);}(_0x174b,0x19d));var _0xb174=function(_0x5147f0,_0x49650c){_0x5147f0=_0x5147f0-0x0;var _0x384290=_0x174b[_0x5147f0];return _0x384290;};'use strict';var _=require(_0xb174('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xb174('0x1'));var rs=require(_0xb174('0x2'));var fs=require('fs');var Redis=require(_0xb174('0x3'));var db=require(_0xb174('0x4'))['db'];var utils=require(_0xb174('0x5'));var logger=require(_0xb174('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xb174('0x7'));var client=jayson[_0xb174('0x8')][_0xb174('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3e7a36,_0xa073f6,_0x1e3e13){return new BPromise(function(_0x465cd6,_0x149942){return client[_0xb174('0xa')](_0x3e7a36,_0x1e3e13)[_0xb174('0xb')](function(_0x4c3cea){logger[_0xb174('0xc')]('OpenchannelQueueReport,\x20%s,\x20%s',_0xa073f6,_0xb174('0xd'));logger[_0xb174('0xe')]('OpenchannelQueueReport,\x20%s,\x20%s,\x20%s',_0xa073f6,_0xb174('0xd'),JSON['stringify'](_0x4c3cea));if(_0x4c3cea[_0xb174('0xf')]){if(_0x4c3cea[_0xb174('0xf')]['code']===0x1f4){logger[_0xb174('0xf')](_0xb174('0x10'),_0xa073f6,_0x4c3cea[_0xb174('0xf')][_0xb174('0x11')]);return _0x149942(_0x4c3cea['error'][_0xb174('0x11')]);}logger['error'](_0xb174('0x10'),_0xa073f6,_0x4c3cea[_0xb174('0xf')][_0xb174('0x11')]);return _0x465cd6(_0x4c3cea[_0xb174('0xf')]['message']);}else{logger[_0xb174('0xc')](_0xb174('0x10'),_0xa073f6,_0xb174('0xd'));_0x465cd6(_0x4c3cea[_0xb174('0x12')][_0xb174('0x11')]);}})[_0xb174('0x13')](function(_0x5d31ac){logger['error']('OpenchannelQueueReport,\x20%s,\x20%s',_0xa073f6,_0x5d31ac);_0x149942(_0x5d31ac);});});}exports['CreateOpenchannelQueueReport']=function(_0x2ab4dc){var _0x4fb4eb=this;return new Promise(function(_0xaf80a9,_0x1a6f40){return db['OpenchannelQueueReport'][_0xb174('0x14')](_0x2ab4dc[_0xb174('0x15')],{'raw':_0x2ab4dc[_0xb174('0x16')]?_0x2ab4dc[_0xb174('0x16')][_0xb174('0x17')]===undefined?!![]:![]:!![]})[_0xb174('0xb')](function(_0xcc8d9a){logger['info'](_0xb174('0x18'),_0x2ab4dc);logger[_0xb174('0xe')]('CreateOpenchannelQueueReport',_0x2ab4dc,JSON['stringify'](_0xcc8d9a));_0xaf80a9(_0xcc8d9a);})['catch'](function(_0x338dc4){logger[_0xb174('0xf')](_0xb174('0x18'),_0x338dc4['message'],_0x2ab4dc);_0x1a6f40(_0x4fb4eb[_0xb174('0xf')](0x1f4,_0x338dc4[_0xb174('0x11')]));});});};exports[_0xb174('0x19')]=function(_0x5a3fbd){var _0x19473b=this;return new Promise(function(_0x410411,_0x3b5abf){return db[_0xb174('0x1a')][_0xb174('0x1b')](_0x5a3fbd['body'],{'raw':_0x5a3fbd[_0xb174('0x16')]?_0x5a3fbd['options'][_0xb174('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5a3fbd[_0xb174('0x16')]?_0x5a3fbd[_0xb174('0x16')]['where']||null:null,'attributes':_0x5a3fbd['options']?_0x5a3fbd[_0xb174('0x16')][_0xb174('0x1c')]||null:null,'limit':_0x5a3fbd['options']?_0x5a3fbd['options'][_0xb174('0x1d')]||null:null})['then'](function(_0x291d6c){logger[_0xb174('0xc')](_0xb174('0x19'),_0x5a3fbd);logger[_0xb174('0xe')](_0xb174('0x19'),_0x5a3fbd,JSON[_0xb174('0x1e')](_0x291d6c));_0x410411(_0x291d6c);})[_0xb174('0x13')](function(_0x530167){logger['error'](_0xb174('0x19'),_0x530167[_0xb174('0x11')],_0x5a3fbd);_0x3b5abf(_0x19473b[_0xb174('0xf')](0x1f4,_0x530167[_0xb174('0x11')]));});});};